Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge XDP & AF_XDP implementation for IVAF with libie & page-pool #1

Open
wants to merge 49 commits into
base: iavf-xdp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0ae5ed5
iavf: Make request and free traffic irqs symmetric
michalQb Dec 6, 2022
f7080ff
iavf: Do not reset the number of requested queues
michalQb Dec 13, 2022
dd8d308
iavf: Limit number of channels in ethtool when XDP is enabled
walking-machine Jan 24, 2023
8bf20fb
iavf: Fix crash on RX resource reallocation
michalQb Feb 16, 2023
fc37e76
iavf: Fix regresssion for AF_XDP TX-only
michalQb Feb 20, 2023
e3de39c
iavf: remove next_rs/_dd logic - fixup to XDP_TX
walking-machine Feb 9, 2023
8cc9e80
iavf: remove next_rs/_dd logic - fixup to XDP_REDIRECT
walking-machine Feb 9, 2023
7edb54e
iavf: remove next_rs/_dd logic - fixup to AF_XDP-TX
walking-machine Feb 9, 2023
1e4d008
iavf: remove next_rs/_dd logic - fixup to AF_XDP-RX
walking-machine Feb 9, 2023
cd84919
iavf: remove incorrect XDP buffer free - fixup to iavf: Prepare rings…
walking-machine Feb 21, 2023
d7a6fe9
iavf: Refactor XDP resource cleaning - fixup to iavf: Prepare rings t…
walking-machine Feb 23, 2023
d47a6f7
iavf: call iavf_free_xdp_resource() instead of page_frag_free() - fix…
walking-machine Feb 23, 2023
53cd149
iavf: Remove IAVF_TX_FLAGS_FD_SB flag
walking-machine Feb 22, 2023
b120ea1
iavf: add iavf_xdp_buffer_type - fixup to XDP_REDIRECT
walking-machine Feb 22, 2023
d1ae554
iavf: Fix comment to iavf_xmit_xdp_buff() - fixup to XDP_TX
walking-machine Feb 23, 2023
4088fc5
iavf: Properly free XDP frame from other interface - fixup to XDP_RED…
walking-machine Feb 23, 2023
2bcd76c
iavf: fix infinite loop - fixup to iavf: Implement Tx path for AF_XDP
walking-machine Feb 23, 2023
61150e2
iavf: correctly free XDP_REDIRECTed frames in ZC mode - fixup to AF_X…
walking-machine Feb 23, 2023
39be2b1
iavf: proper XDP_TX in ZC mode - fixup to AF_XDP RX processing
walking-machine Feb 24, 2023
32c27ef
iavf: lock XDP queue while using in ZC mode
walking-machine Feb 24, 2023
8c16d29
iavf: Use separate ring masks for TX and RX in q_vector
michalQb Feb 15, 2023
15e89df
iavf: Use separate ring masks for TX and RX in q_vector (XDP-specific)
michalQb Feb 16, 2023
2578874
iavf: Do not compute the index of XDP ring
michalQb Mar 7, 2023
c7d2b53
iavf: Fix xsk_wakeup behavior on reset
michalQb Feb 23, 2023
b895628
iavf: Improve allocation of XDP rings
michalQb Feb 23, 2023
de3885a
iavf: Add function for polling the link notification
michalQb Mar 3, 2023
096d0ca
iavf: Refactor synchronous virtchnl functions
michalQb Mar 6, 2023
e032dc4
iavf: Refactor .ndo_bpf implementation
michalQb Mar 3, 2023
1c7bbdd
iavf: Use refactored VIRTCHNL functions in XSK
michalQb Mar 6, 2023
c3cd4d7
Fix comments - fixup to iavf: Prepare rings to support XDP
walking-machine Feb 27, 2023
1cc56e0
Fix comments - fixup to iavf: Implement AF_XDP RX processing
walking-machine Feb 27, 2023
cc541d8
Fix comments - fixup to iavf: Handle XDP_SETUP_PROG command in .ndo_bpf
walking-machine Feb 27, 2023
ccdabc1
Fix comments - fixup to iavf: Refactor ring initialization functions …
walking-machine Feb 27, 2023
5bd492a
Fix comments - fixup to iavf: Allow XDP TxQ sharing
walking-machine Feb 27, 2023
f2bad76
Fix comments - fixup to iavf: Add XDP_PASS and XDP_DROP support
walking-machine Feb 27, 2023
68ecf0e
Fix comments - fixup to iavf: Prepare VIRTCHNL functions to support XDP
walking-machine Feb 27, 2023
cef9ada
Fix comments - fixup to iavf: Handle XDP_SETUP_PROG command in .ndo_bpf
walking-machine Mar 8, 2023
dfca8dd
Fix kernel-doc warnings - fixup to iavf: Prepare VIRTCHNL functions t…
walking-machine Mar 8, 2023
959c836
Fix kernel-doc for iavf_alloc_xdp_queues - fixup to iavf: Prepare rin…
walking-machine Mar 8, 2023
d3bc9cc
Fix kernel-doc for iavf_xdp - fixup to iavf: Handle XDP_SETUP_PROG co…
walking-machine Mar 8, 2023
25e411c
iavf: Enable XDP netdev features
michalQb Mar 9, 2023
299a158
iavf: Enable AF_XDP zero-copy feature in netdev
michalQb Mar 9, 2023
f4d53c1
iavf: Perform manual merge of details
michalQb Mar 24, 2023
4594b63
Fix merging errors
michalQb Mar 28, 2023
9a240c0
Fix corner cases in driver initialization
michalQb Mar 30, 2023
99b98e6
Fix queues initialization for AF_XDP
michalQb Apr 11, 2023
4763bce
iavf: fixup for optimize vol. 2
alobakin Mar 23, 2023
cc3853b
Fix stats compilation errors in XSK
michalQb Apr 12, 2023
824f97c
Remove stats resetting. Add page_pool destroy.
michalQb Apr 13, 2023
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
52 changes: 29 additions & 23 deletions drivers/net/ethernet/intel/iavf/iavf.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ struct iavf_vsi {

#define MAXIMUM_ETHERNET_VLAN_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)

#define IAVF_RX_DESC(R, i) (&(((union iavf_32byte_rx_desc *)((R)->desc))[i]))
#define IAVF_TX_DESC(R, i) (&(((struct iavf_tx_desc *)((R)->desc))[i]))
#define IAVF_TX_CTXTDESC(R, i) \
(&(((struct iavf_tx_context_desc *)((R)->desc))[i]))
#define IAVF_MAX_REQ_QUEUES 16

#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)
Expand All @@ -112,7 +108,8 @@ struct iavf_q_vector {
struct napi_struct napi;
struct iavf_ring_container rx;
struct iavf_ring_container tx;
u32 ring_mask;
u32 rx_ring_mask;
u32 tx_ring_mask;
u8 itr_countdown; /* when 0 should adjust adaptive ITR */
u8 num_ringpairs; /* total number of ring pairs in vector */
u16 v_idx; /* index in the vsi->q_vector array. */
Expand Down Expand Up @@ -248,6 +245,8 @@ struct iavf_cloud_filter {
bool add; /* filter needs to be added */
};

#define IAVF_XDP_LINK_TIMEOUT_MS 1000

#define IAVF_RESET_WAIT_MS 10
#define IAVF_RESET_WAIT_DETECTED_COUNT 500
#define IAVF_RESET_WAIT_COMPLETE_COUNT 2000
Expand Down Expand Up @@ -524,12 +523,25 @@ static inline void iavf_change_state(struct iavf_adapter *adapter,
* @adapter: board private structure
*
* Returns true if XDP program is loaded on a given adapter.
**/
*/
static inline bool iavf_adapter_xdp_active(struct iavf_adapter *adapter)
{
return !!READ_ONCE(adapter->xdp_prog);
}

static inline struct xsk_buff_pool *iavf_xsk_pool(struct iavf_ring *ring)
{
struct iavf_adapter *adapter = ring->vsi->back;
struct iavf_vsi *vsi = ring->vsi;
u16 qid = ring->queue_index;

if (!iavf_adapter_xdp_active(adapter) ||
!test_bit(qid, adapter->af_xdp_zc_qps))
return NULL;

return xsk_get_pool_from_qid(vsi->netdev, qid);
}

int iavf_up(struct iavf_adapter *adapter);
void iavf_down(struct iavf_adapter *adapter);
int iavf_process_config(struct iavf_adapter *adapter);
Expand Down Expand Up @@ -557,22 +569,17 @@ int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter);
void iavf_set_queue_vlan_tag_loc(struct iavf_adapter *adapter);
u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter);
void iavf_irq_enable(struct iavf_adapter *adapter, bool flush);
void iavf_configure_selected_queues(struct iavf_adapter *adapter, u32 qp_mask);
void iavf_configure_queues(struct iavf_adapter *adapter);
int iavf_get_configure_queues_result(struct iavf_adapter *adapter,
unsigned int msecs);
int iavf_configure_selected_queues(struct iavf_adapter *adapter, u32 qp_mask,
bool wait);
int iavf_configure_queues(struct iavf_adapter *adapter, bool wait);
void iavf_deconfigure_queues(struct iavf_adapter *adapter);
void iavf_enable_queues(struct iavf_adapter *adapter);
void iavf_disable_queues(struct iavf_adapter *adapter);
void iavf_enable_selected_queues(struct iavf_adapter *adapter, u32 rx_queues,
u32 tx_queues);
void iavf_disable_selected_queues(struct iavf_adapter *adapter, u32 rx_queues,
u32 tx_queues);
int iavf_get_queue_enable_result(struct iavf_adapter *adapter, unsigned int msecs);
int iavf_get_queue_disable_result(struct iavf_adapter *adapter, unsigned int msecs);
void iavf_map_queues(struct iavf_adapter *adapter);
int iavf_get_map_queues_result(struct iavf_adapter *adapter,
unsigned int msecs);
int iavf_enable_queues(struct iavf_adapter *adapter, bool wait);
int iavf_disable_queues(struct iavf_adapter *adapter, bool wait);
int iavf_enable_selected_queues(struct iavf_adapter *adapter, u32 rx_queues,
u32 tx_queues, bool wait);
int iavf_disable_selected_queues(struct iavf_adapter *adapter, u32 rx_queues,
u32 tx_queues, bool wait);
int iavf_map_queues(struct iavf_adapter *adapter, bool wait);
int iavf_request_queues(struct iavf_adapter *adapter, int num);
void iavf_add_ether_addrs(struct iavf_adapter *adapter);
void iavf_del_ether_addrs(struct iavf_adapter *adapter);
Expand All @@ -585,10 +592,9 @@ void iavf_get_hena(struct iavf_adapter *adapter);
void iavf_set_hena(struct iavf_adapter *adapter);
void iavf_set_rss_key(struct iavf_adapter *adapter);
void iavf_set_rss_lut(struct iavf_adapter *adapter);
int iavf_get_setting_rss_lut_result(struct iavf_adapter *adapter,
unsigned int msecs);
void iavf_enable_vlan_stripping(struct iavf_adapter *adapter);
void iavf_disable_vlan_stripping(struct iavf_adapter *adapter);
int iavf_poll_for_link_status(struct iavf_adapter *adapter, unsigned int msecs);
void iavf_virtchnl_completion(struct iavf_adapter *adapter,
enum virtchnl_ops v_opcode,
enum iavf_status v_retval, u8 *msg, u16 msglen);
Expand Down
9 changes: 8 additions & 1 deletion drivers/net/ethernet/intel/iavf/iavf_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,7 @@ static int iavf_set_channels(struct net_device *netdev,
struct ethtool_channels *ch)
{
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 num_allowed = adapter->vsi_res->num_queue_pairs;
u32 num_req = ch->combined_count;
int i;

Expand All @@ -1656,9 +1657,15 @@ static int iavf_set_channels(struct net_device *netdev,
/* All of these should have already been checked by ethtool before this
* even gets to us, but just to be sure.
*/
if (num_req == 0 || num_req > adapter->vsi_res->num_queue_pairs)
if (num_req == 0 || num_req > num_allowed)
return -EINVAL;

if (iavf_adapter_xdp_active(adapter) && num_req * 2 > num_allowed) {
netdev_err(netdev, "XDP is enabled, so maximum allowed queue number is reduced to %u, %u queues where requested\n",
num_allowed / 2, num_allowed);
return -EINVAL;
}

if (num_req == adapter->num_active_queues)
return 0;

Expand Down
Loading