lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180610160217.3146-10-toshiaki.makita1@gmail.com>
Date:   Mon, 11 Jun 2018 01:02:17 +0900
From:   Toshiaki Makita <toshiaki.makita1@...il.com>
To:     netdev@...r.kernel.org
Cc:     Toshiaki Makita <makita.toshiaki@....ntt.co.jp>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
Subject: [PATCH RFC v2 9/9] veth: Bulk skb xmit for XDP path

From: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>

Aquire txq lock instead of rxq ptr_ring lock so we avoid per-packet
lock when skb->xmit_more is true. We ensure that rxqs are always not
less than txqs and txq to rxq is one to one mapping, so we can
completely remove rxq side lock.

Since we removed rxq side lock, this change does not increase the number
of locking even when bulk sending is not possible, e.g. non-GSO packets.

Signed-off-by: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>
---
 drivers/net/veth.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 67debd3eafe6..376d70f983e5 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -138,7 +138,7 @@ static void __veth_xdp_flush(struct veth_rq *rq)
 
 static int veth_xdp_rx(struct veth_rq *rq, struct sk_buff *skb)
 {
-	if (unlikely(ptr_ring_produce(&rq->xdp_ring, skb))) {
+	if (unlikely(__ptr_ring_produce(&rq->xdp_ring, skb))) {
 		dev_kfree_skb_any(skb);
 		return NET_RX_DROP;
 	}
@@ -188,7 +188,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 		atomic64_inc(&priv->dropped);
 	}
 
-	if (rcv_xdp)
+	if (rcv_xdp && !skb->xmit_more)
 		__veth_xdp_flush(rq);
 
 	rcu_read_unlock();
@@ -829,15 +829,21 @@ static netdev_features_t veth_fix_features(struct net_device *dev,
 {
 	struct veth_priv *priv = netdev_priv(dev);
 	struct net_device *peer;
+	bool xdp = false;
 
 	peer = rtnl_dereference(priv->peer);
 	if (peer) {
 		struct veth_priv *peer_priv = netdev_priv(peer);
 
 		if (rtnl_dereference(peer_priv->rq[0].xdp_prog))
-			features &= ~NETIF_F_GSO_SOFTWARE;
+			xdp = true;
 	}
 
+	if (xdp)
+		features &= ~(NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX);
+	else
+		features |= NETIF_F_LLTX;
+
 	return features;
 }
 
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