Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8038771
libeth, libie: clean symbol exports up a little
alobakin Jun 10, 2025
3c1c8bc
libeth: convert to netmem
alobakin Nov 25, 2024
96195ea
libeth: support native XDP and register memory model
alobakin Dec 8, 2023
13133da
libeth: xdp: add XDP_TX buffers sending
alobakin Apr 1, 2025
5a83c6c
libeth: xdp: add .ndo_xdp_xmit() helpers
alobakin Apr 2, 2025
84212e6
libeth: xdp: add XDPSQE completion helpers
alobakin Apr 2, 2025
f472bec
libeth: xdp: add XDPSQ locking helpers
alobakin Apr 3, 2025
d3ed243
libeth: xdp: add XDPSQ cleanup timers
alobakin Apr 3, 2025
837f7a6
libeth: xdp: add helpers for preparing/processing &libeth_xdp_buff
alobakin Apr 3, 2025
4e5c452
libeth: xdp: add XDP prog run and verdict result handling
alobakin Apr 3, 2025
3c2d9a0
libeth: xdp: add templates for building driver-side callbacks
alobakin Apr 3, 2025
e0c3c40
libeth: xdp: add RSS hash hint and XDP features setup helpers
alobakin Apr 3, 2025
733876d
libeth: xsk: add XSk XDP_TX sending helpers
alobakin Apr 3, 2025
3b28c00
libeth: xsk: add XSk xmit functions
alobakin Apr 3, 2025
31d4595
libeth: xsk: add XSk Rx processing support
alobakin Apr 3, 2025
696c22e
libeth: xsk: add XSkFQ refill and XSk wakeup helpers
alobakin Apr 3, 2025
aed74a5
libeth: xdp, xsk: access adjacent u32s as u64 where applicable
alobakin Apr 3, 2025
da319d0
idpf: fix Rx descriptor ready check barrier in splitq
alobakin Mar 5, 2025
9a95b85
idpf: use a saner limit for default number of queues to allocate
alobakin Feb 13, 2025
2ffa9b0
idpf: link NAPIs to queues
alobakin Jan 9, 2025
ef286d4
idpf: add 4-byte completion descriptor definition
michalQb Oct 20, 2023
63ea7c7
idpf: remove SW marker handling from NAPI
michalQb Feb 23, 2024
d9645ea
idpf: add support for nointerrupt queues
alobakin Mar 4, 2025
5500d4c
idpf: prepare structures to support XDP
michalQb Oct 3, 2023
3074d4f
idpf: implement XDP_SETUP_PROG in ndo_bpf for splitq
michalQb Oct 4, 2023
eb6a00b
idpf: use generic functions to build xdp_buff and skb
alobakin Dec 6, 2023
b138090
idpf: add support for XDP on Rx
alobakin Dec 12, 2023
e5f94ba
idpf: add support for .ndo_xdp_xmit()
alobakin Oct 30, 2023
fac0b9b
idpf: add XDP RSS hash hint
alobakin Mar 8, 2024
9b5bd47
idpf: add virtchnl functions to manage selected queues
michalQb Nov 17, 2023
4659b46
idpf: add XSk pool initialization
michalQb Nov 27, 2023
db56e0a
idpf: implement XSk xmit
alobakin Dec 7, 2023
46ff58e
idpf: implement Rx path for AF_XDP
alobakin Dec 12, 2023
beb4343
idpf: enable XSk features and ndo_xsk_wakeup
alobakin Dec 6, 2023
c3d6ddc
idpf: properly handle XDP program unloading during system reboot
michalQb Jun 12, 2025
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
14 changes: 8 additions & 6 deletions drivers/net/ethernet/intel/iavf/iavf_txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static void iavf_clean_rx_ring(struct iavf_ring *rx_ring)
for (u32 i = rx_ring->next_to_clean; i != rx_ring->next_to_use; ) {
const struct libeth_fqe *rx_fqes = &rx_ring->rx_fqes[i];

page_pool_put_full_page(rx_ring->pp, rx_fqes->page, false);
libeth_rx_recycle_slow(rx_fqes->netmem);

if (unlikely(++i == rx_ring->count))
i = 0;
Expand Down Expand Up @@ -1197,10 +1197,11 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
const struct libeth_fqe *rx_buffer,
unsigned int size)
{
u32 hr = rx_buffer->page->pp->p.offset;
u32 hr = netmem_get_pp(rx_buffer->netmem)->p.offset;

skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_buffer->page,
rx_buffer->offset + hr, size, rx_buffer->truesize);
skb_add_rx_frag_netmem(skb, skb_shinfo(skb)->nr_frags,
rx_buffer->netmem, rx_buffer->offset + hr,
size, rx_buffer->truesize);
}

