Skip to contentSkip to conversation

cqe, cqe_skb: return when both or when either NULL?

DISCUSSION Roel Kluin 2 participants 2 messages Nov 23, 2007 – Nov 26, 2007

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

In function ehea_poll() drivers/net/ehea/ehea_main.c:667, in a loop cqe and cqe_skb - both struct ehea_cqe pointers - are assigned:
--
cqe = ehea_poll_rq1(pr->qp, &wqe_index);
cqe_skb = ehea_poll_cq(pr->send_cq);

if (!cqe && !cqe_skb)

	return rx;

--
Is it intended that only when both are NULL there is a return, or should there be returned when either is NULL (and the && replaced with ||).

If the code is ok as is, sorry for the noise.

#1 lore raw

Hi

Quoted 11 lines · Roel Kluin

In function ehea_poll() drivers/net/ehea/ehea_main.c:667, in a loop cqe and cqe_skb - both struct ehea_cqe pointers - are assigned:
--
cqe = ehea_poll_rq1(pr->qp, &wqe_index);
cqe_skb = ehea_poll_cq(pr->send_cq);

if (!cqe && !cqe_skb)

	return rx;

--
Is it intended that only when both are NULL there is a return, or should there be returned when either is NULL (and the && replaced with ||).

The AND is intended. We can only return if cqe==NULL. If cqe!=NULL and we return anyway, more packets are in the receive queue and the stack won't call poll again until the next interrupt occurs. Received packets might stay unprocessed for quite some time in the queue.
In case there are more resources (SKBs) from send side
to be freed we'll do an extra round.

Regards,
Jan-Bernd