From: Daniel Borkmann Date: Fri, 11 Apr 2014 11:22:00 +0000 (+0200) Subject: pktgen: be friendly to LLTX devices X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0f2eea4b7e29ab693b07f6eedf8e87a0c11b8b42;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git pktgen: be friendly to LLTX devices Similarly to commit 43279500deca ("packet: respect devices with LLTX flag in direct xmit"), we can basically apply the very same to pktgen. This will help testing against LLTX devices such as dummy driver (or others), which only have a single netdevice txq and would otherwise require locking their txq from pktgen side while e.g. in dummy case, we would not need any locking. Fix this by making use of HARD_TX_{UN,}LOCK API, so that NETIF_F_LLTX will be respected. Signed-off-by: Daniel Borkmann Signed-off-by: Jesper Dangaard Brouer Cc: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d068ec25db1e..0304f981f7ff 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3338,7 +3338,9 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) queue_map = skb_get_queue_mapping(pkt_dev->skb); txq = netdev_get_tx_queue(odev, queue_map); - __netif_tx_lock_bh(txq); + local_bh_disable(); + + HARD_TX_LOCK(odev, txq, smp_processor_id()); if (unlikely(netif_xmit_frozen_or_drv_stopped(txq))) { ret = NETDEV_TX_BUSY; @@ -3374,7 +3376,9 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) pkt_dev->last_ok = 0; } unlock: - __netif_tx_unlock_bh(txq); + HARD_TX_UNLOCK(odev, txq); + + local_bh_enable(); /* If pkt_dev->count is zero, then run forever */ if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) {