Enable Intel VF RSS
Subsystems (3)
cover Enable Intel VF RSS
Current Intel VF (iAVF) doesn't supoort RSS hash by ethtool, the users need to use the PF interface to configure the RSS hash.
For making the VF configure the RSS hash by itself, define new virtchnl messages, so that VF can query the PF support to do RSS hash by ethtool commands.
Haiyue Wang (4):
iavf: Add framework to enable ethtool RSS config
iavf: Support ethtool TCP flow RSS hash
iavf: Support ethtool UDP flow RSS hash
iavf: Support ethtool SCTP flow RSS hash
Qi Zhang (2):
ice: Enable RSS configure for AVF
ice: Support RSS configure removal for AVF
drivers/net/ethernet/intel/iavf/Makefile | 1 + drivers/net/ethernet/intel/iavf/iavf.h | 10 + .../net/ethernet/intel/iavf/iavf_adv_rss.c | 224 +++++++++ .../net/ethernet/intel/iavf/iavf_adv_rss.h | 96 ++++ .../net/ethernet/intel/iavf/iavf_ethtool.c | 253 +++++++++- drivers/net/ethernet/intel/iavf/iavf_main.c | 28 ++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 166 +++++++ drivers/net/ethernet/intel/ice/ice_flow.c | 88 ++++ drivers/net/ethernet/intel/ice/ice_flow.h | 6 + .../intel/ice/ice_virtchnl_allowlist.c | 6 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 465 ++++++++++++++++++ include/linux/avf/virtchnl.h | 25 +- 12 files changed, 1365 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_adv_rss.c create mode 100644 drivers/net/ethernet/intel/iavf/iavf_adv_rss.h
Signature · 1 line
2.31.1
PATCH 1/6 ice: Enable RSS configure for AVF
From: Qi Zhang <[email protected]>
Define new virtchnl message pair VIRTCHNL_OP_ADD/DEL_RSS_CFG for VF to configure the RSS hash input for supported protocol fields.
Define the capability flag VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF to query this new RSS offload support before sending the new virtchnl message.
--- drivers/net/ethernet/intel/ice/ice_flow.h | 3 + .../intel/ice/ice_virtchnl_allowlist.c | 6 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 453 ++++++++++++++++++ include/linux/avf/virtchnl.h | 25 +- 4 files changed, 486 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_flow.h +3 -0
@@ -8,6 +8,9 @@#define ICE_FLOW_FLD_OFF_INVAL 0xffff/* Generate flow hash field from flow field type(s) */ +#define ICE_FLOW_HASH_ETH \ + (BIT_ULL(ICE_FLOW_FIELD_IDX_ETH_DA) | \ + BIT_ULL(ICE_FLOW_FIELD_IDX_ETH_SA))#define ICE_FLOW_HASH_IPV4 \ (BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA) | \ BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA))
drivers/net/ethernet/intel/ice/ice_virtchnl_allowlist.c +6 -0
@@ -61,6 +61,11 @@ static const u32 rss_pf_allowlist_opcodes[] = { VIRTCHNL_OP_GET_RSS_HENA_CAPS, VIRTCHNL_OP_SET_RSS_HENA, }; +/* VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF */ +static const u32 adv_rss_pf_allowlist_opcodes[] = { +VIRTCHNL_OP_ADD_RSS_CFG ,VIRTCHNL_OP_DEL_RSS_CFG , +}; +/* VIRTCHNL_VF_OFFLOAD_FDIR_PF */ static const u32 fdir_pf_allowlist_opcodes[] = {VIRTCHNL_OP_ADD_FDIR_FILTER ,VIRTCHNL_OP_DEL_FDIR_FILTER ,
@@ -82,6 +87,7 @@ static const struct allowlist_opcode_info allowlist_opcodes[] = {ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_REQ_QUEUES , req_queues_allowlist_opcodes),ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_VLAN , vlan_allowlist_opcodes),ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_RSS_PF , rss_pf_allowlist_opcodes), +ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF , adv_rss_pf_allowlist_opcodes), ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_FDIR_PF, fdir_pf_allowlist_opcodes), };
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +453 -0
479 lines not on this page · raw message
include/linux/avf/virtchnl.h +24 -1
@@ -136,7 +136,9 @@ enum virtchnl_ops {VIRTCHNL_OP_DISABLE_CHANNELS =31 ,VIRTCHNL_OP_ADD_CLOUD_FILTER =32 ,VIRTCHNL_OP_DEL_CLOUD_FILTER =33 , -/* opcode 34 - 46 are reserved */ +/* opcode 34 - 44 are reserved */ +VIRTCHNL_OP_ADD_RSS_CFG =45 , +VIRTCHNL_OP_DEL_RSS_CFG =46 ,VIRTCHNL_OP_ADD_FDIR_FILTER =47 ,VIRTCHNL_OP_DEL_FDIR_FILTER =48 , VIRTCHNL_OP_MAX,
@@ -251,6 +253,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000#define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000 +#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF 0X08000000#define VIRTCHNL_VF_OFFLOAD_FDIR_PF 0X10000000#define VIRTCHNL_VF_OFFLOAD_USO 0X02000000
@@ -704,6 +707,14 @@ enum virtchnl_vfr_states { VIRTCHNL_VFR_VFACTIVE, }; +/* Type of RSS algorithm */ +enum virtchnl_rss_algorithm { +VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC =0 , +VIRTCHNL_RSS_ALG_R_ASYMMETRIC =1 , +VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC =2 , +VIRTCHNL_RSS_ALG_XOR_SYMMETRIC =3 , +}; +#define VIRTCHNL_MAX_NUM_PROTO_HDRS 32#define PROTO_HDR_SHIFT 5#define PROTO_HDR_FIELD_START (proto_hdr_type) ((proto_hdr_type) << PROTO_HDR_SHIFT)
@@ -859,6 +870,14 @@ struct virtchnl_proto_hdrs {VIRTCHNL_CHECK_STRUCT_LEN (2312 , virtchnl_proto_hdrs); +struct virtchnl_rss_cfg { +struct virtchnl_proto_hdrs proto_hdrs;/* protocol headers */ +enum virtchnl_rss_algorithm rss_algorithm;/* rss algorithm type */ +u8 reserved[128 ];/* reserve for future */ +}; + +VIRTCHNL_CHECK_STRUCT_LEN (2444 , virtchnl_rss_cfg); +/* action configuration for FDIR */ struct virtchnl_filter_action {enum virtchnl_action type;
@@ -1127,6 +1146,10 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,case VIRTCHNL_OP_DEL_CLOUD_FILTER : valid_len =sizeof (struct virtchnl_filter );break ; +case VIRTCHNL_OP_ADD_RSS_CFG : +case VIRTCHNL_OP_DEL_RSS_CFG : + valid_len =sizeof (struct virtchnl_rss_cfg ); +break ;case VIRTCHNL_OP_ADD_FDIR_FILTER : valid_len =sizeof (struct virtchnl_fdir_add );break ;
Signature · 1 line
2.31.1
PATCH 2/6 ice: Support RSS configure removal for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Add the handler for virtchnl message VIRTCHNL_OP_DEL_RSS_CFG to remove an existing RSS configuration with matching hashed fields.
--- drivers/net/ethernet/intel/ice/ice_flow.c | 88 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_flow.h | 3 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 16 +++- 3 files changed, 105 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_flow.c +88 -0
@@ -2149,6 +2149,94 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,return status; } +/** +* ice_rem_rss_cfg_sync - remove an existing RSS configuration +* @hw: pointer to the hardware structure +* @vsi_handle: software VSI handle +* @hashed_flds: Packet hash types (ICE_FLOW_HASH_*) to remove +* @addl_hdrs: Protocol header fields within a packet segment +* @segs_cnt: packet segment count +* +* Assumption: lock has already been acquired for RSS list +*/ +static enum ice_status +ice_rem_rss_cfg_sync (struct ice_hw *hw,u16 vsi_handle,u64 hashed_flds, +u32 addl_hdrs,u8 segs_cnt) +{ +const enum ice_block blk =ICE_BLK_RSS ; +struct ice_flow_seg_info *segs; +struct ice_flow_prof *prof; +enum ice_status status; + + segs =kcalloc (segs_cnt,sizeof (*segs),GFP_KERNEL ); +if (!segs) +return ICE_ERR_NO_MEMORY ; + +/* Construct the packet segment info from the hashed fields */ + status =ice_flow_set_rss_seg_info (&segs[segs_cnt -1 ], hashed_flds, + addl_hdrs); +if (status) + goto out; + + prof =ice_flow_find_prof_conds (hw, blk,ICE_FLOW_RX , segs, segs_cnt, + vsi_handle, +ICE_FLOW_FIND_PROF_CHK_FLDS ); +if (!prof) { + status =ICE_ERR_DOES_NOT_EXIST ; + goto out; + } + + status =ice_flow_disassoc_prof (hw, blk, prof, vsi_handle); +if (status) + goto out; + +/* Remove RSS configuration from VSI context before deleting +* the flow profile. +*/ +ice_rem_rss_list (hw, vsi_handle, prof); + +if (bitmap_empty (prof->vsis,ICE_MAX_VSI )) + status =ice_flow_rem_prof (hw, blk, prof->id); + +out: +kfree (segs); +return status; +} + +/** +* ice_rem_rss_cfg - remove an existing RSS config with matching hashed fields +* @hw: pointer to the hardware structure +* @vsi_handle: software VSI handle +* @hashed_flds: Packet hash types (ICE_FLOW_HASH_*) to remove +* @addl_hdrs: Protocol header fields within a packet segment +* +* This function will lookup the flow profile based on the input +* hash field bitmap, iterate through the profile entry list of +* that profile and find entry associated with input VSI to be +* removed. Calls are made to underlying flow apis which will in +* turn build or update buffers for RSS XLT1 section. +*/ +enum ice_status __maybe_unused +ice_rem_rss_cfg (struct ice_hw *hw,u16 vsi_handle,u64 hashed_flds, +u32 addl_hdrs) +{ +enum ice_status status; + +if (hashed_flds ==ICE_HASH_INVALID || + !ice_is_vsi_valid (hw, vsi_handle)) +return ICE_ERR_PARAM ; + +mutex_lock (&hw->rss_locks); + status =ice_rem_rss_cfg_sync (hw, vsi_handle, hashed_flds, addl_hdrs, +ICE_RSS_OUTER_HEADERS ); +if (!status) + status =ice_rem_rss_cfg_sync (hw, vsi_handle, hashed_flds, + addl_hdrs,ICE_RSS_INNER_HEADERS ); +mutex_unlock (&hw->rss_locks); + +return status; +} +/* Mapping of AVF hash bit fields to an L3-L4 hash combination. * As the ice_flow_avf_hdr_field represent individual bit shifts in a hash, * convert its values to their appropriate flow L3, L4 values.
drivers/net/ethernet/intel/ice/ice_flow.h +3 -0
@@ -409,5 +409,8 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle);enum ice_status ice_add_rss_cfg (struct ice_hw *hw,u16 vsi_handle,u64 hashed_flds,u32 addl_hdrs); +enum ice_status +ice_rem_rss_cfg (struct ice_hw *hw,u16 vsi_handle,u64 hashed_flds, +u32 addl_hdrs);u64 ice_get_rss_cfg (struct ice_hw *hw,u16 vsi_handle,u32 hdrs);#endif /* _ICE_FLOW_H_ */
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +14 -2
@@ -2651,8 +2651,20 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add) vsi->vsi_num, v_ret); } }else { - v_ret =VIRTCHNL_STATUS_ERR_NOT_SUPPORTED ; -dev_err (dev,"RSS removal not support\n" ); +enum ice_status status; + + status =ice_rem_rss_cfg (hw, vsi->idx, hash_flds, + addl_hdrs); +/* We just ignore ICE_ERR_DOES_NOT_EXIST, because +* if two configurations share the same profile remove +* one of them actually removes both, since the +* profile is deleted. +*/ +if (status && status !=ICE_ERR_DOES_NOT_EXIST ) { + v_ret =VIRTCHNL_STATUS_ERR_PARAM ; +dev_err (dev,"ice_rem_rss_cfg failed for vsi = %d, v_ret = %d\n" , + vsi->vsi_num, v_ret); + } } }
Signature · 1 line
2.31.1
PATCH 3/6 iavf: Add framework to enable ethtool RSS config
In reply to Haiyue WangAdd the virtchnl message interface to VF, so that VF can request RSS input set(s) based on PF's capability.
This framework allows ethtool RSS config support on the VF driver.
--- drivers/net/ethernet/intel/iavf/iavf.h | 10 ++ .../net/ethernet/intel/iavf/iavf_adv_rss.h | 25 +++ drivers/net/ethernet/intel/iavf/iavf_main.c | 28 ++++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 154 ++++++++++++++++++ 4 files changed, 217 insertions(+) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_adv_rss.h
drivers/net/ethernet/intel/iavf/iavf.h +10 -0
@@ -38,6 +38,7 @@#include <linux/avf/virtchnl.h> #include "iavf_txrx.h" #include "iavf_fdir.h" +#include "iavf_adv_rss.h" #define DEFAULT_DEBUG_LEVEL_SHIFT 3#define PFX "iavf: "
@@ -304,6 +305,8 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_DEL_CLOUD_FILTER BIT(24)#define IAVF_FLAG_AQ_ADD_FDIR_FILTER BIT(25)#define IAVF_FLAG_AQ_DEL_FDIR_FILTER BIT(26) +#define IAVF_FLAG_AQ_ADD_ADV_RSS_CFG BIT(27) +#define IAVF_FLAG_AQ_DEL_ADV_RSS_CFG BIT(28)/* OS defined structs */ struct net_device *netdev;
@@ -346,6 +349,8 @@ struct iavf_adapter { VIRTCHNL_VF_CAP_ADV_LINK_SPEED)#define FDIR_FLTR_SUPPORT (_a) ((_a)->vf_res->vf_cap_flags & \ VIRTCHNL_VF_OFFLOAD_FDIR_PF) +#define ADV_RSS_SUPPORT (_a) ((_a)->vf_res->vf_cap_flags & \ + VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF)struct virtchnl_vf_resource *vf_res;/* incl. all VSIs */ struct virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ struct virtchnl_version_info pf_version;
@@ -373,6 +378,9 @@ struct iavf_adapter {u16 fdir_active_fltr;struct list_head fdir_list_head;spinlock_t fdir_fltr_lock;/* protect the Flow Director filter list */ + +struct list_head adv_rss_list_head; +spinlock_t adv_rss_lock;/* protect the RSS management list */ };
@@ -445,6 +453,8 @@ void iavf_add_cloud_filter(struct iavf_adapter *adapter);void iavf_del_cloud_filter (struct iavf_adapter *adapter);void iavf_add_fdir_filter (struct iavf_adapter *adapter);void iavf_del_fdir_filter (struct iavf_adapter *adapter); +void iavf_add_adv_rss_cfg (struct iavf_adapter *adapter); +void iavf_del_adv_rss_cfg (struct iavf_adapter *adapter);struct iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter,const u8 *macaddr);#endif /* _IAVF_H_ */
drivers/net/ethernet/intel/iavf/iavf_adv_rss.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2021, Intel Corporation. */ + +#ifndef _IAVF_ADV_RSS_H_ +#define _IAVF_ADV_RSS_H_ + +struct iavf_adapter ; + +/* State of advanced RSS configuration */ +enum iavf_adv_rss_state_t { +IAVF_ADV_RSS_ADD_REQUEST ,/* User requests to add RSS */ +IAVF_ADV_RSS_ADD_PENDING ,/* RSS pending add by the PF */ +IAVF_ADV_RSS_DEL_REQUEST ,/* Driver requests to delete RSS */ +IAVF_ADV_RSS_DEL_PENDING ,/* RSS pending delete by the PF */ +IAVF_ADV_RSS_ACTIVE ,/* RSS configuration is active */ +}; + +/* bookkeeping of advanced RSS configuration */ +struct iavf_adv_rss { +enum iavf_adv_rss_state_t state; +struct list_head list; + +struct virtchnl_rss_cfg rss_cfg_msg; +}; +#endif /* _IAVF_ADV_RSS_H_ */
drivers/net/ethernet/intel/iavf/iavf_main.c +28 -0
@@ -962,6 +962,7 @@ void iavf_down(struct iavf_adapter *adapter)struct iavf_cloud_filter *cf;struct iavf_fdir_fltr *fdir;struct iavf_mac_filter *f; +struct iavf_adv_rss *rss;if (adapter->state <= __IAVF_DOWN_PENDING)return ;
@@ -1004,6 +1005,13 @@ void iavf_down(struct iavf_adapter *adapter) }spin_unlock_bh (&adapter->fdir_fltr_lock); +/* remove all advance RSS configuration */ +spin_lock_bh (&adapter->adv_rss_lock); +list_for_each_entry (rss, &adapter->adv_rss_list_head, list) { + rss->state =IAVF_ADV_RSS_DEL_REQUEST ; + } +spin_unlock_bh (&adapter->adv_rss_lock); +if (!(adapter->flags &IAVF_FLAG_PF_COMMS_FAILED ) && adapter->state != __IAVF_RESETTING) {/* cancel any current operation */
@@ -1016,6 +1024,7 @@ void iavf_down(struct iavf_adapter *adapter) adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; + adapter->aq_required |=IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ; adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ; }
@@ -1646,6 +1655,14 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)iavf_del_fdir_filter (adapter);return IAVF_SUCCESS ; } +if (adapter->aq_required &IAVF_FLAG_AQ_ADD_ADV_RSS_CFG ) { +iavf_add_adv_rss_cfg (adapter); +return 0 ; + } +if (adapter->aq_required &IAVF_FLAG_AQ_DEL_ADV_RSS_CFG ) { +iavf_del_adv_rss_cfg (adapter); +return 0 ; + }return -EAGAIN ; }
@@ -3776,11 +3793,13 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)spin_lock_init (&adapter->mac_vlan_list_lock);spin_lock_init (&adapter->cloud_filter_list_lock);spin_lock_init (&adapter->fdir_fltr_lock); +spin_lock_init (&adapter->adv_rss_lock);INIT_LIST_HEAD (&adapter->mac_filter_list);INIT_LIST_HEAD (&adapter->vlan_filter_list);INIT_LIST_HEAD (&adapter->cloud_filter_list);INIT_LIST_HEAD (&adapter->fdir_list_head); +INIT_LIST_HEAD (&adapter->adv_rss_list_head);INIT_WORK (&adapter->reset_task, iavf_reset_task);INIT_WORK (&adapter->adminq_task, iavf_adminq_task);
@@ -3886,6 +3905,7 @@ static void iavf_remove(struct pci_dev *pdev)struct iavf_adapter *adapter =netdev_priv (netdev);struct iavf_fdir_fltr *fdir, *fdirtmp;struct iavf_vlan_filter *vlf, *vlftmp; +struct iavf_adv_rss *rss, *rsstmp;struct iavf_mac_filter *f, *ftmp;struct iavf_cloud_filter *cf, *cftmp;struct iavf_hw *hw = &adapter->hw;
@@ -3969,6 +3989,14 @@ static void iavf_remove(struct pci_dev *pdev) }spin_unlock_bh (&adapter->fdir_fltr_lock); +spin_lock_bh (&adapter->adv_rss_lock); +list_for_each_entry_safe (rss, rsstmp, &adapter->adv_rss_list_head, + list) { +list_del (&rss->list); +kfree (rss); + } +spin_unlock_bh (&adapter->adv_rss_lock); +free_netdev (netdev);pci_disable_pcie_error_reporting (pdev);
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +154 -0
178 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH 4/6 iavf: Support ethtool TCP flow RSS hash
In reply to Haiyue WangSupport to configure the TCP flow RSS hash by ethtool.
Supported fields are: src-ip, dst-ip, src-port, dst-port. Supported rx-flow-hash types are: tcp4, tcp6.
--- drivers/net/ethernet/intel/iavf/Makefile | 1 + .../net/ethernet/intel/iavf/iavf_adv_rss.c | 176 ++++++++++++++ .../net/ethernet/intel/iavf/iavf_adv_rss.h | 55 +++++ .../net/ethernet/intel/iavf/iavf_ethtool.c | 215 +++++++++++++++++- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 16 +- 5 files changed, 459 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_adv_rss.c
drivers/net/ethernet/intel/iavf/Makefile +1 -0
@@ -12,4 +12,5 @@ subdir-ccflags-y += -I$(src) obj-$(CONFIG_IAVF) += iavf.o iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o iavf_fdir.o \ + iavf_adv_rss.o \ iavf_txrx.o iavf_common.o iavf_adminq.o iavf_client.o
drivers/net/ethernet/intel/iavf/iavf_adv_rss.c new file +176 -0
176 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_adv_rss.h +55 -0
66 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +213 -2
233 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +14 -2
@@ -1327,6 +1327,9 @@ void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter) process_rss = true; rss->state =IAVF_ADV_RSS_ADD_PENDING ;memcpy (rss_cfg, &rss->rss_cfg_msg, len); +iavf_print_adv_rss_cfg (KERN_DEBUG , adapter, rss, +"Input set change for" , +"is pending" );break ; } }
@@ -1601,6 +1604,10 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, &adapter->adv_rss_list_head, list) {if (rss->state ==IAVF_ADV_RSS_ADD_PENDING ) { +iavf_print_adv_rss_cfg (KERN_ERR , + adapter, rss, +"Failed to change the input set for" , +NULL );list_del (&rss->list);kfree (rss); }
@@ -1817,9 +1824,14 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,struct iavf_adv_rss *rss;spin_lock_bh (&adapter->adv_rss_lock); -list_for_each_entry (rss, &adapter->adv_rss_list_head, list) -if (rss->state ==IAVF_ADV_RSS_ADD_PENDING ) +list_for_each_entry (rss, &adapter->adv_rss_list_head, list) { +if (rss->state ==IAVF_ADV_RSS_ADD_PENDING ) { +iavf_print_adv_rss_cfg (KERN_DEBUG , adapter, rss, +"Input set change for" , +"successful" ); rss->state =IAVF_ADV_RSS_ACTIVE ; + } + }spin_unlock_bh (&adapter->adv_rss_lock); }break ;
Signature · 1 line
2.31.1
PATCH 5/6 iavf: Support ethtool UDP flow RSS hash
In reply to Haiyue WangSupport to configure the UDP flow RSS hash by ethtool.
Supported fields are: src-ip, dst-ip, src-port, dst-port. Supported rx-flow-hash types are: udp4, udp6.
--- .../net/ethernet/intel/iavf/iavf_adv_rss.c | 28 +++++++++++++++++-- .../net/ethernet/intel/iavf/iavf_adv_rss.h | 10 ++++++- .../net/ethernet/intel/iavf/iavf_ethtool.c | 23 +++++++++++++-- 3 files changed, 56 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_adv_rss.c +26 -2
@@ -56,6 +56,23 @@ iavf_fill_adv_rss_tcp_hdr(struct virtchnl_proto_hdr *hdr, u64 hash_flds)VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,TCP ,DST_PORT ); } +/** +* iavf_fill_adv_rss_udp_hdr - fill the UDP RSS protocol header +* @hdr: the virtchnl message protocol header data structure +* @hash_flds: the RSS configuration protocol hash fields +*/ +static void +iavf_fill_adv_rss_udp_hdr (struct virtchnl_proto_hdr *hdr,u64 hash_flds) +{ +VIRTCHNL_SET_PROTO_HDR_TYPE (hdr,UDP ); + +if (hash_flds &IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT ) +VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,UDP ,SRC_PORT ); + +if (hash_flds &IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT ) +VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,UDP ,DST_PORT ); +} +/** * iavf_fill_adv_rss_cfg_msg - fill the RSS configuration into virtchnl message * @rss_cfg: the virtchnl message to be filled with RSS configuration setting
@@ -92,6 +109,9 @@ iavf_fill_adv_rss_cfg_msg(struct virtchnl_rss_cfg *rss_cfg,case IAVF_ADV_RSS_FLOW_SEG_HDR_TCP :iavf_fill_adv_rss_tcp_hdr (hdr, hash_flds);break ; +case IAVF_ADV_RSS_FLOW_SEG_HDR_UDP : +iavf_fill_adv_rss_udp_hdr (hdr, hash_flds); +break ;default :return -EINVAL ; }
@@ -144,6 +164,8 @@ iavf_print_adv_rss_cfg(const char *level, struct iavf_adapter *adapter,if (packet_hdrs &IAVF_ADV_RSS_FLOW_SEG_HDR_TCP ) proto ="TCP" ; +else if (packet_hdrs &IAVF_ADV_RSS_FLOW_SEG_HDR_UDP ) + proto ="UDP" ;else return ;
@@ -161,9 +183,11 @@ iavf_print_adv_rss_cfg(const char *level, struct iavf_adapter *adapter,if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_IPV4_DA |IAVF_ADV_RSS_HASH_FLD_IPV6_DA ))strcat (hash_opt,"IP DA," ); -if (hash_flds &IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT ) +if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT | +IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT ))strcat (hash_opt,"src port," ); -if (hash_flds &IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT ) +if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT | +IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT ))strcat (hash_opt,"dst port," );if (!action)
drivers/net/ethernet/intel/iavf/iavf_adv_rss.h +9 -1
@@ -20,6 +20,7 @@ enum iavf_adv_rss_flow_seg_hdr {IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4 =0x00000001 ,IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 =0x00000002 ,IAVF_ADV_RSS_FLOW_SEG_HDR_TCP =0x00000004 , + IAVF_ADV_RSS_FLOW_SEG_HDR_UDP = 0x00000008, };#define IAVF_ADV_RSS_FLOW_SEG_HDR_L3 \
@@ -27,7 +28,8 @@ enum iavf_adv_rss_flow_seg_hdr { IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6)#define IAVF_ADV_RSS_FLOW_SEG_HDR_L4 \ - (IAVF_ADV_RSS_FLOW_SEG_HDR_TCP) + (IAVF_ADV_RSS_FLOW_SEG_HDR_TCP | \ + IAVF_ADV_RSS_FLOW_SEG_HDR_UDP)enum iavf_adv_rss_flow_field {/* L3 */
@@ -38,6 +40,8 @@ enum iavf_adv_rss_flow_field {/* L4 */ IAVF_ADV_RSS_FLOW_FIELD_IDX_TCP_SRC_PORT ,IAVF_ADV_RSS_FLOW_FIELD_IDX_TCP_DST_PORT , +IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_SRC_PORT , +IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_DST_PORT ,/* The total number of enums must not exceed 64 */ IAVF_ADV_RSS_FLOW_FIELD_IDX_MAX
@@ -56,6 +60,10 @@ enum iavf_adv_rss_flow_field { BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_TCP_SRC_PORT)#define IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT \ BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_TCP_DST_PORT) +#define IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT \ + BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_SRC_PORT) +#define IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT \ + BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_DST_PORT)/* bookkeeping of advanced RSS configuration */ struct iavf_adv_rss {
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +21 -2
@@ -1434,10 +1434,18 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc *cmd) hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_TCP |IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4 ;break ; +case UDP_V4_FLOW : + hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_UDP | +IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4 ; +break ;case TCP_V6_FLOW : hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_TCP |IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 ;break ; +case UDP_V6_FLOW : + hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_UDP | +IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 ; +break ;default :break ; }
@@ -1459,12 +1467,14 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd)if (cmd->data &RXH_IP_SRC || cmd->data &RXH_IP_DST ) {switch (cmd->flow_type) {case TCP_V4_FLOW : +case UDP_V4_FLOW :if (cmd->data &RXH_IP_SRC ) hfld |=IAVF_ADV_RSS_HASH_FLD_IPV4_SA ;if (cmd->data &RXH_IP_DST ) hfld |=IAVF_ADV_RSS_HASH_FLD_IPV4_DA ;break ;case TCP_V6_FLOW : +case UDP_V6_FLOW :if (cmd->data &RXH_IP_SRC ) hfld |=IAVF_ADV_RSS_HASH_FLD_IPV6_SA ;if (cmd->data &RXH_IP_DST )
@@ -1484,6 +1494,13 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd)if (cmd->data &RXH_L4_B_2_3 ) hfld |=IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT ;break ; +case UDP_V4_FLOW : +case UDP_V6_FLOW : +if (cmd->data &RXH_L4_B_0_1 ) + hfld |=IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT ; +if (cmd->data &RXH_L4_B_2_3 ) + hfld |=IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT ; +break ;default :break ; }
@@ -1618,10 +1635,12 @@ iavf_get_adv_rss_hash_opt(struct iavf_adapter *adapter, IAVF_ADV_RSS_HASH_FLD_IPV6_DA)) cmd->data |= (u64)RXH_IP_DST; - if (hash_flds & IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT) + if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT | + IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT)) cmd->data |= (u64)RXH_L4_B_0_1; - if (hash_flds & IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT) + if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT | + IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT)) cmd->data |= (u64)RXH_L4_B_2_3;return 0 ;
Signature · 1 line
2.31.1
PATCH 6/6 iavf: Support ethtool SCTP flow RSS hash
In reply to Haiyue WangSupport to configure the SCTP flow RSS hash by ethtool.
Supported fields are: src-ip, dst-ip, src-port, dst-port. Supported rx-flow-hash types are: sctp4, sctp6.
--- .../net/ethernet/intel/iavf/iavf_adv_rss.c | 28 +++++++++++++++++-- .../net/ethernet/intel/iavf/iavf_adv_rss.h | 10 ++++++- .../net/ethernet/intel/iavf/iavf_ethtool.c | 23 +++++++++++++-- 3 files changed, 56 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_adv_rss.c +26 -2
@@ -73,6 +73,23 @@ iavf_fill_adv_rss_udp_hdr(struct virtchnl_proto_hdr *hdr, u64 hash_flds)VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,UDP ,DST_PORT ); } +/** +* iavf_fill_adv_rss_sctp_hdr - fill the SCTP RSS protocol header +* @hdr: the virtchnl message protocol header data structure +* @hash_flds: the RSS configuration protocol hash fields +*/ +static void +iavf_fill_adv_rss_sctp_hdr (struct virtchnl_proto_hdr *hdr,u64 hash_flds) +{ +VIRTCHNL_SET_PROTO_HDR_TYPE (hdr,SCTP ); + +if (hash_flds &IAVF_ADV_RSS_HASH_FLD_SCTP_SRC_PORT ) +VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,SCTP ,SRC_PORT ); + +if (hash_flds &IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT ) +VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,SCTP ,DST_PORT ); +} +/** * iavf_fill_adv_rss_cfg_msg - fill the RSS configuration into virtchnl message * @rss_cfg: the virtchnl message to be filled with RSS configuration setting
@@ -112,6 +129,9 @@ iavf_fill_adv_rss_cfg_msg(struct virtchnl_rss_cfg *rss_cfg,case IAVF_ADV_RSS_FLOW_SEG_HDR_UDP :iavf_fill_adv_rss_udp_hdr (hdr, hash_flds);break ; +case IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP : +iavf_fill_adv_rss_sctp_hdr (hdr, hash_flds); +break ;default :return -EINVAL ; }
@@ -166,6 +186,8 @@ iavf_print_adv_rss_cfg(const char *level, struct iavf_adapter *adapter, proto ="TCP" ; else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_UDP) proto ="UDP" ; + else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP) + proto ="SCTP" ; else return;
@@ -184,10 +206,12 @@ iavf_print_adv_rss_cfg(const char *level, struct iavf_adapter *adapter, IAVF_ADV_RSS_HASH_FLD_IPV6_DA)) strcat(hash_opt, "IP DA,");if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT | -IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT )) +IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT | +IAVF_ADV_RSS_HASH_FLD_SCTP_SRC_PORT ))strcat (hash_opt,"src port," );if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT | -IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT )) +IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT | +IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT ))strcat (hash_opt,"dst port," );if (!action)
drivers/net/ethernet/intel/iavf/iavf_adv_rss.h +9 -1
@@ -21,6 +21,7 @@ enum iavf_adv_rss_flow_seg_hdr {IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 =0x00000002 ,IAVF_ADV_RSS_FLOW_SEG_HDR_TCP =0x00000004 ,IAVF_ADV_RSS_FLOW_SEG_HDR_UDP =0x00000008 , + IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP = 0x00000010, };#define IAVF_ADV_RSS_FLOW_SEG_HDR_L3 \
@@ -29,7 +30,8 @@ enum iavf_adv_rss_flow_seg_hdr {#define IAVF_ADV_RSS_FLOW_SEG_HDR_L4 \ (IAVF_ADV_RSS_FLOW_SEG_HDR_TCP | \ - IAVF_ADV_RSS_FLOW_SEG_HDR_UDP) + IAVF_ADV_RSS_FLOW_SEG_HDR_UDP | \ + IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP)enum iavf_adv_rss_flow_field {/* L3 */
@@ -42,6 +44,8 @@ enum iavf_adv_rss_flow_field {IAVF_ADV_RSS_FLOW_FIELD_IDX_TCP_DST_PORT ,IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_SRC_PORT ,IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_DST_PORT , +IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_SRC_PORT , +IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_DST_PORT ,/* The total number of enums must not exceed 64 */ IAVF_ADV_RSS_FLOW_FIELD_IDX_MAX
@@ -64,6 +68,10 @@ enum iavf_adv_rss_flow_field { BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_SRC_PORT)#define IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT \ BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_DST_PORT) +#define IAVF_ADV_RSS_HASH_FLD_SCTP_SRC_PORT \ + BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_SRC_PORT) +#define IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT \ + BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_DST_PORT)/* bookkeeping of advanced RSS configuration */ struct iavf_adv_rss {
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +21 -2
@@ -1438,6 +1438,10 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc *cmd) hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_UDP |IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4 ;break ; +case SCTP_V4_FLOW : + hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP | +IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4 ; +break ;case TCP_V6_FLOW : hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_TCP |IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 ;
@@ -1446,6 +1450,10 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc *cmd) hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_UDP |IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 ;break ; +case SCTP_V6_FLOW : + hdrs |=IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP | +IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6 ; +break ;default :break ; }
@@ -1468,6 +1476,7 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd)switch (cmd->flow_type) {case TCP_V4_FLOW :case UDP_V4_FLOW : +case SCTP_V4_FLOW :if (cmd->data &RXH_IP_SRC ) hfld |=IAVF_ADV_RSS_HASH_FLD_IPV4_SA ;if (cmd->data &RXH_IP_DST )
@@ -1475,6 +1484,7 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd)break ;case TCP_V6_FLOW :case UDP_V6_FLOW : +case SCTP_V6_FLOW :if (cmd->data &RXH_IP_SRC ) hfld |=IAVF_ADV_RSS_HASH_FLD_IPV6_SA ;if (cmd->data &RXH_IP_DST )
@@ -1501,6 +1511,13 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd)if (cmd->data &RXH_L4_B_2_3 ) hfld |=IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT ;break ; +case SCTP_V4_FLOW : +case SCTP_V6_FLOW : +if (cmd->data &RXH_L4_B_0_1 ) + hfld |=IAVF_ADV_RSS_HASH_FLD_SCTP_SRC_PORT ; +if (cmd->data &RXH_L4_B_2_3 ) + hfld |=IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT ; +break ;default :break ; }
@@ -1636,11 +1653,13 @@ iavf_get_adv_rss_hash_opt(struct iavf_adapter *adapter, cmd->data |= (u64 )RXH_IP_DST ;if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_SRC_PORT | -IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT )) +IAVF_ADV_RSS_HASH_FLD_UDP_SRC_PORT | +IAVF_ADV_RSS_HASH_FLD_SCTP_SRC_PORT )) cmd->data |= (u64 )RXH_L4_B_0_1 ;if (hash_flds & (IAVF_ADV_RSS_HASH_FLD_TCP_DST_PORT | -IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT )) +IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT | +IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT )) cmd->data |= (u64 )RXH_L4_B_2_3 ;return 0 ;
Signature · 1 line
2.31.1