virtchnl: add extended VF capability flags
Subsystems (4)
cover virtchnl: add extended VF capability flags
VF capability flags in struct virtchnl_vf_resource::vf_cap_flags have all been used up, preventing new flags from being added. Unfortunately, flags size cannot be easily increased, as virtchnl message size and structure must remain unchanged to not break ABI. Instead, add a new virtchnl message to handle passing extended caps. Make it flexible size, so new flags can be freely added in the future, without changing virtchnl interface.
Overview:
1: Clean up unused defines that are in the way
2: Do most of the mechanical changes required to store flags in bitmaps 3: Add the new virtchnl message
Marcin Szycik (3):
virtchnl: remove unused defines
virtchnl, iavf, ice, i40e: store VIRTCHNL_VF_* flags in bitmaps virtchnl, iavf, ice, i40e: add extended generic VF capability flags
.../ethernet/intel/i40e/i40e_virtchnl_pf.h | 4 +- drivers/net/ethernet/intel/iavf/iavf.h | 68 +++--- .../net/ethernet/intel/iavf/iavf_prototype.h | 3 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +- .../net/ethernet/intel/ice/virt/virtchnl.h | 2 + include/linux/intel/virtchnl.h | 120 ++++++++--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 160 ++++++++++---- drivers/net/ethernet/intel/iavf/iavf_common.c | 7 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 96 +++++++-- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 185 ++++++++++++++--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 +- .../net/ethernet/intel/ice/virt/allowlist.c | 11 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 2 +- drivers/net/ethernet/intel/ice/virt/queues.c | 13 +- drivers/net/ethernet/intel/ice/virt/rss.c | 4 +- .../net/ethernet/intel/ice/virt/virtchnl.c | 195 +++++++++++++----- 17 files changed, 667 insertions(+), 214 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/3 virtchnl: remove unused defines
Remove:
* VIRTCHNL_VF_CAP_RDMA
* VF_BASE_MODE_OFFLOADS
--- include/linux/intel/virtchnl.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/intel/virtchnl.h +0 -5
@@ -250,7 +250,6 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);*/ #define VIRTCHNL_VF_OFFLOAD_L2 BIT(0)#define VIRTCHNL_VF_OFFLOAD_RDMA BIT(1) -#define VIRTCHNL_VF_CAP_RDMA VIRTCHNL_VF_OFFLOAD_RDMA#define VIRTCHNL_VF_OFFLOAD_RSS_AQ BIT(3)#define VIRTCHNL_VF_OFFLOAD_RSS_REG BIT(4)#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR BIT(5)
@@ -275,10 +274,6 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);#define VIRTCHNL_VF_OFFLOAD_QOS BIT(29)#define VIRTCHNL_VF_CAP_PTP BIT(31) -#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ - VIRTCHNL_VF_OFFLOAD_VLAN | \ - VIRTCHNL_VF_OFFLOAD_RSS_PF) -struct virtchnl_vf_resource {u16 num_vsis;u16 num_queue_pairs;
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next 1/3] virtchnl: remove unused defines
Quoted 49 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Tuesday, April 28, 2026 4:37 PM
To: [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Marcin Szycik <[email protected]>; Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 1/3] virtchnl: remove unused definesRemove:
*VIRTCHNL_VF_CAP_RDMA
*VF_BASE_MODE_OFFLOADSSigned-off-by Marcin Szycik <[email protected]>Reviewed-by Jacob Keller <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>--- include/linux/intel/virtchnl.h | 5 ----- 1 file changed, 5 deletions(-)include/linux/intel/virtchnl.h index renamed from include/linux/intel/virtchnl.h +0
-0
511c8827c640..bb4737de37fe100644include/linux/intel/virtchnl.h +0
-1@@ -250,7 +250,6 @@ VIRTCHNL_CHECK_STRUCT_LEN(16,virtchnl_vsi_resource); */ #define VIRTCHNL_VF_OFFLOAD_L2 BIT(0)#define VIRTCHNL_VF_OFFLOAD_RDMA BIT(1) -#define VIRTCHNL_VF_CAP_RDMA VIRTCHNL_VF_OFFLOAD_RDMA#define VIRTCHNL_VF_OFFLOAD_RSS_AQ BIT(3)#define
VIRTCHNL_VF_OFFLOAD_RSS_REGBIT(4)
#defineVIRTCHNL_VF_OFFLOAD_WB_ON_ITRBIT(5)include/linux/intel/virtchnl.h +0
-4@@ -275,10 +274,6 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);#define VIRTCHNL_VF_OFFLOAD_QOS BIT(29)#define VIRTCHNL_VF_CAP_PTP BIT(31) -#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ - VIRTCHNL_VF_OFFLOAD_VLAN | \ - VIRTCHNL_VF_OFFLOAD_RSS_PF) -struct virtchnl_vf_resource {u16 num_vsis;
Quoted 3 lines
u16
num_queue_pairs;
--
2.49.0
PATCH 2/3 virtchnl, iavf, ice, i40e: store VIRTCHNL_VF_* flags in bitmaps
In reply to Marcin SzycikAs part of preparation to add extended (32nd and more) capability flags, change all flags from bitmasks to bit numbers and store them in bitmaps instead of u32. Change all bitops to test_bit()/set_bit()/etc.
Functionally nothing is changed, except that iavf now stores capability flags in struct iavf_adapter::vf_cap_flags instead of iavf_adapter::vf_res::vf_cap_flags to allow it to grow in the future.
--- .../ethernet/intel/i40e/i40e_virtchnl_pf.h | 4 +- drivers/net/ethernet/intel/iavf/iavf.h | 51 ++++---- .../net/ethernet/intel/iavf/iavf_prototype.h | 3 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +- include/linux/intel/virtchnl.h | 62 +++++----- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 76 ++++++------ drivers/net/ethernet/intel/iavf/iavf_common.c | 7 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 36 +++--- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 51 ++++---- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 +- .../net/ethernet/intel/ice/virt/allowlist.c | 5 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 2 +- drivers/net/ethernet/intel/ice/virt/queues.c | 13 ++- drivers/net/ethernet/intel/ice/virt/rss.c | 4 +- .../net/ethernet/intel/ice/virt/virtchnl.c | 109 +++++++++--------- 16 files changed, 227 insertions(+), 207 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +3 -1
@@ -80,7 +80,9 @@ struct i40e_vf {/* all VF vsis connect to the same parent */ enum i40e_switch_element_types parent_type;struct virtchnl_version_info vf_ver; -u32 driver_caps;/* reported by VF driver */ + +/* reported by VF driver */ +DECLARE_BITMAP (driver_caps,VIRTCHNL_VF_CAPS_MAX );/* VF Port Extender (PE) stag if used */ u16 stag;
drivers/net/ethernet/intel/iavf/iavf.h +24 -27
76 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_prototype.h +2 -1
@@ -42,7 +42,8 @@ enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw, u16 seid, struct iavf_aqc_get_set_rss_key_data *key);void iavf_vf_parse_hw_config (struct iavf_hw *hw, -struct virtchnl_vf_resource *msg); +struct virtchnl_vf_resource *msg, +const unsigned long *vf_cap_flags); enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw, enum virtchnl_ops v_opcode, enum iavf_status v_retval,
drivers/net/ethernet/intel/ice/ice_vf_lib.h +4 -1
@@ -157,7 +157,10 @@ struct ice_vf {u64 rss_hashcfg;/* RSS hash configuration */ struct ice_sw *vf_sw_id;/* switch ID the VF VSIs connect to */ struct virtchnl_version_info vf_ver; -u32 driver_caps;/* reported by VF driver */ + +/* reported by VF driver */ +DECLARE_BITMAP (driver_caps,VIRTCHNL_VF_CAPS_MAX ); +u8 dev_lan_addr[ETH_ALEN ];u8 hw_lan_addr[ETH_ALEN ];struct ice_time_mac legacy_last_added_umac;
include/linux/intel/virtchnl.h +33 -29
68 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +41 -35
141 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_common.c +4 -3
@@ -421,12 +421,14 @@ enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,* iavf_vf_parse_hw_config * @hw: pointer to the hardware structure * @msg: pointer to the virtual channel VF resource structure +* @vf_cap_flags: VF capability flags * * Given a VF resource message from the PF, populate the hw struct * with appropriate information. **/ void iavf_vf_parse_hw_config (struct iavf_hw *hw, -struct virtchnl_vf_resource *msg) +struct virtchnl_vf_resource *msg, +const unsigned long *vf_cap_flags) {struct virtchnl_vsi_resource *vsi_res;int i;
@@ -437,8 +439,7 @@ void iavf_vf_parse_hw_config(struct iavf_hw *hw, hw->dev_caps.num_rx_qp = msg->num_queue_pairs; hw->dev_caps.num_tx_qp = msg->num_queue_pairs; hw->dev_caps.num_msix_vectors_vf = msg->max_vectors; - hw->dev_caps.dcb = msg->vf_cap_flags & -VIRTCHNL_VF_OFFLOAD_L2 ; + hw->dev_caps.dcb =test_bit (VIRTCHNL_VF_OFFLOAD_L2 , vf_cap_flags); hw->dev_caps.fcoe =0 ;for (i =0 ; i < msg->num_vsis; i++) {if (vsi_res->vsi_type ==VIRTCHNL_VSI_SRIOV ) {
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +1 -1
@@ -1726,7 +1726,7 @@ static int iavf_set_channels(struct net_device *netdev,struct iavf_adapter *adapter =netdev_priv (netdev);u32 num_req = ch->combined_count; -if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && +if (test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags) && adapter->num_tc) {dev_info (&adapter->pdev->dev,"Cannot set channels since ADq is enabled.\n" );return -EINVAL ;
drivers/net/ethernet/intel/iavf/iavf_main.c +16 -20
@@ -1533,7 +1533,7 @@ static int iavf_alloc_queues(struct iavf_adapter *adapter)*/ if (adapter->num_req_queues) num_active_queues = adapter->num_req_queues; -else if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && +else if (test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags) && adapter->num_tc) num_active_queues = adapter->ch_config.total_qps;else
@@ -1736,8 +1736,8 @@ static int iavf_init_rss(struct iavf_adapter *adapter)if (!RSS_PF (adapter)) {/* Enable PCTYPES for RSS, TCP/UDP with IPv4/IPv6 */ -if (adapter->vf_res->vf_cap_flags & -VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 ) +if (test_bit (VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 , + adapter->vf_cap_flags)) adapter->rss_hashcfg =IAVF_DEFAULT_RSS_HASHCFG_EXPANDED ;else
@@ -1861,7 +1861,7 @@ static int iavf_init_interrupt_scheme(struct iavf_adapter *adapter)* resources have been allocated in the reset path. * Now we can truly claim that ADq is enabled. */ -if ((adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && +if (test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags) && adapter->num_tc)dev_info (&adapter->pdev->dev,"ADq Enabled, %u TCs created" , adapter->num_tc);
@@ -2436,7 +2436,7 @@ int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter) adapter->vsi.base_vector =1 ; vsi->netdev = adapter->netdev; vsi->qs_handle = adapter->vsi_res->qset_handle; -if (adapter->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_RSS_PF ) { +if (test_bit (VIRTCHNL_VF_OFFLOAD_RSS_PF , adapter->vf_cap_flags)) { adapter->rss_key_size = adapter->vf_res->rss_key_size; adapter->rss_lut_size = adapter->vf_res->rss_lut_size; }else {
@@ -2783,8 +2783,7 @@ static void iavf_init_config_adapter(struct iavf_adapter *adapter)if (err) goto err_sw_init;iavf_map_rings_to_vectors (adapter); -if (adapter->vf_res->vf_cap_flags & -VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) +if (test_bit (VIRTCHNL_VF_OFFLOAD_WB_ON_ITR , adapter->vf_cap_flags)) adapter->flags |=IAVF_FLAG_WB_ON_ITR_CAPABLE ; err =iavf_request_misc_irq (adapter);
@@ -3080,7 +3079,6 @@ static void iavf_reconfig_qs_bw(struct iavf_adapter *adapter)*/ void iavf_reset_step (struct iavf_adapter *adapter) { -struct virtchnl_vf_resource *vfres = adapter->vf_res;struct net_device *netdev = adapter->netdev;struct iavf_hw *hw = &adapter->hw;struct iavf_mac_filter *f, *ftmp;
@@ -3234,7 +3232,7 @@ void iavf_reset_step(struct iavf_adapter *adapter)/* check if TCs are running and re-add all cloud filters */ spin_lock_bh (&adapter->cloud_filter_list_lock); -if ((vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ ) && +if (test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags) && adapter->num_tc) {list_for_each_entry (cf, &adapter->cloud_filter_list, list) { cf->add = true;
@@ -3675,7 +3673,6 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data) {struct tc_mqprio_qopt_offload *mqprio_qopt = type_data;struct iavf_adapter *adapter =netdev_priv (netdev); -struct virtchnl_vf_resource *vfres = adapter->vf_res;u8 num_tc =0 , total_qps =0 ;int ret =0 , netdev_tc =0 ;u64 max_tx_rate;
@@ -3704,7 +3701,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)/* add queue channel */ if (mode ==TC_MQPRIO_MODE_CHANNEL ) { -if (!(vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ )) { +if (!test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags)) {dev_err (&adapter->pdev->dev,"ADq not supported\n" );return -EOPNOTSUPP ; }
@@ -4744,7 +4741,7 @@ iavf_get_netdev_vlan_hw_features(struct iavf_adapter *adapter) {netdev_features_t hw_features =0 ; -if (!adapter->vf_res || !adapter->vf_res->vf_cap_flags) +if (bitmap_empty (adapter->vf_cap_flags,VIRTCHNL_VF_CAPS_MAX ))return hw_features;/* Enable VLAN features if supported */
@@ -4809,7 +4806,7 @@ iavf_get_netdev_vlan_features(struct iavf_adapter *adapter) {netdev_features_t features =0 ; -if (!adapter->vf_res || !adapter->vf_res->vf_cap_flags) +if (bitmap_empty (adapter->vf_cap_flags,VIRTCHNL_VF_CAPS_MAX ))return features;if (VLAN_ALLOWED (adapter)) {
@@ -5186,7 +5183,6 @@ static int iavf_check_reset_complete(struct iavf_hw *hw)**/ int iavf_process_config (struct iavf_adapter *adapter) { -struct virtchnl_vf_resource *vfres = adapter->vf_res;netdev_features_t hw_vlan_features, vlan_features;struct net_device *netdev = adapter->netdev;netdev_features_t hw_enc_features;
@@ -5208,7 +5204,7 @@ int iavf_process_config(struct iavf_adapter *adapter)/* advertise to stack only if offloads for encapsulated packets is * supported */ -if (vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ENCAP ) { +if (test_bit (VIRTCHNL_VF_OFFLOAD_ENCAP , adapter->vf_cap_flags)) { hw_enc_features |=NETIF_F_GSO_UDP_TUNNEL |NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM |
@@ -5218,8 +5214,8 @@ int iavf_process_config(struct iavf_adapter *adapter)NETIF_F_GSO_PARTIAL |0 ; -if (!(vfres->vf_cap_flags & -VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM )) +if (!test_bit (VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM , + adapter->vf_cap_flags)) netdev->gso_partial_features |=NETIF_F_GSO_UDP_TUNNEL_CSUM ;
@@ -5239,11 +5235,11 @@ int iavf_process_config(struct iavf_adapter *adapter) hw_vlan_features =iavf_get_netdev_vlan_hw_features (adapter);/* Enable HW TC offload if ADQ or tc U32 is supported */ -if (vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_ADQ || +if (test_bit (VIRTCHNL_VF_OFFLOAD_ADQ , adapter->vf_cap_flags) ||TC_U32_SUPPORT (adapter)) hw_features |=NETIF_F_HW_TC ; -if (vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_USO ) +if (test_bit (VIRTCHNL_VF_OFFLOAD_USO , adapter->vf_cap_flags)) hw_features |=NETIF_F_GSO_UDP_L4 ; netdev->hw_features |= hw_features | hw_vlan_features;
@@ -5251,7 +5247,7 @@ int iavf_process_config(struct iavf_adapter *adapter) netdev->features |= hw_features | vlan_features; -if (vfres->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_VLAN ) +if (test_bit (VIRTCHNL_VF_OFFLOAD_VLAN , adapter->vf_cap_flags)) netdev->features |=NETIF_F_HW_VLAN_CTAG_FILTER ;if (FDIR_FLTR_SUPPORT (adapter)) {
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +28 -23
74 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_vf_lib.c +2 -2
@@ -792,7 +792,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)mutex_lock (&vf->cfg_lock);ice_eswitch_detach_vf (pf, vf); - vf->driver_caps =0 ; +bitmap_zero (vf->driver_caps,VIRTCHNL_VF_CAPS_MAX );ice_vc_set_default_allowlist (vf);ice_vf_fdir_exit (vf);
@@ -935,7 +935,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)if (!rsd)dev_warn (dev,"VF reset check timeout on VF %d\n" , vf->vf_id); - vf->driver_caps =0 ; +bitmap_zero (vf->driver_caps,VIRTCHNL_VF_CAPS_MAX );ice_vc_set_default_allowlist (vf);/* disable promiscuous modes in case they were enabled
drivers/net/ethernet/intel/ice/virt/allowlist.c +2 -3
@@ -102,7 +102,7 @@ struct allowlist_opcode_info {#define BIT_INDEX (caps) (HWEIGHT((caps) - 1))#define ALLOW_ITEM (caps, list) \ - [BIT_INDEX(caps)] = { \ + [caps] = { \ .opcodes = list, \ .size = ARRAY_SIZE(list) \ }
@@ -190,10 +190,9 @@ void ice_vc_set_working_allowlist(struct ice_vf *vf)*/ void ice_vc_set_caps_allowlist (struct ice_vf *vf) { -unsigned long caps = vf->driver_caps;unsigned int i; -for_each_set_bit (i, &caps,ARRAY_SIZE (allowlist_opcodes)) +for_each_set_bit (i, vf->driver_caps,ARRAY_SIZE (allowlist_opcodes))ice_vc_allowlist_opcodes (vf, allowlist_opcodes[i].opcodes, allowlist_opcodes[i].size); }
drivers/net/ethernet/intel/ice/virt/fdir.c +1 -1
@@ -105,7 +105,7 @@ ice_vc_fdir_param_check(struct ice_vf *vf, u16 vsi_id)if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states))return -EINVAL ; -if (!(vf->driver_caps &VIRTCHNL_VF_OFFLOAD_FDIR_PF )) +if (!test_bit (VIRTCHNL_VF_OFFLOAD_FDIR_PF , vf->driver_caps))return -EINVAL ;if (!ice_vc_isvalid_vsi_id (vf, vsi_id))
drivers/net/ethernet/intel/ice/virt/queues.c +7 -6
@@ -781,7 +781,7 @@ int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)if (!qci->qpair[i].rxq.crc_disable)continue ; -if (!(vf->driver_caps &VIRTCHNL_VF_OFFLOAD_CRC ) || +if (!test_bit (VIRTCHNL_VF_OFFLOAD_CRC , vf->driver_caps) || vf->vlan_strip_ena) goto error_param; }
@@ -868,8 +868,8 @@ int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)* format. Legacy 16byte descriptor is not supported. * If this RXDID is selected, return error. */ -if (vf->driver_caps & -VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC ) { +if (test_bit (VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC , + vf->driver_caps)) { rxdid = qpi->rxq.rxdid;if (!(BIT (rxdid) & pf->supported_rxdids)) goto error_param;
@@ -877,9 +877,10 @@ int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) rxdid =ICE_RXDID_LEGACY_1 ; } - ena_ts = ((vf->driver_caps & -VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC ) && - (vf->driver_caps &VIRTCHNL_VF_CAP_PTP ) && + ena_ts = (test_bit (VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC , + vf->driver_caps) && +test_bit (VIRTCHNL_VF_CAP_PTP , + vf->driver_caps) && (qpi->rxq.flags &VIRTCHNL_PTP_RX_TSTAMP )); ice_write_qrxflxp_cntxt(&vsi->back->hw,
drivers/net/ethernet/intel/ice/virt/rss.c +2 -2
@@ -680,9 +680,9 @@ static bool ice_vc_parse_rss_cfg(struct ice_hw *hw,* Return true if VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF capability is set, * else return false */ -static bool ice_vf_adv_rss_offload_ena (u32 caps) +static bool ice_vf_adv_rss_offload_ena (const unsigned long *caps) { -return !!(caps &VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF ); +return test_bit (VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF , caps); }/**
drivers/net/ethernet/intel/ice/virt/virtchnl.c +57 -52
194 lines not on this page · raw message
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next 2/3] virtchnl, iavf, ice, i40e: store VIRTCHNL_VF_* flags in bitmaps
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h struct i40e_vf {
Quoted 50 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Tuesday, April 28, 2026 4:37 PM
To: [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Marcin Szycik <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 2/3] virtchnl, iavf, ice, i40e: store VIRTCHNL_VF_* flags in bitmapsAs part of preparation to add extended (32nd and more) capability flags, change all flags from bitmasks to bit numbers and store them in bitmaps instead of u32. Change all bitops to test_bit()/set_bit()/etc.
Functionally nothing is changed, except that iavf now stores capability flags in struct
iavf_adapter::vf_cap_flagsinstead ofiavf_adapter::vf_res::vf_cap_flagsto allow it to grow in the future.Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Jacob Keller <[email protected]>--- .../ethernet/intel/i40e/i40e_virtchnl_pf.h | 4 +- drivers/net/ethernet/intel/iavf/iavf.h | 51 ++++---- .../net/ethernet/intel/iavf/iavf_prototype.h | 3 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +- include/linux/intel/virtchnl.h | 62 +++++----- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 76 ++++++------ drivers/net/ethernet/intel/iavf/iavf_common.c | 7 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 36 +++--- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 51 ++++---- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 +- .../net/ethernet/intel/ice/virt/allowlist.c | 5 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 2 +- drivers/net/ethernet/intel/ice/virt/queues.c | 13 ++- drivers/net/ethernet/intel/ice/virt/rss.c | 4 +- .../net/ethernet/intel/ice/virt/virtchnl.c | 109 +++++++++--------- 16 files changed, 227 insertions(+), 207 deletions(-)drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +0
-0@@ -80,7 +80,9 @@ struct i40e_vf {
PATCH 3/3 virtchnl, iavf, ice, i40e: add extended generic VF capability flags
In reply to Marcin SzycikVF capability flags in struct virtchnl_vf_resource::vf_cap_flags have all been used up, preventing new flags from being added. Note that despite not all bits being defined here, they are used by out-of-tree releases of Intel drivers, therefore cannot be taken.
virtchnl message size and structure must remain unchanged to not break reverse compatibility, therefore the existing virtchnl structure cannot be extended with additional fields (e.g. flags2). vf_cap_flags type cannot be changed to a larger one for the same reason.
Bit 2 of vf_cap_flags was reserved for exactly this case. Its presence in message initially sent from VF shall now signal that there are more capability flags to be parsed. If the PF driver acknowledges that via VIRTCHNL_OP_GET_VF_RESOURCES response, the VF will send a separate
message: VIRTCHNL_OP_GET_VF_CAPS2, containing more capability flags.
Note: this mechanism is similar for VIRTCHNL_OP_1588_PTP_GET_CAPS.
The new message supports flexible size, so more flags can be added without any architectural changes. Care was taken to ensure that no out-of-bounds reads happen in case the bitmap is shorter in one of the drivers.
The new message includes the original 32 bits too, for consistency and more straightforward parsing.
--- drivers/net/ethernet/intel/iavf/iavf.h | 19 ++- .../net/ethernet/intel/ice/virt/virtchnl.h | 2 + include/linux/intel/virtchnl.h | 55 ++++++- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 84 +++++++++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 60 ++++++++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 138 +++++++++++++++++- .../net/ethernet/intel/ice/virt/allowlist.c | 6 + .../net/ethernet/intel/ice/virt/virtchnl.c | 86 +++++++++++ 8 files changed, 444 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +16 -3
@@ -343,6 +343,7 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS BIT_ULL(42)#define IAVF_FLAG_AQ_GET_PTP_CAPS BIT_ULL(43)#define IAVF_FLAG_AQ_SEND_PTP_CMD BIT_ULL(44) +#define IAVF_FLAG_AQ_GET_VF_CAP_CAPS2 BIT_ULL(45)/* AQ messages that must be sent after IAVF_FLAG_AQ_GET_CONFIG, in * order to negotiated extended capabilities.
@@ -350,7 +351,9 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_EXTENDED_CAPS \ (IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS | \ IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS | \ - IAVF_FLAG_AQ_GET_PTP_CAPS) + IAVF_FLAG_AQ_GET_PTP_CAPS | \ + IAVF_FLAG_AQ_GET_VF_CAP_CAPS2 | \ + 0)/* flags for processing extended capability messages during * __IAVF_INIT_EXTENDED_CAPS. Each capability exchange requires
@@ -366,6 +369,8 @@ struct iavf_adapter {#define IAVF_EXTENDED_CAP_RECV_RXDID BIT_ULL(3)#define IAVF_EXTENDED_CAP_SEND_PTP BIT_ULL(4)#define IAVF_EXTENDED_CAP_RECV_PTP BIT_ULL(5) +#define IAVF_EXTENDED_CAP_SEND_CAPS2 BIT_ULL(6) +#define IAVF_EXTENDED_CAP_RECV_CAPS2 BIT_ULL(7)#define IAVF_EXTENDED_CAPS \ (IAVF_EXTENDED_CAP_SEND_VLAN_V2 | \
@@ -373,7 +378,10 @@ struct iavf_adapter {IAVF_EXTENDED_CAP_SEND_RXDID | \IAVF_EXTENDED_CAP_RECV_RXDID | \IAVF_EXTENDED_CAP_SEND_PTP | \ - IAVF_EXTENDED_CAP_RECV_PTP) +IAVF_EXTENDED_CAP_RECV_PTP | \ +IAVF_EXTENDED_CAP_SEND_CAPS2 | \ +IAVF_EXTENDED_CAP_RECV_CAPS2 | \ + 0)/* Lock to prevent possible clobbering of * current_netdev_promisc_flags
@@ -430,6 +438,7 @@ struct iavf_adapter {#define IAVF_RXDID_ALLOWED (a) \ test_bit(VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC, (a)->vf_cap_flags)#define IAVF_PTP_ALLOWED (a) test_bit(VIRTCHNL_VF_CAP_PTP, (a)->vf_cap_flags) +#define IAVF_CAPS2_ALLOWED (a) test_bit(VIRTCHNL_VF_CAPS2, (a)->vf_cap_flags)struct virtchnl_vf_resource *vf_res;/* incl. all VSIs */ struct virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ struct virtchnl_version_info pf_version;
@@ -439,7 +448,9 @@ struct iavf_adapter {u64 supp_rxdids;struct iavf_ptp ptp; -/* Mirrors vf_res->vf_cap_flags */ +/* Negotiated via VIRTCHNL_OP_GET_VF_CAPS2. First 32 bits mirror +* vf_res->vf_cap_flags. +*/ DECLARE_BITMAP (vf_cap_flags,VIRTCHNL_VF_CAPS_MAX );u16 msg_enable;
@@ -578,6 +589,8 @@ int iavf_send_vf_supported_rxdids_msg(struct iavf_adapter *adapter);int iavf_get_vf_supported_rxdids (struct iavf_adapter *adapter);int iavf_send_vf_ptp_caps_msg (struct iavf_adapter *adapter);int iavf_get_vf_ptp_caps (struct iavf_adapter *adapter); +int iavf_send_vf_caps2_msg (struct iavf_adapter *adapter); +int iavf_get_vf_caps2 (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);
drivers/net/ethernet/intel/ice/virt/virtchnl.h +2 -0
@@ -78,6 +78,8 @@ struct ice_virtchnl_ops {int (*get_ptp_cap)(struct ice_vf *vf,const struct virtchnl_ptp_caps *msg);int (*get_phc_time)(struct ice_vf *vf); +int (*get_vf_caps2)(struct ice_vf *vf, +const struct virtchnl_vf_caps2 *msg); };#ifdef CONFIG_PCI_IOV
include/linux/intel/virtchnl.h +54 -1
98 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +84 -0
108 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_main.c +60 -0
78 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +136 -2
168 lines not on this page · raw message
drivers/net/ethernet/intel/ice/virt/allowlist.c +6 -0
@@ -90,6 +90,11 @@ static const u32 ptp_allowlist_opcodes[] = { VIRTCHNL_OP_1588_PTP_GET_TIME, }; +/* VIRTCHNL_VF_CAPS2 */ +static const u32 caps2_allowlist_opcodes[] = { +VIRTCHNL_OP_GET_VF_CAPS2 , +}; +static const u32 tc_allowlist_opcodes[] = {VIRTCHNL_OP_GET_QOS_CAPS ,VIRTCHNL_OP_CONFIG_QUEUE_BW ,VIRTCHNL_OP_CONFIG_QUANTA ,
@@ -117,6 +122,7 @@ static const struct allowlist_opcode_info allowlist_opcodes[] = {ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_VLAN_V2 , vlan_v2_allowlist_opcodes),ALLOW_ITEM (VIRTCHNL_VF_OFFLOAD_QOS , tc_allowlist_opcodes),ALLOW_ITEM (VIRTCHNL_VF_CAP_PTP , ptp_allowlist_opcodes), + ALLOW_ITEM(VIRTCHNL_VF_CAPS2, caps2_allowlist_opcodes), };/**
drivers/net/ethernet/intel/ice/virt/virtchnl.c +86 -0
122 lines not on this page · raw message
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice, i40e: add extended generic VF capability flags
Quoted 64 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Tuesday, April 28, 2026 4:37 PM
To: [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Marcin Szycik <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice,
i40e: add extended generic VF capability flagsVF capability flags in struct
virtchnl_vf_resource::vf_cap_flagshave all been used up, preventing new flags from being added. Note that despite not all bits being defined here, they are used by out-of-tree releases of Intel drivers, therefore cannot be taken.virtchnl message size and structure must remain unchanged to not break reverse compatibility, therefore the existing virtchnl structure cannot be extended with additional fields (e.g. flags2).
vf_cap_flagstype cannot be changed to a larger one for the same reason.Bit 2 of
vf_cap_flagswas reserved for exactly this case. Its presence in message initially sent from VF shall now signal that there are more capability flags to be parsed. If the PF driver acknowledges that viaVIRTCHNL_OP_GET_VF_RESOURCESresponse, the VF will send a separate
message:VIRTCHNL_OP_GET_VF_CAPS2, containing more capability flags.
Note: this mechanism is similar forVIRTCHNL_OP_1588_PTP_GET_CAPS.The new message supports flexible size, so more flags can be added without any architectural changes. Care was taken to ensure that no out-of-bounds reads happen in case the bitmap is shorter in one of the drivers.
The new message includes the original 32 bits too, for consistency and more straightforward parsing.
Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 19 ++- .../net/ethernet/intel/ice/virt/virtchnl.h | 2 + include/linux/intel/virtchnl.h | 55 ++++++- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 84 +++++++++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 60 ++++++++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 138 +++++++++++++++++- .../net/ethernet/intel/ice/virt/allowlist.c | 6 + .../net/ethernet/intel/ice/virt/virtchnl.c | 86 +++++++++++ 8 files changed, 444 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/iavf/iavf.h +0
-0@@ -343,6 +343,7 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS BIT_ULL(42)#define IAVF_FLAG_AQ_GET_PTP_CAPS BIT_ULL(43)#define IAVF_FLAG_AQ_SEND_PTP_CMD BIT_ULL(44)
...
Quoted 6 lines
drivers/net/ethernet/intel/iavf/iavf.h +0
-0case VIRTCHNL_OP_UNKNOWN :default : dev_err(dev, "Unsupported opcode %d from VF %d\n",
v_opcode,
--
2.49.0
Romanowski, Rafal
Tested-byRE: [Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice, i40e: add extended generic VF capability flags
Quoted 79 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Loktionov, Aleksandr
Sent: Wednesday, April 29, 2026 11:21 AM
To: Marcin Szycik <[email protected]>; intel-wired- [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice, i40e: add extended generic VF capability flagsQuoted 62 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Tuesday, April 28, 2026 4:37 PM
To: [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Marcin Szycik <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 3/3] virtchnl, iavf, ice,
i40e: add extended generic VF capability flagsVF capability flags in struct
virtchnl_vf_resource::vf_cap_flagshave all been used up, preventing new flags from being added. Note that despite not all bits being defined here, they are used by out-of-tree releases of Intel drivers, therefore cannot be taken.virtchnl message size and structure must remain unchanged to not break reverse compatibility, therefore the existing virtchnl structure cannot be extended with additional fields (e.g. flags2).
vf_cap_flagstype cannot be changed to a larger one for the same reason.Bit 2 of
vf_cap_flagswas reserved for exactly this case. Its presence in message initially sent from VF shall now signal that there are more capability flags to be parsed. If the PF driver acknowledges that viaVIRTCHNL_OP_GET_VF_RESOURCESresponse, the VF will send a separate
message:VIRTCHNL_OP_GET_VF_CAPS2, containing more capability flags.
Note: this mechanism is similar forVIRTCHNL_OP_1588_PTP_GET_CAPS.The new message supports flexible size, so more flags can be added without any architectural changes. Care was taken to ensure that no out-of-bounds reads happen in case the bitmap is shorter in one of the drivers.
The new message includes the original 32 bits too, for consistency and more straightforward parsing.
Signed-off-by Marcin Szycik <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 19 ++- .../net/ethernet/intel/ice/virt/virtchnl.h | 2 + include/linux/intel/virtchnl.h | 55 ++++++- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 84 +++++++++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 60 ++++++++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 138 +++++++++++++++++- .../net/ethernet/intel/ice/virt/allowlist.c | 6 + .../net/ethernet/intel/ice/virt/virtchnl.c | 86 +++++++++++ 8 files changed, 444 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/iavf/iavf.h +0
-0@@ -343,6 +343,7 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS BIT_ULL(42)#define IAVF_FLAG_AQ_GET_PTP_CAPS BIT_ULL(43)#define IAVF_FLAG_AQ_SEND_PTP_CMD BIT_ULL(44)...
Quoted 7 lines
Quoted 5 lines
drivers/net/ethernet/intel/iavf/iavf.h +0
-1case VIRTCHNL_OP_UNKNOWN :default : dev_err(dev, "Unsupported opcode %d from VF %d\n", v_opcode, --2.49.0
Reviewed-by Aleksandr Loktionov <[email protected]>
Quoted 47 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Marcin Szycik
Sent: Tuesday, April 28, 2026 4:37 PM
To: [email protected]
Cc: [email protected]; Greenwalt, Paul <[email protected]>; Keller, Jacob E <[email protected]>; Marcin Szycik <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 0/3] virtchnl: add extended VF capability flagsVF capability flags in struct
virtchnl_vf_resource::vf_cap_flagshave all been used up, preventing new flags from being added. Unfortunately, flags size cannot be easily increased, as virtchnl message size and structure must remain unchanged to not break ABI. Instead, add a new virtchnl message to handle passing extended caps. Make it flexible size, so new flags can be freely added in the future, without changing virtchnl interface.Overview:
1: Clean up unused defines that are in the way
2: Do most of the mechanical changes required to store flags in bitmaps 3: Add the new virtchnl messageMarcin Szycik (3):
virtchnl: remove unused defines
virtchnl, iavf, ice, i40e: store VIRTCHNL_VF_* flags in bitmaps virtchnl, iavf, ice, i40e: add extended generic VF capability flags.../ethernet/intel/i40e/i40e_virtchnl_pf.h | 4 +- drivers/net/ethernet/intel/iavf/iavf.h | 68 +++--- .../net/ethernet/intel/iavf/iavf_prototype.h | 3 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 5 +- .../net/ethernet/intel/ice/virt/virtchnl.h | 2 + include/linux/intel/virtchnl.h | 120 ++++++++--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 160 ++++++++++---- drivers/net/ethernet/intel/iavf/iavf_common.c | 7 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 96 +++++++-- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 185 ++++++++++++++--- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 4 +- .../net/ethernet/intel/ice/virt/allowlist.c | 11 +- drivers/net/ethernet/intel/ice/virt/fdir.c | 2 +- drivers/net/ethernet/intel/ice/virt/queues.c | 13 +- drivers/net/ethernet/intel/ice/virt/rss.c | 4 +- .../net/ethernet/intel/ice/virt/virtchnl.c | 195 +++++++++++++----- 17 files changed, 667 insertions(+), 214 deletions(-)
Quoted 2 lines
--
2.49.0