Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e1175ce
ixgbevf: do not share pages between packets
walking-machine Jun 24, 2025
db3a8a3
ixgbevf: use libeth in Rx processing
walking-machine Jul 9, 2025
b77a4e6
ixgbevf: support XDP multi-buffer on Rx path
walking-machine Sep 2, 2025
c0b1547
ixgbevf: XDP_TX in multi-buffer through libeth
walking-machine Sep 9, 2025
e6d7803
ixgbevf: support XDP_REDIRECT and .ndo_xdp_xmit
walking-machine Sep 22, 2025
8ef9f69
ixgbevf: add pseudo header split
nwochtma Sep 19, 2025
37da135
ixgbevf: reconfigure page pool when reallocating buffers
walking-machine Nov 25, 2025
49cc75b
ixgbevf: allow changing MTU when XDP program is attached
walking-machine Jan 8, 2026
dff91d2
ixgbevf: move skb-filling code to a header
walking-machine Oct 24, 2025
2a6c738
ixgbevf: implement AF_XDP ZC initialization
walking-machine Oct 27, 2025
d822ced
ixgbevf: implement AF_XDP zero-copy Tx
walking-machine Oct 27, 2025
dbf79e1
ixgbevf: implement AF_XDP zero-copy Rx
walking-machine Oct 27, 2025
9ee2c99
ixgbevf: implement .ndo_xsk_wakeup() and set features
walking-machine Oct 27, 2025
0a7a647
ixgbevf: multi-buffer AF_XDP Tx
walking-machine Dec 19, 2025
dae76de
ixgbe: remove legacy rx
Magda-Pytel Apr 13, 2026
42f9bf5
ixgbe: do not share pages between packets
Magda-Pytel May 7, 2026
31040ff
ixgbe: use libeth in Rx processing
Magda-Pytel May 7, 2026
aab8eaf
ixgbe: branch prediction and cleanup
Magda-Pytel May 28, 2026
f0e1ead
ixgbe: support XDP multi-buffer on Rx path
Magda-Pytel Jun 1, 2026
1945472
ixgbe: XDP_TX in multi-buffer through libeth
Magda-Pytel Jun 1, 2026
cd493b9
ixgbe: support XDP_REDIRECT and .ndo_xdp_xmit through libeth
Magda-Pytel Jun 1, 2026
0fce674
ixgbe: add pseudo header split
Magda-Pytel Jun 1, 2026
6955c5e
ixgbe: reconfigure page pool when reallocating buffers
Magda-Pytel Jun 1, 2026
bdd2d85
ixgbe: allow changing MTU when XDP program is attached
Magda-Pytel Jun 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ config IXGBE
tristate "Intel(R) 10GbE PCI Express adapters support"
depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select LIBETH_XDP
select LIBIE_FWLOG if DEBUG_FS
select MDIO
select NET_DEVLINK
Expand Down Expand Up @@ -203,6 +204,7 @@ config IXGBE_IPSEC
config IXGBEVF
tristate "Intel(R) 10GbE PCI Express Virtual Function Ethernet support"
depends on PCI_MSI
select LIBETH_XDP
help
This driver supports Intel(R) PCI Express virtual functions for the
Intel(R) ixgbe driver. For more information on how to identify your
Expand Down
166 changes: 38 additions & 128 deletions drivers/net/ethernet/intel/ixgbe/ixgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "ixgbe_ipsec.h"

#include <net/xdp.h>
#include <net/libeth/rx.h>
#include <net/libeth/types.h>

/* common prefix used by pr_<> macros */
#undef pr_fmt
Expand Down Expand Up @@ -69,74 +71,16 @@

/* Supported Rx Buffer Sizes */
#define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */
#define IXGBE_RXBUFFER_1536 1536
#define IXGBE_RXBUFFER_2K 2048
#define IXGBE_RXBUFFER_3K 3072
#define IXGBE_RXBUFFER_4K 4096
#define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */

#define IXGBE_PKT_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))

/* Attempt to maximize the headroom available for incoming frames. We
* use a 2K buffer for receives and need 1536/1534 to store the data for
* the frame. This leaves us with 512 bytes of room. From that we need
* to deduct the space needed for the shared info and the padding needed
* to IP align the frame.
*
* Note: For cache line sizes 256 or larger this value is going to end
* up negative. In these cases we should fall back to the 3K
* buffers.
*/
#if (PAGE_SIZE < 8192)
#define IXGBE_MAX_2K_FRAME_BUILD_SKB (IXGBE_RXBUFFER_1536 - NET_IP_ALIGN)
#define IXGBE_2K_TOO_SMALL_WITH_PADDING \
((NET_SKB_PAD + IXGBE_RXBUFFER_1536) > SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K))

