1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright 2014 Cisco Systems, Inc. All rights reserved. */
7 #include "snic_fwint.h"
9 static inline unsigned int
10 vnic_cq_fw_service(struct vnic_cq
*cq
,
11 int (*q_service
)(struct vnic_dev
*vdev
,
13 struct snic_fw_req
*desc
),
14 unsigned int work_to_do
)
17 struct snic_fw_req
*desc
;
18 unsigned int work_done
= 0;
21 desc
= (struct snic_fw_req
*)((u8
*)cq
->ring
.descs
+
22 cq
->ring
.desc_size
* cq
->to_clean
);
23 snic_color_dec(desc
, &color
);
25 while (color
!= cq
->last_color
) {
27 if ((*q_service
)(cq
->vdev
, cq
->index
, desc
))
31 if (cq
->to_clean
== cq
->ring
.desc_count
) {
33 cq
->last_color
= cq
->last_color
? 0 : 1;
36 desc
= (struct snic_fw_req
*)((u8
*)cq
->ring
.descs
+
37 cq
->ring
.desc_size
* cq
->to_clean
);
38 snic_color_dec(desc
, &color
);
41 if (work_done
>= work_to_do
)
48 #endif /* _VNIC_CQ_FW_H_ */