netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush
@ 2018-06-05 11:55 Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 1/5] i40e: remove ndo_xdp_flush call i40e_xdp_flush Jesper Dangaard Brouer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

This patchset removes the net_device operation ndo_xdp_flush() call.
This is a follow merge commit ea9916ea3ed9 ("Merge branch
'ndo_xdp_xmit-cleanup'").  As after commit c1ece6b245bd ("bpf/xdp:
devmap can avoid calling ndo_xdp_flush") no callers of ndo_xdp_flush
are left in bpf-next tree.

---

Jesper Dangaard Brouer (5):
      i40e: remove ndo_xdp_flush call i40e_xdp_flush
      ixgbe: remove ndo_xdp_flush call ixgbe_xdp_flush
      virtio_net: remove ndo_xdp_flush call virtnet_xdp_flush
      tun: remove ndo_xdp_flush call tun_xdp_flush
      net: remove net_device operation ndo_xdp_flush


 drivers/net/ethernet/intel/i40e/i40e_main.c   |    1 -
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |   19 -------------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.h   |    1 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   21 ---------------------
 drivers/net/tun.c                             |   23 +----------------------
 drivers/net/virtio_net.c                      |   13 -------------
 include/linux/netdevice.h                     |    4 ----
 7 files changed, 1 insertion(+), 81 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bpf-next PATCH 1/5] i40e: remove ndo_xdp_flush call i40e_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 11:55 ` Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 2/5] ixgbe: remove ndo_xdp_flush call ixgbe_xdp_flush Jesper Dangaard Brouer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

Remove the ndo_xdp_flush call implementation i40e_xdp_flush
as no callers of ndo_xdp_flush are left.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c |    1 -
 drivers/net/ethernet/intel/i40e/i40e_txrx.c |   19 -------------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.h |    1 -
 3 files changed, 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b5daa5c9c7de..c944bd10b03d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -11883,7 +11883,6 @@ static const struct net_device_ops i40e_netdev_ops = {
 	.ndo_bridge_setlink	= i40e_ndo_bridge_setlink,
 	.ndo_bpf		= i40e_xdp,
 	.ndo_xdp_xmit		= i40e_xdp_xmit,
-	.ndo_xdp_flush		= i40e_xdp_flush,
 };
 
 /**
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5f01e4ce9c92..713995d04783 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -3707,22 +3707,3 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
 
 	return n - drops;
 }
-
-/**
- * i40e_xdp_flush - Implements ndo_xdp_flush
- * @dev: netdev
- **/
-void i40e_xdp_flush(struct net_device *dev)
-{
-	struct i40e_netdev_priv *np = netdev_priv(dev);
-	unsigned int queue_index = smp_processor_id();
-	struct i40e_vsi *vsi = np->vsi;
-
-	if (test_bit(__I40E_VSI_DOWN, vsi->state))
-		return;
-
-	if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
-		return;
-
-	i40e_xdp_ring_update_tail(vsi->xdp_rings[queue_index]);
-}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index 820f76db251b..bb04f6a731fe 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -489,7 +489,6 @@ int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size);
 bool __i40e_chk_linearize(struct sk_buff *skb);
 int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
 		  u32 flags);
-void i40e_xdp_flush(struct net_device *dev);
 
 /**
  * i40e_get_head - Retrieve head from head writeback

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bpf-next PATCH 2/5] ixgbe: remove ndo_xdp_flush call ixgbe_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 1/5] i40e: remove ndo_xdp_flush call i40e_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 11:55 ` Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 3/5] virtio_net: remove ndo_xdp_flush call virtnet_xdp_flush Jesper Dangaard Brouer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

Remove the ndo_xdp_flush call implementation ixgbe_xdp_flush
as no callers of ndo_xdp_flush are left.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4fd77c9067f2..ef1afb3a8a97 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -10069,26 +10069,6 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n,
 	return n - drops;
 }
 