static inline int ixgbe_compute_pad(int rx_buf_len)
{
int page_size, pad_size;

page_size = ALIGN(rx_buf_len, PAGE_SIZE / 2);
pad_size = SKB_WITH_OVERHEAD(page_size) - rx_buf_len;

return pad_size;
}

static inline int ixgbe_skb_pad(void)
{
int rx_buf_len;

/* If a 2K buffer cannot handle a standard Ethernet frame then
* optimize padding for a 3K buffer instead of a 1.5K buffer.
*
* For a 3K buffer we need to add enough padding to allow for
* tailroom due to NET_IP_ALIGN possibly shifting us out of
* cache-line alignment.
*/
if (IXGBE_2K_TOO_SMALL_WITH_PADDING)
rx_buf_len = IXGBE_RXBUFFER_3K + SKB_DATA_ALIGN(NET_IP_ALIGN);
else
rx_buf_len = IXGBE_RXBUFFER_1536;
#define IXGBE_RX_PAGE_LEN(hr) (ALIGN_DOWN(LIBETH_RX_PAGE_LEN(hr), \
IXGBE_SRRCTL_BSIZEPKT_STEP))
#define IXGBE_RX_SRRCTL_BUF_SIZE(mtu) (ALIGN((mtu) + LIBETH_RX_LL_LEN, \
IXGBE_SRRCTL_BSIZEPKT_STEP))

/* if needed make room for NET_IP_ALIGN */
rx_buf_len -= NET_IP_ALIGN;

return ixgbe_compute_pad(rx_buf_len);
}

#define IXGBE_SKB_PAD ixgbe_skb_pad()
#else
#define IXGBE_SKB_PAD (NET_SKB_PAD + NET_IP_ALIGN)
#endif

/*
* NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we
* reserve 64 more, and skb_shared_info adds an additional 320 bytes more,
* this adds up to 448 bytes of extra data.
*
* Since netdev_alloc_skb now allocates a page fragment we can use a value
* of 256 and the resultant skb will have a truesize of 960 or less.
*/
/* Default HW header buffer size */
#define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256

/* How many Rx Buffers do we bundle into one write to the hardware ? */
Expand Down Expand Up @@ -271,20 +215,9 @@ struct ixgbe_tx_buffer {
u32 tx_flags;
};

