Skip to content

Commit 4953841

Browse files
committed
Merge: igb: Driver Update
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7007 12906ba igbvf: Remove two unused declarations f40b0ac igb: Fix 2 typos in comments in igb_main.c 4d26b6e igbvf: remove unused spinlock f70b864 igb: Remove static qualifiers 6dc75fc igb: Introduce igb_xdp_is_enabled() 80f6ccf igb: Introduce XSK data structures and helpers 0fe7cce igb: Add XDP finalize and stats update functions 2c61960 igb: Add AF_XDP zero-copy Rx support f8e284a igb: Add AF_XDP zero-copy Tx support 8ae9466 igb: Fix passing 0 to ERR_PTR in igb_run_xdp() 5eada2a igb: reject invalid external timestamp requests for 82580-based HW 8fa7292 treewide: Switch/rename to timer_delete[_sync]() 6fc54c4 igb: Link IRQs to NAPI instances b75a1de igb: Link queues to NAPI instances fc0fb1f igb: Add support for persistent NAPI config a22ed15 igb: Get rid of spurious interrupts Late addition 2025-07-28: 3b7c13d igb: xsk: solve negative overflow of nb_pkts in zerocopy mode JIRA: https://issues.redhat.com/browse/RHEL-83574 Signed-off-by: Corinna Vinschen <[email protected]> Approved-by: Michal Schmidt <[email protected]> Approved-by: José Ignacio Tornos Martínez <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 6c4a30f + 88fc1f6 commit 4953841

File tree

8 files changed

+880
-123
lines changed

8 files changed

+880
-123
lines changed

drivers/net/ethernet/intel/igb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ obj-$(CONFIG_IGB) += igb.o
88

99
igb-y := igb_main.o igb_ethtool.o e1000_82575.o \
1010
e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \
11-
e1000_i210.o igb_ptp.o igb_hwmon.o
11+
e1000_i210.o igb_ptp.o igb_hwmon.o igb_xsk.o

drivers/net/ethernet/intel/igb/igb.h

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
#include <linux/i2c-algo-bit.h>
1919
#include <linux/pci.h>
2020
#include <linux/mdio.h>
21+
#include <linux/lockdep.h>
2122

2223
#include <net/xdp.h>
24+
#include <net/xdp_sock_drv.h>
2325

2426
struct igb_adapter;
2527

@@ -86,6 +88,7 @@ struct igb_adapter;
8688
#define IGB_XDP_CONSUMED BIT(0)
8789
#define IGB_XDP_TX BIT(1)
8890
#define IGB_XDP_REDIR BIT(2)
91+
#define IGB_XDP_EXIT BIT(3)
8992

9093
struct vf_data_storage {
9194
unsigned char vf_mac_addresses[ETH_ALEN];
@@ -255,6 +258,7 @@ enum igb_tx_flags {
255258
enum igb_tx_buf_type {
256259
IGB_TYPE_SKB = 0,
257260
IGB_TYPE_XDP,
261+
IGB_TYPE_XSK
258262
};
259263

260264
/* wrapper around a pointer to a socket buffer,
@@ -320,6 +324,7 @@ struct igb_ring {
320324
union { /* array of buffer info structs */
321325
struct igb_tx_buffer *tx_buffer_info;
322326
struct igb_rx_buffer *rx_buffer_info;
327+
struct xdp_buff **rx_buffer_info_zc;
323328
};
324329
void *desc; /* descriptor ring memory */
325330
unsigned long flags; /* ring specific flags */
@@ -357,6 +362,7 @@ struct igb_ring {
357362
};
358363
};
359364
struct xdp_rxq_info xdp_rxq;
365+
struct xsk_buff_pool *xsk_pool;
360366
} ____cacheline_internodealigned_in_smp;
361367