-static void ixgbe_xdp_flush(struct net_device *dev)
-{
-	struct ixgbe_adapter *adapter = netdev_priv(dev);
-	struct ixgbe_ring *ring;
-
-	/* Its possible the device went down between xdp xmit and flush so
-	 * we need to ensure device is still up.
-	 */
-	if (unlikely(test_bit(__IXGBE_DOWN, &adapter->state)))
-		return;
-
-	ring = adapter->xdp_prog ? adapter->xdp_ring[smp_processor_id()] : NULL;
-	if (unlikely(!ring))
-		return;
-
-	ixgbe_xdp_ring_update_tail(ring);
-
-	return;
-}
-
 static const struct net_device_ops ixgbe_netdev_ops = {
 	.ndo_open		= ixgbe_open,
 	.ndo_stop		= ixgbe_close,
@@ -10136,7 +10116,6 @@ static const struct net_device_ops ixgbe_netdev_ops = {
 	.ndo_features_check	= ixgbe_features_check,
 	.ndo_bpf		= ixgbe_xdp,
 	.ndo_xdp_xmit		= ixgbe_xdp_xmit,
-	.ndo_xdp_flush		= ixgbe_xdp_flush,
 };
 
 /**

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bpf-next PATCH 3/5] virtio_net: remove ndo_xdp_flush call virtnet_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 1/5] i40e: remove ndo_xdp_flush call i40e_xdp_flush Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 2/5] ixgbe: remove ndo_xdp_flush call ixgbe_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 11:55 ` Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 4/5] tun: remove ndo_xdp_flush call tun_xdp_flush Jesper Dangaard Brouer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

Remove the ndo_xdp_flush call implementation virtnet_xdp_flush
as no callers of ndo_xdp_flush are left.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/virtio_net.c |   13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 62ba8aadd8e6..8c5b59e79439 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -407,18 +407,6 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 	return skb;
 }
 
-static void virtnet_xdp_flush(struct net_device *dev)
-{
-	struct virtnet_info *vi = netdev_priv(dev);
-	struct send_queue *sq;
-	unsigned int qp;
-
-	qp = vi->curr_queue_pairs - vi->xdp_queue_pairs + smp_processor_id();
-	sq = &vi->sq[qp];
-
-	virtqueue_kick(sq->vq);
-}
-
 static int __virtnet_xdp_xmit_one(struct virtnet_info *vi,
 				   struct send_queue *sq,
 				   struct xdp_frame *xdpf)
@@ -2359,7 +2347,6 @@ static const struct net_device_ops virtnet_netdev = {
 #endif
 	.ndo_bpf		= virtnet_xdp,
 	.ndo_xdp_xmit		= virtnet_xdp_xmit,
-	.ndo_xdp_flush		= virtnet_xdp_flush,
 	.ndo_features_check	= passthru_features_check,
 };
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bpf-next PATCH 4/5] tun: remove ndo_xdp_flush call tun_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
                   ` (2 preceding siblings ...)
  2018-06-05 11:55 ` [bpf-next PATCH 3/5] virtio_net: remove ndo_xdp_flush call virtnet_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 11:55 ` Jesper Dangaard Brouer
  2018-06-05 11:55 ` [bpf-next PATCH 5/5] net: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
  2018-06-05 12:38 ` [bpf-next PATCH 0/5] net/xdp: " Daniel Borkmann
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

Remove the ndo_xdp_flush call implementation tun_xdp_flush
as no callers of ndo_xdp_flush are left.

The tun drivers XDP_TX implementation also used tun_xdp_flush (and
tun_xdp_xmit).  This is easily solved by passing the XDP_XMIT_FLUSH
flag to tun_xdp_xmit in tun_xdp_tx.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/tun.c |   23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d82a05fb0594..ef09224496e8 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1347,26 +1347,7 @@ static int tun_xdp_tx(struct net_device *dev, struct xdp_buff *xdp)
 	if (unlikely(!frame))
 		return -EOVERFLOW;
 
-	return tun_xdp_xmit(dev, 1, &frame, 0);
-}
-
-static void tun_xdp_flush(struct net_device *dev)
-{
-	struct tun_struct *tun = netdev_priv(dev);
-	struct tun_file *tfile;
-	u32 numqueues;
-
-	rcu_read_lock();
-
-	numqueues = READ_ONCE(tun->numqueues);
-	if (!numqueues)
-		goto out;
-
-	tfile = rcu_dereference(tun->tfiles[smp_processor_id() %
-					    numqueues]);
-	__tun_xdp_flush_tfile(tfile);
-out:
-	rcu_read_unlock();
+	return tun_xdp_xmit(dev, 1, &frame, XDP_XMIT_FLUSH);
 }
 
 static const struct net_device_ops tap_netdev_ops = {
@@ -1387,7 +1368,6 @@ static const struct net_device_ops tap_netdev_ops = {
 	.ndo_get_stats64	= tun_net_get_stats64,
 	.ndo_bpf		= tun_xdp,
 	.ndo_xdp_xmit		= tun_xdp_xmit,
-	.ndo_xdp_flush		= tun_xdp_flush,
 };
 
 static void tun_flow_init(struct tun_struct *tun)
@@ -1706,7 +1686,6 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
 			alloc_frag->offset += buflen;
 			if (tun_xdp_tx(tun->dev, &xdp))
 				goto err_redirect;
-			tun_xdp_flush(tun->dev);
 			rcu_read_unlock();
 			preempt_enable();
 			return NULL;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bpf-next PATCH 5/5] net: remove net_device operation ndo_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
                   ` (3 preceding siblings ...)
  2018-06-05 11:55 ` [bpf-next PATCH 4/5] tun: remove ndo_xdp_flush call tun_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 11:55 ` Jesper Dangaard Brouer
  2018-06-05 12:38 ` [bpf-next PATCH 0/5] net/xdp: " Daniel Borkmann
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2018-06-05 11:55 UTC (permalink / raw)
  To: netdev, Daniel Borkmann, Alexei Starovoitov, Jesper Dangaard Brouer
  Cc: liu.song.a23, songliubraving, John Fastabend

All drivers are cleaned up and no references to ndo_xdp_flush
are left in drivers, it is time to remove the net_device_ops
operation ndo_xdp_flush.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 include/linux/netdevice.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7f17785a59d7..42c6ea35a6f2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1192,9 +1192,6 @@ struct dev_ifalias {
  *	that got dropped are freed/returned via xdp_return_frame().
  *	Returns negative number, means general error invoking ndo, meaning
  *	no frames were xmit'ed and core-caller will free all frames.
- * void (*ndo_xdp_flush)(struct net_device *dev);
- *	This function is used to inform the driver to flush a particular
- *	xdp tx queue. Must be called on same CPU as xdp_xmit.
  */
 struct net_device_ops {
 	int			(*ndo_init)(struct net_device *dev);
@@ -1382,7 +1379,6 @@ struct net_device_ops {
 	int			(*ndo_xdp_xmit)(struct net_device *dev, int n,
 						struct xdp_frame **xdp,
 						u32 flags);
-	void			(*ndo_xdp_flush)(struct net_device *dev);
 };
 
 /**

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush
  2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
                   ` (4 preceding siblings ...)
  2018-06-05 11:55 ` [bpf-next PATCH 5/5] net: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
@ 2018-06-05 12:38 ` Daniel Borkmann
  5 siblings, 0 replies; 7+ messages in thread
From: Daniel Borkmann @ 2018-06-05 12:38 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, netdev, Daniel Borkmann, Alexei Starovoitov
  Cc: liu.song.a23, songliubraving, John Fastabend

On 06/05/2018 01:55 PM, Jesper Dangaard Brouer wrote:
> This patchset removes the net_device operation ndo_xdp_flush() call.
> This is a follow merge commit ea9916ea3ed9 ("Merge branch
> 'ndo_xdp_xmit-cleanup'").  As after commit c1ece6b245bd ("bpf/xdp:
> devmap can avoid calling ndo_xdp_flush") no callers of ndo_xdp_flush
> are left in bpf-next tree.

Looks good, applied to bpf-next, thanks Jesper!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-05 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 11:55 [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
2018-06-05 11:55 ` [bpf-next PATCH 1/5] i40e: remove ndo_xdp_flush call i40e_xdp_flush Jesper Dangaard Brouer
2018-06-05 11:55 ` [bpf-next PATCH 2/5] ixgbe: remove ndo_xdp_flush call ixgbe_xdp_flush Jesper Dangaard Brouer
2018-06-05 11:55 ` [bpf-next PATCH 3/5] virtio_net: remove ndo_xdp_flush call virtnet_xdp_flush Jesper Dangaard Brouer
2018-06-05 11:55 ` [bpf-next PATCH 4/5] tun: remove ndo_xdp_flush call tun_xdp_flush Jesper Dangaard Brouer
2018-06-05 11:55 ` [bpf-next PATCH 5/5] net: remove net_device operation ndo_xdp_flush Jesper Dangaard Brouer
2018-06-05 12:38 ` [bpf-next PATCH 0/5] net/xdp: " Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).