struct ixgbe_rx_buffer {
union {
struct {
struct sk_buff *skb;
dma_addr_t dma;
struct page *page;
__u32 page_offset;
__u16 pagecnt_bias;
};
struct {
bool discard;
struct xdp_buff *xdp;
};
};
struct ixgbe_xsk_rx_buffer {
bool discard;
struct xdp_buff *xdp;
};

struct ixgbe_queue_stats {
Expand All @@ -311,8 +244,6 @@ struct ixgbe_rx_queue_stats {
#define IXGBE_TS_HDR_LEN 8

enum ixgbe_ring_state_t {
__IXGBE_RX_3K_BUFFER,
__IXGBE_RX_BUILD_SKB_ENABLED,
__IXGBE_RX_RSC_ENABLED,
__IXGBE_RX_CSUM_UDP_ZERO_ERR,
__IXGBE_RX_FCOE,
Expand All @@ -321,12 +252,10 @@ enum ixgbe_ring_state_t {
__IXGBE_TX_DETECT_HANG,
__IXGBE_HANG_CHECK_ARMED,
__IXGBE_TX_XDP_RING,
__IXGBE_TX_XDP_RING_PRIMED,
__IXGBE_TX_DISABLED,
};

#define ring_uses_build_skb(ring) \
test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state)

struct ixgbe_fwd_adapter {
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
struct net_device *netdev;
Expand Down Expand Up @@ -357,12 +286,22 @@ struct ixgbe_ring {
struct ixgbe_ring *next; /* pointer to next ring in q_vector */
struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */
struct net_device *netdev; /* netdev ring belongs to */
struct bpf_prog *xdp_prog;
struct device *dev; /* device for DMA mapping */
struct bpf_prog __rcu *xdp_prog;
Comment thread
Magda-Pytel marked this conversation as resolved.
union {
struct page_pool *pp; /* Rx and XDP rings */
struct device *dev; /* Tx ring */
};
void *desc; /* descriptor ring memory */
union {
u32 truesize; /* Rx buffer full size */
u32 pending; /* Sent-not-completed descriptors */
};
u32 hdr_truesize; /* Rx header buffer full size */
union {
struct libeth_fqe *rx_fqes;
struct ixgbe_xsk_rx_buffer *rx_xsk_buffer_info;
struct ixgbe_tx_buffer *tx_buffer_info;
struct ixgbe_rx_buffer *rx_buffer_info;
struct libeth_sqe *xdp_sqes;
};
Comment thread
Magda-Pytel marked this conversation as resolved.
unsigned long state;
u8 __iomem *tail;
Expand All @@ -377,17 +316,14 @@ struct ixgbe_ring {
* associated with this ring, which is
* different for DCB and RSS modes
*/
u16 next_to_use;
u16 next_to_clean;
u32 next_to_use;

unsigned long last_rx_timestamp;

union {
u16 next_to_alloc;
struct {
u8 atr_sample_rate;
u8 atr_count;
};
struct {
u8 atr_sample_rate;
u8 atr_count;
};

u8 dcb_tc;
Expand All @@ -397,12 +333,17 @@ struct ixgbe_ring {
struct ixgbe_tx_queue_stats tx_stats;
struct ixgbe_rx_queue_stats rx_stats;
};
u16 rx_offset;
struct libeth_fqe *hdr_fqes;
struct page_pool *hdr_pp;
struct xdp_rxq_info xdp_rxq;
struct libeth_xdpsq_lock xdpq_lock;
u32 cached_ntu;
spinlock_t tx_lock; /* used in XDP mode */
struct xsk_buff_pool *xsk_pool;
u16 ring_idx; /* {rx,tx,xdp}_ring back reference idx */
u16 rx_buf_len;
u32 hdr_buf_len;
u32 rx_buf_len;
struct libeth_xdp_buff_stash xdp_stash;
} ____cacheline_internodealigned_in_smp;

enum ixgbe_ring_f_enum {
Expand Down Expand Up @@ -433,8 +374,6 @@ enum ixgbe_ring_f_enum {
#define IXGBE_MAX_TX_DESCRIPTORS 40
#define IXGBE_MAX_TX_VF_HANGS 4

DECLARE_STATIC_KEY_FALSE(ixgbe_xdp_locking_key);

struct ixgbe_ring_feature {
u16 limit; /* upper limit on feature indices */
u16 indices; /* current value of indices */
Expand All @@ -446,32 +385,6 @@ struct ixgbe_ring_feature {
#define IXGBE_82599_VMDQ_4Q_MASK 0x7C
#define IXGBE_82599_VMDQ_2Q_MASK 0x7E

/*
* FCoE requires that all Rx buffers be over 2200 bytes in length. Since
* this is twice the size of a half page we need to double the page order
* for FCoE enabled Rx queues.
*/
static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)
Comment thread
Magda-Pytel marked this conversation as resolved.
{
if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state))
return IXGBE_RXBUFFER_3K;
#if (PAGE_SIZE < 8192)
if (ring_uses_build_skb(ring))
return IXGBE_MAX_2K_FRAME_BUILD_SKB;
#endif
return IXGBE_RXBUFFER_2K;
}

static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
{
#if (PAGE_SIZE < 8192)
if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state))
return 1;
#endif
return 0;
}
#define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))

Comment thread
Magda-Pytel marked this conversation as resolved.
#define IXGBE_ITR_ADAPTIVE_MIN_INC 2
#define IXGBE_ITR_ADAPTIVE_MIN_USECS 10
#define IXGBE_ITR_ADAPTIVE_MAX_USECS 126
Expand Down Expand Up @@ -672,7 +585,7 @@ struct ixgbe_adapter {
#define IXGBE_FLAG2_VLAN_PROMISC BIT(13)
#define IXGBE_FLAG2_EEE_CAPABLE BIT(14)
#define IXGBE_FLAG2_EEE_ENABLED BIT(15)
#define IXGBE_FLAG2_RX_LEGACY BIT(16)
/* BIT16 used to be reserved for legacy RX flag */
#define IXGBE_FLAG2_IPSEC_ENABLED BIT(17)
#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18)
#define IXGBE_FLAG2_AUTO_DISABLE_VF BIT(19)
Expand All @@ -681,6 +594,7 @@ struct ixgbe_adapter {
#define IXGBE_FLAG2_MOD_POWER_UNSUPPORTED BIT(22)
#define IXGBE_FLAG2_API_MISMATCH BIT(23)
#define IXGBE_FLAG2_FW_ROLLBACK BIT(24)
#define IXGBE_FLAG2_HSPLIT BIT(25)

/* Tx fast path data */
int num_tx_queues;
Expand Down Expand Up @@ -859,10 +773,7 @@ static inline struct ixgbe_adapter *ixgbe_from_netdev(struct net_device *netdev)

static inline int ixgbe_determine_xdp_q_idx(int cpu)
{
if (static_key_enabled(&ixgbe_xdp_locking_key))
return cpu % IXGBE_MAX_XDP_QS;
else
return cpu;
return cpu % IXGBE_MAX_XDP_QS;
}

static inline
Expand Down Expand Up @@ -919,7 +830,6 @@ struct ixgbe_cb {
};
dma_addr_t dma;
u16 append_cnt;
bool page_released;
};
#define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb)

Expand Down
Loading