Commit 8c964397 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'add-XDP-support-to-xen-netfront'



Denis Kirjanov says:

====================
xen networking: add XDP support to xen-netfront

The first patch adds a new extra type to enable proper synchronization
between an RX request/response pair.
The second patch implements BFP interface for xen-netfront.
The third patch enables extra space for XDP processing.

v14:
- fixed compilation warnings

v13:
- fixed compilation due to previous rename

v12:
- xen-netback: rename netfront_xdp_headroom to xdp_headroom

v11:
- add the new headroom constant to netif.h
- xenbus_scanf check
- lock a bulk of puckets in xennet_xdp_xmit()

v10:
- add a new xen_netif_extra_info type to enable proper synchronization
 between an RX request/response pair.
- order local variable declarations

v9:
- assign an xdp program before switching to Reconfiguring
- minor cleanups
- address checkpatch issues

v8:
- add PAGE_POOL config dependency
- keep the state of XDP processing in netfront_xdp_enabled
- fixed allocator type in xdp_rxq_info_reg_mem_model()
- minor cleanups in xen-netback

v7:
- use page_pool_dev_alloc_pages() on page allocation
- remove the leftover break statement from netback_changed

v6:
- added the missing SOB line
- fixed subject

v5:
- split netfront/netback changes
- added a sync point between backend/frontend on switching to XDP
- added pagepool API

v4:
- added verbose patch descriprion
- don't expose the XDP headroom offset to the domU guest
- add a modparam to netback to toggle XDP offset
- don't process jumbo frames for now

v3:
- added XDP_TX support (tested with xdping echoserver)
- added XDP_REDIRECT support (tested with modified xdp_redirect_kern)
- moved xdp negotiation to xen-netback

v2:
- avoid data copying while passing to XDP
- tell xen-netback that we need the headroom space
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6d79dc67 1c9535c7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -495,6 +495,7 @@ config XEN_NETDEV_FRONTEND
	tristate "Xen network device frontend driver"
	depends on XEN
	select XEN_XENBUS_FRONTEND
	select PAGE_POOL
	default y
	help
	  This driver provides support for Xen paravirtual network
+4 −0
Original line number Diff line number Diff line
@@ -281,6 +281,9 @@ struct xenvif {
	u8 ipv6_csum:1;
	u8 multicast_control:1;

	/* headroom requested by xen-netfront */
	u16 xdp_headroom;

	/* Is this interface disabled? True when backend discovers
	 * frontend is rogue.
	 */
@@ -395,6 +398,7 @@ static inline pending_ring_idx_t nr_pending_reqs(struct xenvif_queue *queue)
irqreturn_t xenvif_interrupt(int irq, void *dev_id);

extern bool separate_tx_rx_irq;
extern bool provides_xdp_headroom;

extern unsigned int rx_drain_timeout_msecs;
extern unsigned int rx_stall_timeout_msecs;
+2 −0
Original line number Diff line number Diff line
@@ -483,6 +483,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
	vif->queues = NULL;
	vif->num_queues = 0;

	vif->xdp_headroom = 0;

	spin_lock_init(&vif->lock);
	INIT_LIST_HEAD(&vif->fe_mcast_addr);

+7 −0
Original line number Diff line number Diff line
@@ -96,6 +96,13 @@ unsigned int xenvif_hash_cache_size = XENVIF_HASH_CACHE_SIZE_DEFAULT;
module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, 0644);
MODULE_PARM_DESC(hash_cache_size, "Number of flows in the hash cache");

/* The module parameter tells that we have to put data
 * for xen-netfront with the XDP_PACKET_HEADROOM offset
 * needed for XDP processing
 */
bool provides_xdp_headroom = true;
module_param(provides_xdp_headroom, bool, 0644);

static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
			       u8 status);

+14 −1
Original line number Diff line number Diff line
@@ -258,6 +258,19 @@ static void xenvif_rx_next_skb(struct xenvif_queue *queue,
		pkt->extra_count++;
	}

	if (queue->vif->xdp_headroom) {
		struct xen_netif_extra_info *extra;

		extra = &pkt->extras[XEN_NETIF_EXTRA_TYPE_XDP - 1];

		memset(extra, 0, sizeof(struct xen_netif_extra_info));
		extra->u.xdp.headroom = queue->vif->xdp_headroom;
		extra->type = XEN_NETIF_EXTRA_TYPE_XDP;
		extra->flags = 0;

		pkt->extra_count++;
	}

	if (skb->sw_hash) {
		struct xen_netif_extra_info *extra;

@@ -356,7 +369,7 @@ static void xenvif_rx_data_slot(struct xenvif_queue *queue,
				struct xen_netif_rx_request *req,
				struct xen_netif_rx_response *rsp)
{
	unsigned int offset = 0;
	unsigned int offset = queue->vif->xdp_headroom;
	unsigned int flags;

	do {
Loading