Message ID | 20090202.140115.240697048.davem@davemloft.net |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, Feb 02, 2009 at 02:01:15PM -0800, David Miller wrote: > > 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(). 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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 3d1d7b6..79363b8 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -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); } }
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. Signed-off-by: David S. Miller <davem@davemloft.net> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html