/**
Expand All @@ -1214,12 +1215,13 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
static struct sk_buff *iavf_build_skb(const struct libeth_fqe *rx_buffer,
unsigned int size)
{
u32 hr = rx_buffer->page->pp->p.offset;
struct page *buf_page = __netmem_to_page(rx_buffer->netmem);
u32 hr = buf_page->pp->p.offset;
struct sk_buff *skb;
void *va;

/* prefetch first cache line of first page */
va = page_address(rx_buffer->page) + rx_buffer->offset;
va = page_address(buf_page) + rx_buffer->offset;
net_prefetch(va + hr);

/* build an skb around the page buffer */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/idpf/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ config IDPF
depends on PCI_MSI
depends on PTP_1588_CLOCK_OPTIONAL
select DIMLIB
select LIBETH
select LIBETH_XDP
help
This driver supports Intel(R) Infrastructure Data Path Function
devices.
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/intel/idpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ idpf-$(CONFIG_IDPF_SINGLEQ) += idpf_singleq_txrx.o

idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_ptp.o
idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_virtchnl_ptp.o

idpf-y += xdp.o
idpf-y += xsk.o
38 changes: 32 additions & 6 deletions drivers/net/ethernet/intel/idpf/idpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct idpf_vport_max_q;
#define IDPF_NUM_CHUNKS_PER_MSG(struct_sz, chunk_sz) \
((IDPF_CTLQ_MAX_BUF_LEN - (struct_sz)) / (chunk_sz))

#define IDPF_WAIT_FOR_MARKER_TIMEO 500
#define IDPF_MAX_WAIT 500

