1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
4 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
6 #ifndef _VNIC_CQ_COPY_H_
7 #define _VNIC_CQ_COPY_H_
11 static inline unsigned int vnic_cq_copy_service(
13 int (*q_service
)(struct vnic_dev
*vdev
,
15 struct fcpio_fw_req
*desc
),
16 unsigned int work_to_do
)
19 struct fcpio_fw_req
*desc
;
20 unsigned int work_done
= 0;
23 desc
= (struct fcpio_fw_req
*)((u8
*)cq
->ring
.descs
+
24 cq
->ring
.desc_size
* cq
->to_clean
);
25 fcpio_color_dec(desc
, &color
);
27 while (color
!= cq
->last_color
) {
29 if ((*q_service
)(cq
->vdev
, cq
->index
, desc
))
33 if (cq
->to_clean
== cq
->ring
.desc_count
) {
35 cq
->last_color
= cq
->last_color
? 0 : 1;
38 desc
= (struct fcpio_fw_req
*)((u8
*)cq
->ring
.descs
+
39 cq
->ring
.desc_size
* cq
->to_clean
);
40 fcpio_color_dec(desc
, &color
);
43 if (work_done
>= work_to_do
)
50 #endif /* _VNIC_CQ_COPY_H_ */