Skip to contentSkip to conversation

qlge packet receive

PATCH David Miller 2 participants 2 messages Feb 2, 2009 – Feb 3, 2009

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

I wanted to mention a bug that I noticed in the qlge driver while perusing NAPI capable drivers last week.

Although qlge uses NAPI polling, it passes packets into the stack using netif_rx() and vlan_hwaccel_rx().

That's wrong and incredibly inefficient, because these routines are for the cases where the driver receives packets in hardware interrupt context, so they schedule a new software interrupt to process the frames.

NAPI ->poll() executes in software interrupt context so you can pass the packets directly into the stack using netif_receive_skb() and vlan_hwaccel_receive_skb().

It should even be fine to do this via the delayed workqueue that calls ql_rx_clean().

Something like this:

qlge: Use netif_receive_skb() and vlan_hwaccel_receive_skb().

Since we receive packets either in software interrupt context (via NAPI ->poll()) or process context (via delayed workqueues) we should pass packets directly into the stack instead of deferring them via another level of software interrupt processing.

drivers/net/qlge/qlge_main.c +3 -3
index 3d1d7b6..79363b8 100644
@@ -1449,12 +1449,12 @@ static void ql_process_mac_rx_intr(struct ql_adapter *qdev,
 	if (qdev->vlgrp && (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V)) {
 		QPRINTK(qdev, RX_STATUS, DEBUG,
 			"Passing a VLAN packet upstream.\n");
-		vlan_hwaccel_rx(skb, qdev->vlgrp,
-				le16_to_cpu(ib_mac_rsp->vlan_id));
+		vlan_hwaccel_receive_skb(skb, qdev->vlgrp,
+					 le16_to_cpu(ib_mac_rsp->vlan_id));
 	} else {
 		QPRINTK(qdev, RX_STATUS, DEBUG,
 			"Passing a normal packet upstream.\n");
-		netif_rx(skb);
+		netif_receive_skb(skb);
 	}
 }
 
#1 lore raw
Quoted 7 lines · David Miller

I wanted to mention a bug that I noticed in the qlge driver while perusing NAPI capable drivers last week.

Although qlge uses NAPI polling, it passes packets into the stack using netif_rx() and vlan_hwaccel_rx().

Quoted 8 lines

That's wrong and incredibly inefficient, because these routines are for the cases where the driver receives packets in hardware interrupt context, so they schedule a new software interrupt to process the frames.

NAPI ->poll() executes in software interrupt context so you can pass the packets directly into the stack using netif_receive_skb() and vlan_hwaccel_receive_skb().

Thanks Dave. I've changed this and also added gro to my net-next branch. I will send up this bugfix up for 2.6.29 in a few days.