/* available message levels */
Expand Down Expand Up @@ -228,13 +229,10 @@ enum idpf_vport_reset_cause {
/**
* enum idpf_vport_flags - Vport flags
* @IDPF_VPORT_DEL_QUEUES: To send delete queues message
* @IDPF_VPORT_SW_MARKER: Indicate TX pipe drain software marker packets
* processing is done
* @IDPF_VPORT_FLAGS_NBITS: Must be last
*/
enum idpf_vport_flags {
IDPF_VPORT_DEL_QUEUES,
IDPF_VPORT_SW_MARKER,
IDPF_VPORT_FLAGS_NBITS,
};

Expand Down Expand Up @@ -263,6 +261,10 @@ struct idpf_port_stats {
* @txq_model: Split queue or single queue queuing model
* @txqs: Used only in hotpath to get to the right queue very fast
* @crc_enable: Enable CRC insertion offload
* @xdpq_share: whether XDPSQ sharing is enabled
* @num_xdp_txq: number of XDPSQs
* @xdp_txq_offset: index of the first XDPSQ (== number of regular SQs)
* @xdp_prog: installed XDP program
* @num_rxq: Number of allocated RX queues
* @num_bufq: Number of allocated buffer queues
* @rxq_desc_count: RX queue descriptor count. *MUST* have enough descriptors
Expand All @@ -287,13 +289,15 @@ struct idpf_port_stats {
* @num_q_vectors: Number of IRQ vectors allocated
* @q_vectors: Array of queue vectors
* @q_vector_idxs: Starting index of queue vectors
* @noirq_dyn_ctl: register to enable/disable the vector for NOIRQ queues
* @noirq_dyn_ctl_ena: value to write to the above to enable it
* @noirq_v_idx: ID of the NOIRQ vector
* @max_mtu: device given max possible MTU
* @default_mac_addr: device will give a default MAC to use
* @rx_itr_profile: RX profiles for Dynamic Interrupt Moderation
* @tx_itr_profile: TX profiles for Dynamic Interrupt Moderation
* @port_stats: per port csum, header split, and other offload stats
* @link_up: True if link is up
* @sw_marker_wq: workqueue for marker packets
* @tx_tstamp_caps: Capabilities negotiated for Tx timestamping
* @tstamp_config: The Tx tstamp config
* @tstamp_task: Tx timestamping task
Expand All @@ -310,6 +314,11 @@ struct idpf_vport {
struct idpf_tx_queue **txqs;
bool crc_enable;

bool xdpq_share;
u16 num_xdp_txq;
u16 xdp_txq_offset;
struct bpf_prog *xdp_prog;

u16 num_rxq;
u16 num_bufq;
u32 rxq_desc_count;
Expand All @@ -332,6 +341,11 @@ struct idpf_vport {
u16 num_q_vectors;
struct idpf_q_vector *q_vectors;
u16 *q_vector_idxs;

void __iomem *noirq_dyn_ctl;
u32 noirq_dyn_ctl_ena;
u16 noirq_v_idx;

u16 max_mtu;
u8 default_mac_addr[ETH_ALEN];
u16 rx_itr_profile[IDPF_DIM_PROFILE_SLOTS];
Expand All @@ -340,8 +354,6 @@ struct idpf_vport {

bool link_up;

wait_queue_head_t sw_marker_wq;

struct idpf_ptp_vport_tx_tstamp_caps *tx_tstamp_caps;
struct kernel_hwtstamp_config tstamp_config;
struct work_struct tstamp_task;
Expand Down Expand Up @@ -388,6 +400,7 @@ struct idpf_rss_data {
* ethtool
* @num_req_rxq_desc: Number of user requested RX queue descriptors through
* ethtool
* @xdp_prog: requested XDP program to install
* @user_flags: User toggled config flags
* @mac_filter_list: List of MAC filters
*
Expand All @@ -399,6 +412,7 @@ struct idpf_vport_user_config_data {
u16 num_req_rx_qs;
u32 num_req_txq_desc;
u32 num_req_rxq_desc;
struct bpf_prog *xdp_prog;
DECLARE_BITMAP(user_flags, __IDPF_USER_FLAGS_NBITS);
struct list_head mac_filter_list;
};
Expand Down Expand Up @@ -622,6 +636,11 @@ static inline int idpf_is_queue_model_split(u16 q_model)
q_model == VIRTCHNL2_QUEUE_MODEL_SPLIT;
}

static inline bool idpf_xdp_enabled(const struct idpf_vport *vport)
{
return vport->adapter && vport->xdp_prog;
}

#define idpf_is_cap_ena(adapter, field, flag) \
idpf_is_capability_ena(adapter, false, field, flag)
#define idpf_is_cap_ena_all(adapter, field, flag) \
Expand Down Expand Up @@ -830,6 +849,13 @@ static inline void idpf_vport_ctrl_unlock(struct net_device *netdev)
mutex_unlock(&np->adapter->vport_ctrl_lock);
}

static inline bool idpf_vport_ctrl_is_locked(struct net_device *netdev)
{
struct idpf_netdev_priv *np = netdev_priv(netdev);

return mutex_is_locked(&np->adapter->vport_ctrl_lock);
}

void idpf_statistics_task(struct work_struct *work);
void idpf_init_task(struct work_struct *work);
void idpf_service_task(struct work_struct *work);
Expand Down
11 changes: 10 additions & 1 deletion drivers/net/ethernet/intel/idpf/idpf_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int idpf_intr_reg_init(struct idpf_vport *vport)
int num_vecs = vport->num_q_vectors;
struct idpf_vec_regs *reg_vals;
int num_regs, i, err = 0;
u32 rx_itr, tx_itr;
u32 rx_itr, tx_itr, val;
u16 total_vecs;

total_vecs = idpf_get_reserved_vecs(vport->adapter);
Expand Down Expand Up @@ -118,6 +118,15 @@ static int idpf_intr_reg_init(struct idpf_vport *vport)
intr->tx_itr = idpf_get_reg_addr(adapter, tx_itr);
}

/* Data vector for NOIRQ queues */

val = reg_vals[vport->q_vector_idxs[i] - IDPF_MBX_Q_VEC].dyn_ctl_reg;
vport->noirq_dyn_ctl = idpf_get_reg_addr(adapter, val);

val = PF_GLINT_DYN_CTL_WB_ON_ITR_M | PF_GLINT_DYN_CTL_INTENA_MSK_M |
FIELD_PREP(PF_GLINT_DYN_CTL_ITR_INDX_M, IDPF_NO_ITR_UPDATE_IDX);
vport->noirq_dyn_ctl_ena = val;

free_reg_vals:
kfree(reg_vals);

Expand Down
14 changes: 8 additions & 6 deletions drivers/net/ethernet/intel/idpf/idpf_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ static void idpf_get_channels(struct net_device *netdev,
{
struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_vport_config *vport_config;
const struct idpf_vport *vport;
u16 num_txq, num_rxq;
u16 combined;

vport = idpf_netdev_to_vport(netdev);
vport_config = np->adapter->vport_config[np->vport_idx];

num_txq = vport_config->user_config.num_req_tx_qs;
Expand All @@ -203,8 +205,8 @@ static void idpf_get_channels(struct net_device *netdev,
ch->max_rx = vport_config->max_q.max_rxq;
ch->max_tx = vport_config->max_q.max_txq;

ch->max_other = IDPF_MAX_MBXQ;
ch->other_count = IDPF_MAX_MBXQ;
ch->max_other = IDPF_MAX_MBXQ + vport->num_xdp_txq;
ch->other_count = IDPF_MAX_MBXQ + vport->num_xdp_txq;

ch->combined_count = combined;
ch->rx_count = num_rxq - combined;
Expand Down Expand Up @@ -958,8 +960,8 @@ static void idpf_get_ethtool_stats(struct net_device *netdev,
*
* returns pointer to rx vector
*/
static struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport,
int q_num)
struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport,
u32 q_num)
{
int q_grp, q_idx;

Expand All @@ -979,8 +981,8 @@ static struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport,
*
* returns pointer to tx vector
*/
static struct idpf_q_vector *idpf_find_txq_vec(const struct idpf_vport *vport,
int q_num)
struct idpf_q_vector *idpf_find_txq_vec(const struct idpf_vport *vport,
u32 q_num)
{
int q_grp;

Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,17 @@ struct idpf_base_tx_desc {
__le64 qw1; /* type_cmd_offset_bsz_l2tag1 */
}; /* read used with buffer queues */

struct idpf_splitq_tx_compl_desc {
struct idpf_splitq_4b_tx_compl_desc {
/* qid=[10:0] comptype=[13:11] rsvd=[14] gen=[15] */
__le16 qid_comptype_gen;
union {
__le16 q_head; /* Queue head */
__le16 compl_tag; /* Completion tag */
} q_head_compl_tag;
}; /* writeback used with completion queues */

struct idpf_splitq_tx_compl_desc {
struct idpf_splitq_4b_tx_compl_desc common;
u8 ts[3];
u8 rsvd; /* Reserved */
}; /* writeback used with completion queues */
Expand Down
Loading