362368
struct igb_q_vector {
@@ -384,7 +390,9 @@ enum e1000_ring_flags_t {
384390
IGB_RING_FLAG_RX_SCTP_CSUM,
385391
IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
386392
IGB_RING_FLAG_TX_CTX_IDX,
387-
IGB_RING_FLAG_TX_DETECT_HANG
393+
IGB_RING_FLAG_TX_DETECT_HANG,
394+
IGB_RING_FLAG_TX_DISABLED,
395+
IGB_RING_FLAG_RX_ALLOC_FAILED,
388396
};
389397

390398
#define ring_uses_large_buffer(ring) \
@@ -715,6 +723,8 @@ enum igb_boards {
715723

716724
extern char igb_driver_name[];
717725

726+
void igb_set_queue_napi(struct igb_adapter *adapter, int q_idx,
727+
struct napi_struct *napi);
718728
int igb_xmit_xdp_ring(struct igb_adapter *adapter,
719729
struct igb_ring *ring,
720730
struct xdp_frame *xdpf);
@@ -731,12 +741,21 @@ int igb_setup_tx_resources(struct igb_ring *);
731741
int igb_setup_rx_resources(struct igb_ring *);
732742
void igb_free_tx_resources(struct igb_ring *);
733743
void igb_free_rx_resources(struct igb_ring *);
744+
void igb_clean_tx_ring(struct igb_ring *tx_ring);
745+
void igb_clean_rx_ring(struct igb_ring *rx_ring);
734746
void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
735747
void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
748+
void igb_finalize_xdp(struct igb_adapter *adapter, unsigned int status);
749+
void igb_update_rx_stats(struct igb_q_vector *q_vector, unsigned int packets,
750+
unsigned int bytes);
736751
void igb_setup_tctl(struct igb_adapter *);
737752
void igb_setup_rctl(struct igb_adapter *);
738753
void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
739754
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
755+
int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp);
756+
void igb_process_skb_fields(struct igb_ring *rx_ring,
757+
union e1000_adv_rx_desc *rx_desc,
758+
struct sk_buff *skb);
740759
void igb_alloc_rx_buffers(struct igb_ring *, u16);
741760
void igb_update_stats(struct igb_adapter *);
742761
bool igb_has_link(struct igb_adapter *adapter);
@@ -797,6 +816,33 @@ static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
797816
return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
798817
}
799818

819+
/* This function assumes __netif_tx_lock is held by the caller. */
820+
static inline void igb_xdp_ring_update_tail(struct igb_ring *ring)
821+
{
822+
lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
823+
824+
/* Force memory writes to complete before letting h/w know there
825+
* are new descriptors to fetch.
826+
*/
827+
wmb();
828+
writel(ring->next_to_use, ring->tail);
829+
}
830+
831+
static inline struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
832+
{
833+
unsigned int r_idx = smp_processor_id();
834+
835+
if (r_idx >= adapter->num_tx_queues)
836+
r_idx = r_idx % adapter->num_tx_queues;
837+
838+
return adapter->tx_ring[r_idx];
839+
}
840+
841+
static inline bool igb_xdp_is_enabled(struct igb_adapter *adapter)
842+
{
843+
return !!READ_ONCE(adapter->xdp_prog);
844+
}
845+
800846
int igb_add_filter(struct igb_adapter *adapter,
801847
struct igb_nfc_filter *input);
802848
int igb_erase_filter(struct igb_adapter *adapter,
@@ -807,4 +853,17 @@ int igb_add_mac_steering_filter(struct igb_adapter *adapter,
807853
int igb_del_mac_steering_filter(struct igb_adapter *adapter,
808854
const u8 *addr, u8 queue, u8 flags);
809855

856+
struct xsk_buff_pool *igb_xsk_pool(struct igb_adapter *adapter,
857+
struct igb_ring *ring);
858+
int igb_xsk_pool_setup(struct igb_adapter *adapter,
859+
struct xsk_buff_pool *pool,
860+
u16 qid);
861+
bool igb_alloc_rx_buffers_zc(struct igb_ring *rx_ring,
862+
struct xsk_buff_pool *xsk_pool, u16 count);
863+
void igb_clean_rx_ring_zc(struct igb_ring *rx_ring);
864+
int igb_clean_rx_irq_zc(struct igb_q_vector *q_vector,
865+
struct xsk_buff_pool *xsk_pool, const int budget);
866+
bool igb_xmit_zc(struct igb_ring *tx_ring, struct xsk_buff_pool *xsk_pool);
867+
int igb_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags);
868+
810869
#endif /* _IGB_H_ */

0 commit comments

Comments
 (0)