one by one port representors creation
Subsystems (3)
cover one by one port representors creation
Hi,
Currently ice supports creating port representors only for VFs. For that use case they can be created and removed in one step.
This patchset is refactoring current flow to support port representor creation also for subfunctions and SIOV. In this case port representors need to be createad and removed one by one. Also, they can be added and removed while other port representors are running.
To achieve that we need to change the switchdev configuration flow. Three first patches are only cosmetic (renaming, removing not used code). Next few ones are preparation for new flow. The most important one is "add VF representor one by one". It fully implements new flow.
New type of port representor (for subfunction) will be introduced in follow up patchset.
Michal Swiatkowski (15):
ice: rename switchdev to eswitch
ice: remove redundant max_vsi_num variable
ice: remove unused control VSI parameter
ice: track q_id in representor
ice: use repr instead of vf->repr
ice: track port representors in xarray
ice: remove VF pointer reference in eswitch code
ice: make representor code generic
ice: return pointer to representor
ice: allow changing SWITCHDEV_CTRL VSI queues
ice: set Tx topology every time new repr is added
ice: realloc VSI stats arrays
ice: add VF representors one by one
ice: adjust switchdev rebuild path
ice: reserve number of CP queues
drivers/net/ethernet/intel/ice/ice.h | 13 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 + drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 562 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 22 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 22 +- drivers/net/ethernet/intel/ice/ice_lib.c | 81 ++- drivers/net/ethernet/intel/ice/ice_main.c | 6 +- drivers/net/ethernet/intel/ice/ice_repr.c | 195 +++--- drivers/net/ethernet/intel/ice/ice_repr.h | 9 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 20 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 14 files changed, 553 insertions(+), 422 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/15 ice: rename switchdev to eswitch
Eswitch is used as a prefix for related functions. Main structure storing all data related to eswitch should also be named as eswitch instead of ice_switchdev_info. Rename it.
Also rename switchdev to eswitch where the context is not about eswitch mode.
::uplink_netdev was changed to netdev for simplicity. There is no other netdev in function scope so it is obvious.
--- drivers/net/ethernet/intel/ice/ice.h | 6 +- drivers/net/ethernet/intel/ice/ice_eswitch.c | 63 ++++++++++--------- .../net/ethernet/intel/ice/ice_eswitch_br.c | 12 ++-- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- 4 files changed, 43 insertions(+), 42 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -3
@@ -522,7 +522,7 @@ enum ice_misc_thread_tasks {ICE_MISC_THREAD_NBITS /* must be last */ }; -struct ice_switchdev_info { +struct ice_eswitch {struct ice_vsi *control_vsi;struct ice_vsi *uplink_vsi;struct ice_esw_br_offloads *br_offloads;
@@ -637,7 +637,7 @@ struct ice_pf {struct ice_link_default_override_tlv link_dflt_override;struct ice_lag *lag;/* Link Aggregation information */ -struct ice_switchdev_info switchdev; +struct ice_eswitch eswitch;struct ice_esw_br_port *br_port;#define ICE_INVALID_AGG_NODE_ID 0
@@ -846,7 +846,7 @@ static inline struct ice_vsi *ice_find_vsi(struct ice_pf *pf, u16 vsi_num)*/ static inline bool ice_is_switchdev_running (struct ice_pf *pf) { -return pf->switchdev.is_running; +return pf->eswitch.is_running; }#define ICE_FD_STAT_CTR_BLOCK_COUNT 256
drivers/net/ethernet/intel/ice/ice_eswitch.c +32 -31
188 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_eswitch_br.c +6 -6
@@ -947,7 +947,7 @@ ice_eswitch_br_vf_repr_port_init(struct ice_esw_br *bridge,static int ice_eswitch_br_uplink_port_init (struct ice_esw_br *bridge,struct ice_pf *pf) { -struct ice_vsi *vsi = pf->switchdev.uplink_vsi; +struct ice_vsi *vsi = pf->eswitch.uplink_vsi;struct ice_esw_br_port *br_port;int err;
@@ -1185,7 +1185,7 @@ ice_eswitch_br_port_event(struct notifier_block *nb,static void ice_eswitch_br_offloads_dealloc (struct ice_pf *pf) { -struct ice_esw_br_offloads *br_offloads = pf->switchdev.br_offloads; +struct ice_esw_br_offloads *br_offloads = pf->eswitch.br_offloads;ASSERT_RTNL ();
@@ -1194,7 +1194,7 @@ ice_eswitch_br_offloads_dealloc(struct ice_pf *pf)ice_eswitch_br_deinit (br_offloads, br_offloads->bridge); - pf->switchdev.br_offloads =NULL ; + pf->eswitch.br_offloads =NULL ;kfree (br_offloads); }
@@ -1205,14 +1205,14 @@ ice_eswitch_br_offloads_alloc(struct ice_pf *pf)ASSERT_RTNL (); -if (pf->switchdev.br_offloads) +if (pf->eswitch.br_offloads)return ERR_PTR (-EEXIST ); br_offloads =kzalloc (sizeof (*br_offloads),GFP_KERNEL );if (!br_offloads)return ERR_PTR (-ENOMEM ); - pf->switchdev.br_offloads = br_offloads; + pf->eswitch.br_offloads = br_offloads; br_offloads->pf = pf;return br_offloads;
@@ -1223,7 +1223,7 @@ ice_eswitch_br_offloads_deinit(struct ice_pf *pf) {struct ice_esw_br_offloads *br_offloads; - br_offloads = pf->switchdev.br_offloads; + br_offloads = pf->eswitch.br_offloads;if (!br_offloads)return ;
drivers/net/ethernet/intel/ice/ice_tc_lib.c +2 -2
@@ -653,7 +653,7 @@ static int ice_tc_setup_redirect_action(struct net_device *filter_dev, ice_tc_is_dev_uplink(target_dev)) { repr =ice_netdev_to_repr (filter_dev); - fltr->dest_vsi = repr->src_vsi->back->switchdev.uplink_vsi; + fltr->dest_vsi = repr->src_vsi->back->eswitch.uplink_vsi; fltr->direction =ICE_ESWITCH_FLTR_EGRESS ; } else if (ice_tc_is_dev_uplink(filter_dev) &&ice_is_port_repr_netdev (target_dev )) {
@@ -743,7 +743,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) rule_info.sw_act.src = hw->pf_id; rule_info.flags_info.act =ICE_SINGLE_ACT_LB_ENABLE ; }else if (fltr->direction ==ICE_ESWITCH_FLTR_EGRESS && - fltr->dest_vsi == vsi->back->switchdev.uplink_vsi) { + fltr->dest_vsi == vsi->back->eswitch.uplink_vsi) {/* VF to Uplink */ rule_info.sw_act.flag |=ICE_FLTR_TX ; rule_info.sw_act.src = vsi->idx;
Signature · 1 line
2.41.0
PATCH 2/15 ice: remove redundant max_vsi_num variable
In reply to Michal SwiatkowskiIt is a leftover from previous implementation. Accidentally it wasn't removed. Do it now.
Commit that has removed it:
commit c1e5da5dd465 ("ice: improve switchdev's slow-path")
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +0 -4
@@ -224,7 +224,6 @@ ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)static int ice_eswitch_setup_reprs (struct ice_pf *pf) {struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; -int max_vsi_num =0 ;struct ice_vf *vf;unsigned int bkt;
@@ -267,9 +266,6 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf) goto err; } -if (max_vsi_num < vsi->vsi_num) - max_vsi_num = vsi->vsi_num; -netif_napi_add (vf->repr->netdev, &vf->repr->q_vector->napi, ice_napi_poll);
Signature · 1 line
2.41.0
PATCH 3/15 ice: remove unused control VSI parameter
In reply to Michal SwiatkowskiIt isn't used in ice_eswitch_release_reprs(). Probably leftover. Remove it.
Commit that has removed usage of ctrl_vsi:
commit c1e5da5dd465 ("ice: improve switchdev's slow-path")
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +3 -4
@@ -189,10 +189,9 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf)/** * ice_eswitch_release_reprs - clear PR VSIs configuration * @pf: poiner to PF struct -* @ctrl_vsi: pointer to eswitch control VSI */ static void -ice_eswitch_release_reprs (struct ice_pf *pf,struct ice_vsi *ctrl_vsi) +ice_eswitch_release_reprs (struct ice_pf *pf) {struct ice_vf *vf;unsigned int bkt;
@@ -286,7 +285,7 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)return 0 ; err: -ice_eswitch_release_reprs (pf, ctrl_vsi); +ice_eswitch_release_reprs (pf);return -ENODEV ; }
@@ -532,7 +531,7 @@ static void ice_eswitch_disable_switchdev(struct ice_pf *pf)ice_eswitch_napi_disable (pf);ice_eswitch_br_offloads_deinit (pf);ice_eswitch_release_env (pf); -ice_eswitch_release_reprs (pf, ctrl_vsi); +ice_eswitch_release_reprs (pf);ice_vsi_release (ctrl_vsi);ice_repr_rem_from_all_vfs (pf); }
Signature · 1 line
2.41.0
PATCH 4/15 ice: track q_id in representor
In reply to Michal SwiatkowskiPreviously queue index of control plane VSI used by port representor was always id of VF. If we want to allow adding port representors for different devices we have to track queue index in the port representor structure.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 2 +- drivers/net/ethernet/intel/ice/ice_repr.c | 1 + drivers/net/ethernet/intel/ice/ice_repr.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +1 -1
@@ -38,7 +38,7 @@ ice_eswitch_add_vf_sp_rule(struct ice_pf *pf, struct ice_vf *vf) rule_info.sw_act.vsi_handle = ctrl_vsi->idx; rule_info.sw_act.fltr_act =ICE_FWD_TO_Q ; rule_info.sw_act.fwd_id.q_id = hw->func_caps.common_cap.rxq_first_id + - ctrl_vsi->rxq_map[vf->vf_id]; + ctrl_vsi->rxq_map[vf->repr->q_id]; rule_info.flags_info.act |=ICE_SINGLE_ACT_LB_ENABLE ; rule_info.flags_info.act_valid = true; rule_info.tun_type =ICE_SW_TUN_AND_NON_TUN ;
drivers/net/ethernet/intel/ice/ice_repr.c +1 -0
@@ -306,6 +306,7 @@ static int ice_repr_add(struct ice_vf *vf) repr->src_vsi = vsi; repr->vf = vf; + repr->q_id = vf->vf_id; vf->repr = repr; np =netdev_priv (repr->netdev); np->repr = repr;
drivers/net/ethernet/intel/ice/ice_repr.h +1 -0
@@ -13,6 +13,7 @@ struct ice_repr {struct net_device *netdev;struct metadata_dst *dst;struct ice_esw_br_port *br_port; +int q_id;#ifdef CONFIG_ICE_SWITCHDEV /* info about slow path rule */ struct ice_rule_query_data sp_rule;
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 04/15] ice: track q_id in representor
Quoted 22 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 04/15] ice: trackq_idin representorPreviously queue index of control plane VSI used by port representor was always id of VF. If we want to allow adding port representors for different devices we have to track queue index in the port representor structure.
Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 6 lines
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 2 +- drivers/net/ethernet/intel/ice/ice_repr.c | 1 + drivers/net/ethernet/intel/ice/ice_repr.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
PATCH 5/15 ice: use repr instead of vf->repr
In reply to Michal SwiatkowskiExtract repr from vf->repr as it is often use in the ice_repr_rem().
Remove meaningless clearing of q_vector and netdev pointers as kfree is called on repr pointer.
--- drivers/net/ethernet/intel/ice/ice_repr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_repr.c +7 -7
@@ -355,16 +355,16 @@ static int ice_repr_add(struct ice_vf *vf)*/ static void ice_repr_rem (struct ice_vf *vf) { -if (!vf->repr) +struct ice_repr *repr = vf->repr; + +if (!repr)return ; -kfree (vf->repr->q_vector); - vf->repr->q_vector =NULL ; -unregister_netdev (vf->repr->netdev); +kfree (repr->q_vector); +unregister_netdev (repr->netdev);ice_devlink_destroy_vf_port (vf); -free_netdev (vf->repr->netdev); - vf->repr->netdev =NULL ; -kfree (vf->repr); +free_netdev (repr->netdev); +kfree (repr); vf->repr =NULL ;ice_virtchnl_set_dflt_ops (vf);
Signature · 1 line
2.41.0
PATCH 6/15 ice: track port representors in xarray
In reply to Michal SwiatkowskiInstead of assuming that each VF has pointer to port representor save it in xarray. It will allow adding port representor for other device types.
Drop reference to VF where it is use only to get port representor. Get it from xarray instead.
The functions will no longer by specific for VF, rename them.
Track id assigned by xarray in port representor structure. The id can't be used as ::q_id, because it is fixed during port representor lifetime. ::q_id can change after adding / removing other port representors.
Side effect of removing VF pointer is that we are losing VF MAC information used in unrolling. Store it in port representor as parent MAC.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 182 +++++++++---------- drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_repr.c | 8 + drivers/net/ethernet/intel/ice/ice_repr.h | 2 + 5 files changed, 94 insertions(+), 101 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -526,6 +526,7 @@ struct ice_eswitch {struct ice_vsi *control_vsi;struct ice_vsi *uplink_vsi;struct ice_esw_br_offloads *br_offloads; +struct xarray reprs;bool is_running; };
drivers/net/ethernet/intel/ice/ice_eswitch.c +81 -101
344 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -4702,6 +4702,8 @@ static void ice_deinit_features(struct ice_pf *pf)ice_ptp_release (pf);if (test_bit (ICE_FLAG_DPLL , pf->flags))ice_dpll_deinit (pf); +if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ) +xa_destroy (&pf->eswitch.reprs); }static void ice_init_wakeup (struct ice_pf *pf)
drivers/net/ethernet/intel/ice/ice_repr.c +8 -0
@@ -318,6 +318,11 @@ static int ice_repr_add(struct ice_vf *vf) } repr->q_vector = q_vector; + err =xa_alloc (&vf->pf->eswitch.reprs, &repr->id, repr, + xa_limit_32b,GFP_KERNEL ); +if (err) + goto err_xa_alloc; + err =ice_devlink_create_vf_port (vf);if (err) goto err_devlink;
@@ -338,6 +343,8 @@ static int ice_repr_add(struct ice_vf *vf) err_netdev:ice_devlink_destroy_vf_port (vf); err_devlink: +xa_erase (&vf->pf->eswitch.reprs, repr->id); +err_xa_alloc:kfree (repr->q_vector); vf->repr->q_vector =NULL ; err_alloc_q_vector:
@@ -363,6 +370,7 @@ static void ice_repr_rem(struct ice_vf *vf)kfree (repr->q_vector);unregister_netdev (repr->netdev);ice_devlink_destroy_vf_port (vf); +xa_erase (&vf->pf->eswitch.reprs, repr->id);free_netdev (repr->netdev);kfree (repr); vf->repr =NULL ;
drivers/net/ethernet/intel/ice/ice_repr.h +2 -0
@@ -14,6 +14,8 @@ struct ice_repr {struct metadata_dst *dst;struct ice_esw_br_port *br_port;int q_id; +u32 id; +u8 parent_mac[ETH_ALEN ];#ifdef CONFIG_ICE_SWITCHDEV /* info about slow path rule */ struct ice_rule_query_data sp_rule;
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 06/15] ice: track port representors in xarray
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 06/15] ice: track port representors in xarrayInstead of assuming that each VF has pointer to port representor save it in xarray. It will allow adding port representor for other device types.
Drop reference to VF where it is use only to get port representor. Get it from xarray instead.
The functions will no longer by specific for VF, rename them.
Track id assigned by xarray in port representor structure. The id can't be used as ::q_id, because it is fixed during port representor lifetime. ::q_id can change after adding / removing other port representors.
Side effect of removing VF pointer is that we are losing VF MAC information used in unrolling. Store it in port representor as parent MAC.
Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 182 +++++++++---------- drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_repr.c | 8 + drivers/net/ethernet/intel/ice/ice_repr.h | 2 + 5 files changed, 94 insertions(+), 101 deletions(-)
PATCH 7/15 ice: remove VF pointer reference in eswitch code
In reply to Michal SwiatkowskiMake eswitch code generic by removing VF pointer reference in functions. It is needed to support eswitch mode for other type of devices.
Previously queue id used for Rx was based on VF number. Use ::q_id saved in port representor instead.
After adding or removing port representor ::q_id value can change. It isn't good idea to iterate over representors list using this value. Use xa_find starting from the first one instead to get next port representor to remap.
The number of port representors has to be equal to ::num_rx/tx_q. Warn if it isn't true.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 39 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 5 ++- drivers/net/ethernet/intel/ice/ice_repr.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +20 -19
@@ -47,7 +47,8 @@ ice_eswitch_add_sp_rule(struct ice_pf *pf, struct ice_repr *repr) err =ice_add_adv_rule (hw, list, lkups_cnt, &rule_info, &repr->sp_rule);if (err) -dev_err (ice_pf_to_dev (pf),"Unable to add slow-path rule in switchdev mode" ); +dev_err (ice_pf_to_dev (pf),"Unable to add slow-path rule for eswitch for PR %d" , + repr->id);kfree (list);return err;
@@ -142,6 +143,7 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)static void ice_eswitch_remap_rings_to_vectors (struct ice_pf *pf) {struct ice_vsi *vsi = pf->eswitch.control_vsi; +unsigned long repr_id =0 ;int q_id;ice_for_each_txq (vsi, q_id) {
@@ -149,13 +151,14 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf)struct ice_tx_ring *tx_ring;struct ice_rx_ring *rx_ring;struct ice_repr *repr; -struct ice_vf *vf; - vf =ice_get_vf_by_id (pf, q_id); -if (WARN_ON (!vf)) -continue ; + repr =xa_find (&pf->eswitch.reprs, &repr_id,U32_MAX , +XA_PRESENT ); +if (WARN_ON (!repr)) +break ; - repr = vf->repr; + repr_id +=1 ; + repr->q_id = q_id; q_vector = repr->q_vector; tx_ring = vsi->tx_rings[q_id]; rx_ring = vsi->rx_rings[q_id];
@@ -178,8 +181,6 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) rx_ring->q_vector = q_vector; rx_ring->next =NULL ; rx_ring->netdev = repr->netdev; - -ice_put_vf (vf); } }
@@ -284,20 +285,17 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)/** * ice_eswitch_update_repr - reconfigure port representor -* @vsi: VF VSI for which port representor is configured +* @repr: pointer to repr struct +* @vsi: VSI for which port representor is configured */ -void ice_eswitch_update_repr (struct ice_vsi *vsi) +void ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi) {struct ice_pf *pf = vsi->back; -struct ice_repr *repr; -struct ice_vf *vf;int ret;if (!ice_is_switchdev_running (pf))return ; - vf = vsi->vf; - repr = vf->repr; repr->src_vsi = vsi; repr->dst->u.port_info.port_id = vsi->vsi_num;
@@ -306,9 +304,10 @@ void ice_eswitch_update_repr(struct ice_vsi *vsi) ret =ice_vsi_update_security (vsi, ice_vsi_ctx_clear_antispoof);if (ret) { -ice_fltr_add_mac_and_broadcast (vsi, vf->hw_lan_addr,ICE_FWD_TO_VSI ); -dev_err (ice_pf_to_dev (pf),"Failed to update VF %d port representor" , - vsi->vf->vf_id); +ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, +ICE_FWD_TO_VSI ); +dev_err (ice_pf_to_dev (pf),"Failed to update VSI of port representor %d" , + repr->id); } }
@@ -340,7 +339,7 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)skb_dst_drop (skb);dst_hold ((struct dst_entry *)repr->dst);skb_dst_set (skb, (struct dst_entry *)repr->dst); - skb->queue_mapping = repr->vf->vf_id; + skb->queue_mapping = repr->q_id;return ice_start_xmit (skb, netdev); }
@@ -486,7 +485,7 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)ice_eswitch_remap_rings_to_vectors (pf);if (ice_vsi_open (ctrl_vsi)) - goto err_setup_reprs; + goto err_vsi_open;if (ice_eswitch_br_offloads_init (pf)) goto err_br_offloads;
@@ -497,6 +496,8 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf) err_br_offloads:ice_vsi_close (ctrl_vsi); +err_vsi_open: +ice_eswitch_release_reprs (pf); err_setup_reprs:ice_repr_rem_from_all_vfs (pf); err_repr_add:
drivers/net/ethernet/intel/ice/ice_eswitch.h +3 -2
@@ -17,7 +17,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode, struct netlink_ext_ack *extack);bool ice_is_eswitch_mode_switchdev (struct ice_pf *pf); -void ice_eswitch_update_repr (struct ice_vsi *vsi); +void ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi);void ice_eswitch_stop_all_tx_queues (struct ice_pf *pf);
@@ -34,7 +34,8 @@ static inline void ice_eswitch_set_target_vsi(struct sk_buff *skb, struct ice_tx_offload_params *off) { } -static inline void ice_eswitch_update_repr (struct ice_vsi *vsi) { } +static inline void +ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi) { }static inline int ice_eswitch_configure (struct ice_pf *pf) {
drivers/net/ethernet/intel/ice/ice_repr.c +1 -0
@@ -336,6 +336,7 @@ static int ice_repr_add(struct ice_vf *vf)if (err) goto err_netdev; +ether_addr_copy (repr->parent_mac, vf->hw_lan_addr);ice_virtchnl_set_repr_ops (vf);return 0 ;
drivers/net/ethernet/intel/ice/ice_vf_lib.c +1 -1
@@ -928,7 +928,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) goto out_unlock; } -ice_eswitch_update_repr (vsi); +ice_eswitch_update_repr (vf->repr, vsi);/* if the VF has been reset allow it to come up again */ ice_mbx_clear_malvf (&vf->mbx_info);
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 07/15] ice: remove VF pointer reference in eswitch code
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 07/15] ice: remove VF pointer reference in eswitch codeMake eswitch code generic by removing VF pointer reference in functions. It is needed to support eswitch mode for other type of devices.
Previously queue id used for Rx was based on VF number. Use ::q_id saved in port representor instead.
After adding or removing port representor ::q_id value can change. It isn't good idea to iterate over representors list using this value.
Usexa_findstarting from the first one instead to get next port representor to remap.The number of port representors has to be equal to ::num_rx/tx_q. Warn if it isn't true.
Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 7 lines
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 39 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 5 ++- drivers/net/ethernet/intel/ice/ice_repr.c | 1 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-)
PATCH 8/15 ice: make representor code generic
In reply to Michal SwiatkowskiRepresentor code needs to be independent from specific device type, like in this case VF. Make generic add / remove representor function and specific add VF / rem VF function. New device types will follow this scheme.
In bridge offload code there is a need to get representor pointer based on VSI. Implement helper function to achieve that.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 9 +- drivers/net/ethernet/intel/ice/ice_eswitch.h | 4 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 10 +- drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_repr.c | 184 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_repr.h | 2 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 8 files changed, 131 insertions(+), 92 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +7 -2
@@ -285,17 +285,22 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)/** * ice_eswitch_update_repr - reconfigure port representor -* @repr: pointer to repr struct +* @repr_id: representor ID * @vsi: VSI for which port representor is configured */ -void ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi) +void ice_eswitch_update_repr (unsigned long repr_id,struct ice_vsi *vsi) {struct ice_pf *pf = vsi->back; +struct ice_repr *repr;int ret;if (!ice_is_switchdev_running (pf))return ; + repr =xa_load (&pf->eswitch.reprs, repr_id); +if (!repr) +return ; + repr->src_vsi = vsi; repr->dst->u.port_info.port_id = vsi->vsi_num;
drivers/net/ethernet/intel/ice/ice_eswitch.h +2 -2
@@ -17,7 +17,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode, struct netlink_ext_ack *extack);bool ice_is_eswitch_mode_switchdev (struct ice_pf *pf); -void ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi); +void ice_eswitch_update_repr (unsigned long repr_id,struct ice_vsi *vsi);void ice_eswitch_stop_all_tx_queues (struct ice_pf *pf);
@@ -35,7 +35,7 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb, struct ice_tx_offload_params *off) { }static inline void -ice_eswitch_update_repr (struct ice_repr *repr,struct ice_vsi *vsi) { } +ice_eswitch_update_repr (unsigned long repr_id,struct ice_vsi *vsi) { }static inline int ice_eswitch_configure (struct ice_pf *pf) {
drivers/net/ethernet/intel/ice/ice_eswitch_br.c +7 -3
@@ -893,10 +893,14 @@ ice_eswitch_br_port_deinit(struct ice_esw_br *bridge,ice_eswitch_br_fdb_entry_delete (bridge, fdb_entry); } -if (br_port->type ==ICE_ESWITCH_BR_UPLINK_PORT && vsi->back) +if (br_port->type ==ICE_ESWITCH_BR_UPLINK_PORT && vsi->back) { vsi->back->br_port =NULL ; -else if (vsi->vf && vsi->vf->repr) - vsi->vf->repr->br_port =NULL ; + }else { +struct ice_repr *repr =ice_repr_get_by_vsi (vsi); + +if (repr) + repr->br_port =NULL ; + }xa_erase (&bridge->ports, br_port->vsi_idx);ice_eswitch_br_port_vlans_flush (br_port);
drivers/net/ethernet/intel/ice/ice_lib.c +4 -6
@@ -519,16 +519,14 @@ static irqreturn_t ice_eswitch_msix_clean_rings(int __always_unused irq, void *d {struct ice_q_vector *q_vector = (struct ice_q_vector *)data;struct ice_pf *pf = q_vector->vsi->back; -struct ice_vf *vf; -unsigned int bkt; +struct ice_repr *repr; +unsigned long id;if (!q_vector->tx.tx_ring && !q_vector->rx.rx_ring)return IRQ_HANDLED ; -rcu_read_lock (); -ice_for_each_vf_rcu (pf, bkt, vf) -napi_schedule (&vf->repr->q_vector->napi); -rcu_read_unlock (); +xa_for_each (&pf->eswitch.reprs, id, repr) +napi_schedule (&repr->q_vector->napi);return IRQ_HANDLED ; }
drivers/net/ethernet/intel/ice/ice_repr.c +107 -77
255 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_repr.h +2 -0
@@ -32,4 +32,6 @@ void ice_repr_set_traffic_vsi(struct ice_repr *repr, struct ice_vsi *vsi);struct ice_repr *ice_netdev_to_repr (struct net_device *netdev);bool ice_is_port_repr_netdev (const struct net_device *netdev); + +struct ice_repr *ice_repr_get_by_vsi (struct ice_vsi *vsi);#endif
drivers/net/ethernet/intel/ice/ice_vf_lib.c +1 -1
@@ -928,7 +928,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) goto out_unlock; } -ice_eswitch_update_repr (vf->repr, vsi); +ice_eswitch_update_repr (vf->repr_id, vsi);/* if the VF has been reset allow it to come up again */ ice_mbx_clear_malvf (&vf->mbx_info);
drivers/net/ethernet/intel/ice/ice_vf_lib.h +1 -1
@@ -130,7 +130,7 @@ struct ice_vf {struct ice_mdd_vf_events mdd_tx_events;DECLARE_BITMAP (opcodes_allowlist,VIRTCHNL_OP_MAX ); -struct ice_repr *repr; +unsigned long repr_id;const struct ice_virtchnl_ops *virtchnl_ops;const struct ice_vf_ops *vf_ops;
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 08/15] ice: make representor code generic
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 08/15] ice: make representor code genericRepresentor code needs to be independent from specific device type, like in this case VF. Make generic add / remove representor function and specific add VF / rem VF function. New device types will follow this scheme.
In bridge offload code there is a need to get representor pointer based on VSI. Implement helper function to achieve that.
Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 9 +- drivers/net/ethernet/intel/ice/ice_eswitch.h | 4 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 10 +- drivers/net/ethernet/intel/ice/ice_lib.c | 10 +- drivers/net/ethernet/intel/ice/ice_repr.c | 184 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_repr.h | 2 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 8 files changed, 131 insertions(+), 92 deletions(-)
PATCH 9/15 ice: return pointer to representor
In reply to Michal SwiatkowskiIn follow up patches it will be easier to obtain created port representor pointer instead of the id. Without it the pattern from eswitch side will look like:
- create PR
- get PR based on the id
--- drivers/net/ethernet/intel/ice/ice_repr.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_repr.c +10 -7
@@ -382,7 +382,7 @@ ice_repr_add(struct ice_pf *pf, struct ice_vsi *src_vsi, const u8 *parent_mac)return ERR_PTR (err); } -static int ice_repr_add_vf (struct ice_vf *vf) +static struct ice_repr *ice_repr_add_vf (struct ice_vf *vf) {struct ice_repr *repr;struct ice_vsi *vsi;
@@ -390,11 +390,11 @@ static int ice_repr_add_vf(struct ice_vf *vf) vsi =ice_get_vf_vsi (vf);if (!vsi) -return -EINVAL ; +return ERR_PTR (-ENOENT ); err =ice_devlink_create_vf_port (vf);if (err) -return err; +return ERR_PTR (err); repr =ice_repr_add (vf->pf, vsi, vf->hw_lan_addr);if (IS_ERR (repr)) {
@@ -416,13 +416,13 @@ static int ice_repr_add_vf(struct ice_vf *vf)ice_virtchnl_set_repr_ops (vf); -return 0 ; +return repr; err_netdev:ice_repr_rem (&vf->pf->eswitch.reprs, repr); err_repr_add:ice_devlink_destroy_vf_port (vf); -return err; +return ERR_PTR (err); }/**
@@ -432,6 +432,7 @@ static int ice_repr_add_vf(struct ice_vf *vf)int ice_repr_add_for_all_vfs (struct ice_pf *pf) {struct devlink *devlink; +struct ice_repr *repr;struct ice_vf *vf;unsigned int bkt;int err;
@@ -439,9 +440,11 @@ int ice_repr_add_for_all_vfs(struct ice_pf *pf)lockdep_assert_held (&pf->vfs.table_lock);ice_for_each_vf (pf, bkt, vf) { - err =ice_repr_add_vf (vf); -if (err) + repr =ice_repr_add_vf (vf); +if (IS_ERR (repr)) { + err =PTR_ERR (repr); goto err; + } }/* only export if ADQ and DCB disabled */
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 09/15] ice: return pointer to representor
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 09/15] ice: return pointer to representorIn follow up patches it will be easier to obtain created port representor pointer instead of the id. Without it the pattern from eswitch side will look like:
- create PR
- get PR based on the id
Quoted 8 lines
Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_repr.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
RE: [Intel-wired-lan] [PATCH iwl-next v1 09/15] ice: return pointer to representor
In reply to Michal SwiatkowskiQuoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 09/15] ice: return pointer to representorIn follow up patches it will be easier to obtain created port representor pointer instead of the id. Without it the pattern from eswitch side will look like:
- create PR
- get PR based on the id
Quoted 8 lines
Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_repr.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
PATCH 10/15 ice: allow changing SWITCHDEV_CTRL VSI queues
In reply to Michal SwiatkowskiImplement mechanism to change number of queues for SWITCHDEV_CTRL VSI type.
Value from ::req_txq/rxq will be written to ::alloc_txq/rxq after calling ice_vsi_rebuild().
--- drivers/net/ethernet/intel/ice/ice_lib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +10 -3
@@ -212,11 +212,18 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi) vsi->alloc_txq));break ;case ICE_VSI_SWITCHDEV_CTRL : -/* The number of queues for ctrl VSI is equal to number of VFs. +/* The number of queues for ctrl VSI is equal to number of PRs * Each ring is associated to the corresponding VF_PR netdev. +* Tx and Rx rings are always equal */ - vsi->alloc_txq =ice_get_num_vfs (pf); - vsi->alloc_rxq = vsi->alloc_txq; +if (vsi->req_txq && vsi->req_rxq) { + vsi->alloc_txq = vsi->req_txq; + vsi->alloc_rxq = vsi->req_rxq; + }else { + vsi->alloc_txq =1 ; + vsi->alloc_rxq =1 ; + } + vsi->num_q_vectors =1 ;break ;case ICE_VSI_VF :
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 10/15] ice: allow changing SWITCHDEV_CTRL VSI queues
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 10/15] ice: allow changingSWITCHDEV_CTRLVSI queuesImplement mechanism to change number of queues for
SWITCHDEV_CTRLVSI type.Value from ::req_txq/rxq will be written to ::alloc_txq/rxq after calling
ice_vsi_rebuild().
Quoted 8 lines
Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
PATCH 11/15 ice: set Tx topology every time new repr is added
In reply to Michal SwiatkowskiIt is needed to track correct Tx topology. Update it every time new representor is created or remove node in case of removing corresponding representor.
Still clear all node when removing switchdev mode as part of Tx topology isn't related only to representors. Also clear ::rate_note value to prevent skipping this node next time Tx topology is created.
--- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 9 ++++++ drivers/net/ethernet/intel/ice/ice_repr.c | 27 +++++++++++++----- 4 files changed, 59 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_devlink.c +29 -0
@@ -810,6 +810,10 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_nodestruct ice_vf *vf;int i; +if (node->rate_node) +/* already added, skip to the next */ + goto traverse_children; +if (node->parent == tc_node) {/* create root node */ rate_node =devl_rate_node_create (devlink, node, node->name,NULL );
@@ -831,6 +835,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_nodeif (rate_node && !IS_ERR (rate_node)) node->rate_node = rate_node; +traverse_children:for (i =0 ; i < node->num_children; i++)ice_traverse_tx_tree (devlink, node->children[i], tc_node, pf); }
@@ -861,6 +866,30 @@ int ice_devlink_rate_init_tx_topology(struct devlink *devlink, struct ice_vsi *vreturn 0 ; } +static void ice_clear_rate_nodes (struct ice_sched_node *node) +{ + node->rate_node =NULL ; + +for (int i =0 ; i < node->num_children; i++) +ice_clear_rate_nodes (node->children[i]); +} + +/** +* ice_devlink_rate_clear_tx_topology - clear node->rate_node +* @vsi: main vsi struct +* +* Clear rate_node to cleanup creation of Tx topology. +* +*/ +void ice_devlink_rate_clear_tx_topology (struct ice_vsi *vsi) +{ +struct ice_port_info *pi = vsi->port_info; + +mutex_lock (&pi->sched_lock); +ice_clear_rate_nodes (pi->root->children[0 ]); +mutex_unlock (&pi->sched_lock); +} +/** * ice_set_object_tx_share - sets node scheduling parameter * @pi: devlink struct instance
drivers/net/ethernet/intel/ice/ice_devlink.h +1 -0
@@ -20,5 +20,6 @@ void ice_devlink_destroy_regions(struct ice_pf *pf);int ice_devlink_rate_init_tx_topology (struct devlink *devlink,struct ice_vsi *vsi);void ice_tear_down_devlink_rate_tree (struct ice_pf *pf); +void ice_devlink_rate_clear_tx_topology (struct ice_vsi *vsi);#endif /* _ICE_DEVLINK_H_ */
drivers/net/ethernet/intel/ice/ice_eswitch.c +9 -0
@@ -519,6 +519,7 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)static void ice_eswitch_disable_switchdev (struct ice_pf *pf) {struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; +struct devlink *devlink =priv_to_devlink (pf);ice_eswitch_napi_disable (&pf->eswitch.reprs);ice_eswitch_br_offloads_deinit (pf);
@@ -526,6 +527,14 @@ static void ice_eswitch_disable_switchdev(struct ice_pf *pf)ice_eswitch_release_reprs (pf);ice_vsi_release (ctrl_vsi);ice_repr_rem_from_all_vfs (pf); + +/* since all port representors are destroyed, there is +* no point in keeping the nodes +*/ +ice_devlink_rate_clear_tx_topology (ice_get_main_vsi (pf)); +devl_lock (devlink); +devl_rate_nodes_destroy (devlink); +devl_unlock (devlink); }/**
drivers/net/ethernet/intel/ice/ice_repr.c +20 -7
@@ -278,6 +278,13 @@ ice_repr_reg_netdev(struct net_device *netdev)return register_netdev (netdev); } +static void ice_repr_remove_node (struct devlink_port *devlink_port) +{ +devl_lock (devlink_port->devlink); +devl_rate_leaf_destroy (devlink_port); +devl_unlock (devlink_port->devlink); +} +/** * ice_repr_rem - remove representor from VF * @reprs: xarray storing representors
@@ -298,6 +305,7 @@ static void ice_repr_rem_vf(struct ice_vf *vf)if (!repr)return ; +ice_repr_remove_node (&repr->vf->devlink_port);unregister_netdev (repr->netdev);ice_repr_rem (&vf->pf->eswitch.reprs, repr);ice_devlink_destroy_vf_port (vf);
@@ -310,7 +318,6 @@ static void ice_repr_rem_vf(struct ice_vf *vf)*/ void ice_repr_rem_from_all_vfs (struct ice_pf *pf) { -struct devlink *devlink;struct ice_vf *vf;unsigned int bkt;
@@ -318,14 +325,19 @@ void ice_repr_rem_from_all_vfs(struct ice_pf *pf)ice_for_each_vf (pf, bkt, vf)ice_repr_rem_vf (vf); +} + +static void ice_repr_set_tx_topology (struct ice_pf *pf) +{ +struct devlink *devlink; + +/* only export if ADQ and DCB disabled and eswitch enabled*/ +if (ice_is_adq_active (pf) ||ice_is_dcb_active (pf) || + !ice_is_switchdev_running (pf)) +return ; -/* since all port representors are destroyed, there is -* no point in keeping the nodes -*/ devlink =priv_to_devlink (pf); -devl_lock (devlink); -devl_rate_nodes_destroy (devlink); -devl_unlock (devlink); +ice_devlink_rate_init_tx_topology (devlink,ice_get_main_vsi (pf)); }/**
@@ -415,6 +427,7 @@ static struct ice_repr *ice_repr_add_vf(struct ice_vf *vf) goto err_netdev;ice_virtchnl_set_repr_ops (vf); +ice_repr_set_tx_topology (vf->pf);return repr;
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 11/15] ice: set Tx topology every time new repr is added
Quoted 26 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 11/15] ice: set Tx topology every time new repr is addedIt is needed to track correct Tx topology. Update it every time new representor is created or remove node in case of removing corresponding representor.
Still clear all node when removing switchdev mode as part of Tx topology isn't related only to representors. Also clear ::rate_note value to prevent skipping this node next time Tx topology is created.
Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 7 lines
--- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 9 ++++++ drivers/net/ethernet/intel/ice/ice_repr.c | 27 +++++++++++++----- 4 files changed, 59 insertions(+), 7 deletions(-)
PATCH 12/15 ice: realloc VSI stats arrays
In reply to Michal SwiatkowskiPreviously only case when queues amount is lower was covered. Implement realloc for case when queues amount is higher than previous one. Use krealloc() function and zero new allocated elements.
It has to be done before ice_vsi_def_cfg(), because stats element for ring is set there.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 58 ++++++++++++++++-------- 1 file changed, 39 insertions(+), 19 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +39 -19
@@ -3076,27 +3076,26 @@ ice_vsi_rebuild_set_coalesce(struct ice_vsi *vsi, }/** -* ice_vsi_realloc_stat_arrays - Frees unused stat structures +* ice_vsi_realloc_stat_arrays - Frees unused stat structures or alloc new ones * @vsi: VSI pointer -* @prev_txq: Number of Tx rings before ring reallocation -* @prev_rxq: Number of Rx rings before ring reallocation */ -static void -ice_vsi_realloc_stat_arrays (struct ice_vsi *vsi,int prev_txq,int prev_rxq) +static int +ice_vsi_realloc_stat_arrays (struct ice_vsi *vsi) { +u16 req_txq = vsi->req_txq ? vsi->req_txq : vsi->alloc_txq; +u16 req_rxq = vsi->req_rxq ? vsi->req_rxq : vsi->alloc_rxq; +struct ice_ring_stats **tx_ring_stats; +struct ice_ring_stats **rx_ring_stats;struct ice_vsi_stats *vsi_stat;struct ice_pf *pf = vsi->back; +u16 prev_txq = vsi->alloc_txq; +u16 prev_rxq = vsi->alloc_rxq;int i; -if (!prev_txq || !prev_rxq) -return ; -if (vsi->type ==ICE_VSI_CHNL ) -return ; - vsi_stat = pf->vsi_stats[vsi->idx]; -if (vsi->num_txq < prev_txq) { -for (i = vsi->num_txq; i < prev_txq; i++) { +if (req_txq < prev_txq) { +for (i = req_txq; i < prev_txq; i++) {if (vsi_stat->tx_ring_stats[i]) {kfree_rcu (vsi_stat->tx_ring_stats[i], rcu);WRITE_ONCE (vsi_stat->tx_ring_stats[i],NULL );
@@ -3104,14 +3103,36 @@ ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi, int prev_txq, int prev_rxq) } } -if (vsi->num_rxq < prev_rxq) { -for (i = vsi->num_rxq; i < prev_rxq; i++) { + tx_ring_stats = vsi_stat->rx_ring_stats; + vsi_stat->tx_ring_stats = +krealloc_array (vsi_stat->tx_ring_stats, req_txq, +sizeof (*vsi_stat->tx_ring_stats), +GFP_KERNEL | __GFP_ZERO); +if (!vsi_stat->tx_ring_stats) { + vsi_stat->tx_ring_stats = tx_ring_stats; +return -ENOMEM ; + } + +if (req_rxq < prev_rxq) { +for (i = req_rxq; i < prev_rxq; i++) {if (vsi_stat->rx_ring_stats[i]) {kfree_rcu (vsi_stat->rx_ring_stats[i], rcu);WRITE_ONCE (vsi_stat->rx_ring_stats[i],NULL ); } } } + + rx_ring_stats = vsi_stat->rx_ring_stats; + vsi_stat->rx_ring_stats = +krealloc_array (vsi_stat->rx_ring_stats, req_rxq, +sizeof (*vsi_stat->rx_ring_stats), +GFP_KERNEL | __GFP_ZERO); +if (!vsi_stat->rx_ring_stats) { + vsi_stat->rx_ring_stats = rx_ring_stats; +return -ENOMEM ; + } + +return 0 ; }/**
@@ -3128,9 +3149,9 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) {struct ice_vsi_cfg_params params = {};struct ice_coalesce_stored *coalesce; -int ret, prev_txq, prev_rxq;int prev_num_q_vectors =0 ;struct ice_pf *pf; +int ret;if (!vsi)return -EINVAL ;
@@ -3149,8 +3170,9 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) prev_num_q_vectors =ice_vsi_rebuild_get_coalesce (vsi, coalesce); - prev_txq = vsi->num_txq; - prev_rxq = vsi->num_rxq; + ret =ice_vsi_realloc_stat_arrays (vsi); +if (ret) + goto err_vsi_cfg;ice_vsi_decfg (vsi); ret =ice_vsi_cfg_def (vsi, ¶ms);
@@ -3168,8 +3190,6 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)return ice_schedule_reset (pf,ICE_RESET_PFR ); } -ice_vsi_realloc_stat_arrays (vsi, prev_txq, prev_rxq); -ice_vsi_rebuild_set_coalesce (vsi, coalesce, prev_num_q_vectors);kfree (coalesce);
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 12/15] ice: realloc VSI stats arrays
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 12/15] ice: realloc VSI stats arraysPreviously only case when queues amount is lower was covered. Implement realloc for case when queues amount is higher than previous one. Use
krealloc()function and zero new allocated elements.
Quoted 9 lines
It has to be done before
ice_vsi_def_cfg(), because stats element for ring is set there.Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 58 ++++++++++++++++-------- 1 file changed, 39 insertions(+), 19 deletions(-)
PATCH 13/15 ice: add VF representors one by one
In reply to Michal SwiatkowskiImplement adding representors one by one. Always set switchdev environment when first representor is being added and clear environment when last one is being removed.
Basic switchdev configuration remains the same. Code related to creating and configuring representor was changed.
Instead of setting whole representors in one function handle only one representor in setup function. The same with removing representors.
Stop representors when new one is being added or removed. Stop means, disabling napi, stopping traffic and removing slow path rule. It is needed because ::q_id will change after remapping, so each representor will need new rule.
When representor are stopped rebuild control plane VSI with one more or one less queue. One more if new representor is being added, one less if representor is being removed.
Bridge port is removed during unregister_netdev() call on PR, so there is no need to call it from driver side.
After that do remap new queues to correct vector. At the end start all representors (napi enable, start queues, add slow path rule).
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 351 +++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 13 +- drivers/net/ethernet/intel/ice/ice_repr.c | 85 +---- drivers/net/ethernet/intel/ice/ice_repr.h | 4 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 17 +- 5 files changed, 228 insertions(+), 242 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +196 -155
@@ -10,6 +10,24 @@#include "ice_devlink.h" #include "ice_tc_lib.h" +/** +* ice_eswitch_del_sp_rules - delete adv rules added on PRs +* @pf: pointer to the PF struct +* +* Delete all advanced rules that were used to forward packets with the +* device's VSI index to the corresponding eswitch ctrl VSI queue. +*/ +static void ice_eswitch_del_sp_rules (struct ice_pf *pf) +{ +struct ice_repr *repr; +unsigned long id; + +xa_for_each (&pf->eswitch.reprs, id, repr) { +if (repr->sp_rule.rid) +ice_rem_adv_rule_by_id (&pf->hw, &repr->sp_rule); + } +} +/** * ice_eswitch_add_sp_rule - add adv rule with device's VSI index * @pf: pointer to PF struct
@@ -18,8 +36,7 @@* This function adds advanced rule that forwards packets with * device's VSI index to the corresponding eswitch ctrl VSI queue. */ -static int -ice_eswitch_add_sp_rule (struct ice_pf *pf,struct ice_repr *repr) +static int ice_eswitch_add_sp_rule (struct ice_pf *pf,struct ice_repr *repr) {struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;struct ice_adv_rule_info rule_info = {0 };
@@ -54,17 +71,22 @@ ice_eswitch_add_sp_rule(struct ice_pf *pf, struct ice_repr *repr)return err; } -/** -* ice_eswitch_del_sp_rule - delete adv rule with device's VSI index -* @pf: pointer to the PF struct -* @repr: pointer to the repr struct -* -* Delete the advanced rule that was used to forward packets with the device's -* VSI index to the corresponding eswitch ctrl VSI queue. -*/ -static void ice_eswitch_del_sp_rule (struct ice_pf *pf,struct ice_repr *repr) +static int +ice_eswitch_add_sp_rules (struct ice_pf *pf) { -ice_rem_adv_rule_by_id (&pf->hw, &repr->sp_rule); +struct ice_repr *repr; +unsigned long id; +int err; + +xa_for_each (&pf->eswitch.reprs, id, repr) { + err =ice_eswitch_add_sp_rule (pf, repr); +if (err) { +ice_eswitch_del_sp_rules (pf); +return err; + } + } + +return 0 ; }/**
@@ -131,7 +153,7 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)/** * ice_eswitch_remap_rings_to_vectors - reconfigure rings of eswitch ctrl VSI -* @pf: pointer to PF struct +* @eswitch: pointer to eswitch struct * * In eswitch number of allocated Tx/Rx rings is equal. *
@@ -140,9 +162,9 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)* will have dedicated 1 Tx/Rx ring pair, so number of rings pair is equal to * number of VFs. */ -static void ice_eswitch_remap_rings_to_vectors (struct ice_pf *pf) +static void ice_eswitch_remap_rings_to_vectors (struct ice_eswitch *eswitch) { -struct ice_vsi *vsi = pf->eswitch.control_vsi; +struct ice_vsi *vsi = eswitch->control_vsi;unsigned long repr_id =0 ;int q_id;
@@ -152,7 +174,7 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf)struct ice_rx_ring *rx_ring;struct ice_repr *repr; - repr =xa_find (&pf->eswitch.reprs, &repr_id,U32_MAX , + repr =xa_find (&eswitch->reprs, &repr_id,U32_MAX ,XA_PRESENT );if (WARN_ON (!repr))break ;
@@ -185,100 +207,70 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) }/** -* ice_eswitch_release_reprs - clear PR VSIs configuration +* ice_eswitch_release_repr - clear PR VSI configuration * @pf: poiner to PF struct +* @repr: pointer to PR */ static void -ice_eswitch_release_reprs (struct ice_pf *pf) +ice_eswitch_release_repr (struct ice_pf *pf,struct ice_repr *repr) { -struct ice_repr *repr; -unsigned long id; +struct ice_vsi *vsi = repr->src_vsi; -xa_for_each (&pf->eswitch.reprs, id, repr) { -struct ice_vsi *vsi = repr->src_vsi; - -/* Skip representors that aren't configured */ -if (!repr->dst) -continue ; +/* Skip representors that aren't configured */ +if (!repr->dst) +return ; -ice_vsi_update_security (vsi, ice_vsi_ctx_set_antispoof); -metadata_dst_free (repr->dst); - repr->dst =NULL ; -ice_eswitch_del_sp_rule (pf, repr); -ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, -ICE_FWD_TO_VSI ); +ice_vsi_update_security (vsi, ice_vsi_ctx_set_antispoof); +metadata_dst_free (repr->dst); + repr->dst =NULL ; +ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, +ICE_FWD_TO_VSI ); -netif_napi_del (&repr->q_vector->napi); - } +netif_napi_del (&repr->q_vector->napi); }/** -* ice_eswitch_setup_reprs - configure port reprs to run in switchdev mode +* ice_eswitch_setup_repr - configure PR to run in switchdev mode * @pf: pointer to PF struct +* @repr: pointer to PR struct */ -static int ice_eswitch_setup_reprs (struct ice_pf *pf) +static int ice_eswitch_setup_repr (struct ice_pf *pf,struct ice_repr *repr) {struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; -struct ice_repr *repr; -unsigned long id; - -xa_for_each (&pf->eswitch.reprs, id, repr) { -struct ice_vsi *vsi = repr->src_vsi; - -ice_remove_vsi_fltr (&pf->hw, vsi->idx); - repr->dst =metadata_dst_alloc (0 ,METADATA_HW_PORT_MUX , -GFP_KERNEL ); -if (!repr->dst) { -ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, -ICE_FWD_TO_VSI ); - goto err; - } +struct ice_vsi *vsi = repr->src_vsi; +struct metadata_dst *dst; -if (ice_eswitch_add_sp_rule (pf, repr)) { -ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, -ICE_FWD_TO_VSI ); - goto err; - } +ice_remove_vsi_fltr (&pf->hw, vsi->idx); + repr->dst =metadata_dst_alloc (0 ,METADATA_HW_PORT_MUX , +GFP_KERNEL ); +if (!repr->dst) + goto err_add_mac_fltr; -if (ice_vsi_update_security (vsi, ice_vsi_ctx_clear_antispoof)) { -ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, -ICE_FWD_TO_VSI ); -ice_eswitch_del_sp_rule (pf, repr); -metadata_dst_free (repr->dst); - repr->dst =NULL ; - goto err; - } +if (ice_vsi_update_security (vsi, ice_vsi_ctx_clear_antispoof)) + goto err_dst_free; -if (ice_vsi_add_vlan_zero (vsi)) { -ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac, -ICE_FWD_TO_VSI ); -ice_eswitch_del_sp_rule (pf, repr); -metadata_dst_free (repr->dst); - repr->dst =NULL ; -ice_vsi_update_security (vsi, ice_vsi_ctx_set_antispoof); - goto err; - } +if (ice_vsi_add_vlan_zero (vsi)) + goto err_update_security; -netif_napi_add (repr->netdev, &repr->q_vector->napi, - ice_napi_poll); +netif_napi_add (repr->netdev, &repr->q_vector->napi, + ice_napi_poll); -netif_keep_dst (repr->netdev); - } +netif_keep_dst (repr->netdev); -xa_for_each (&pf->eswitch.reprs, id, repr) { -struct ice_vsi *vsi = repr->src_vsi; -struct metadata_dst *dst; - - dst = repr->dst; - dst->u.port_info.port_id = vsi->vsi_num; - dst->u.port_info.lower_dev = repr->netdev; -ice_repr_set_traffic_vsi (repr, ctrl_vsi); - } + dst = repr->dst; + dst->u.port_info.port_id = vsi->vsi_num; + dst->u.port_info.lower_dev = repr->netdev; +ice_repr_set_traffic_vsi (repr, ctrl_vsi);return 0 ; -err: -ice_eswitch_release_reprs (pf); +err_update_security: +ice_vsi_update_security (vsi, ice_vsi_ctx_set_antispoof); +err_dst_free: +metadata_dst_free (repr->dst); + repr->dst =NULL ; +err_add_mac_fltr: +ice_fltr_add_mac_and_broadcast (vsi, repr->parent_mac,ICE_FWD_TO_VSI );return -ENODEV ; }
@@ -481,31 +473,14 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)if (ice_eswitch_setup_env (pf)) goto err_vsi; -if (ice_repr_add_for_all_vfs (pf)) - goto err_repr_add; - -if (ice_eswitch_setup_reprs (pf)) - goto err_setup_reprs; - -ice_eswitch_remap_rings_to_vectors (pf); - -if (ice_vsi_open (ctrl_vsi)) - goto err_vsi_open; -if (ice_eswitch_br_offloads_init (pf)) goto err_br_offloads; -ice_eswitch_napi_enable (&pf->eswitch.reprs); + pf->eswitch.is_running = true;return 0 ; err_br_offloads: -ice_vsi_close (ctrl_vsi); -err_vsi_open: -ice_eswitch_release_reprs (pf); -err_setup_reprs: -ice_repr_rem_from_all_vfs (pf); -err_repr_add:ice_eswitch_release_env (pf); err_vsi:ice_vsi_release (ctrl_vsi);
@@ -519,22 +494,12 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)static void ice_eswitch_disable_switchdev (struct ice_pf *pf) {struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; -struct devlink *devlink =priv_to_devlink (pf); -ice_eswitch_napi_disable (&pf->eswitch.reprs);ice_eswitch_br_offloads_deinit (pf);ice_eswitch_release_env (pf); -ice_eswitch_release_reprs (pf);ice_vsi_release (ctrl_vsi); -ice_repr_rem_from_all_vfs (pf); - -/* since all port representors are destroyed, there is -* no point in keeping the nodes -*/ -ice_devlink_rate_clear_tx_topology (ice_get_main_vsi (pf)); -devl_lock (devlink); -devl_rate_nodes_destroy (devlink); -devl_unlock (devlink); + + pf->eswitch.is_running = false; }/**
@@ -613,39 +578,6 @@ bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)return pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ; } -/** -* ice_eswitch_release - cleanup eswitch -* @pf: pointer to PF structure -*/ -void ice_eswitch_release (struct ice_pf *pf) -{ -if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_LEGACY ) -return ; - -ice_eswitch_disable_switchdev (pf); - pf->eswitch.is_running = false; -} - -/** -* ice_eswitch_configure - configure eswitch -* @pf: pointer to PF structure -*/ -int ice_eswitch_configure (struct ice_pf *pf) -{ -int status; - -if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_LEGACY || - pf->eswitch.is_running) -return 0 ; - - status =ice_eswitch_enable_switchdev (pf); -if (status) -return status; - - pf->eswitch.is_running = true; -return 0 ; -} -/** * ice_eswitch_start_all_tx_queues - start Tx queues of all port representors * @pf: pointer to PF structure
@@ -678,6 +610,20 @@ void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)ice_repr_stop_tx_queues (repr); } +static void ice_eswitch_stop_reprs (struct ice_pf *pf) +{ +ice_eswitch_del_sp_rules (pf); +ice_eswitch_stop_all_tx_queues (pf); +ice_eswitch_napi_disable (&pf->eswitch.reprs); +} + +static void ice_eswitch_start_reprs (struct ice_pf *pf) +{ +ice_eswitch_napi_enable (&pf->eswitch.reprs); +ice_eswitch_start_all_tx_queues (pf); +ice_eswitch_add_sp_rules (pf); +} +/** * ice_eswitch_rebuild - rebuild eswitch * @pf: pointer to PF structure
@@ -694,11 +640,7 @@ int ice_eswitch_rebuild(struct ice_pf *pf)if (status)return status; - status =ice_eswitch_setup_reprs (pf); -if (status) -return status; - -ice_eswitch_remap_rings_to_vectors (pf); +ice_eswitch_remap_rings_to_vectors (&pf->eswitch);ice_replay_tc_fltrs (pf);
@@ -711,3 +653,102 @@ int ice_eswitch_rebuild(struct ice_pf *pf)return 0 ; } + +static void +ice_eswitch_cp_change_queues (struct ice_eswitch *eswitch,int change) +{ +struct ice_vsi *cp = eswitch->control_vsi; + +ice_vsi_close (cp); + + cp->req_txq = cp->alloc_txq + change; + cp->req_rxq = cp->alloc_rxq + change; +ice_vsi_rebuild (cp,ICE_VSI_FLAG_NO_INIT ); +ice_eswitch_remap_rings_to_vectors (eswitch); + +ice_vsi_open (cp); +} + +int +ice_eswitch_attach (struct ice_pf *pf,struct ice_vf *vf) +{ +struct ice_repr *repr; +int change =1 ; +int err; + +if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_LEGACY ) +return 0 ; + +if (xa_empty (&pf->eswitch.reprs)) { + err =ice_eswitch_enable_switchdev (pf); +if (err) +return err; +/* Control plane VSI is created with 1 queue as default */ + change =0 ; + } + +ice_eswitch_stop_reprs (pf); + + repr =ice_repr_add_vf (vf); +if (IS_ERR (repr)) + goto err_create_repr; + + err =ice_eswitch_setup_repr (pf, repr); +if (err) + goto err_setup_repr; + + err =xa_alloc (&pf->eswitch.reprs, &repr->id, repr, +XA_LIMIT (1 ,INT_MAX ),GFP_KERNEL ); +if (err) + goto err_xa_alloc; + + vf->repr_id = repr->id; + +ice_eswitch_cp_change_queues (&pf->eswitch, change); +ice_eswitch_start_reprs (pf); + +return 0 ; + +err_xa_alloc: +ice_eswitch_release_repr (pf, repr); +err_setup_repr: +ice_repr_rem_vf (repr); +err_create_repr: +if (xa_empty (&pf->eswitch.reprs)) +ice_eswitch_disable_switchdev (pf); +ice_eswitch_start_reprs (pf); + +return err; +} + +void ice_eswitch_detach (struct ice_pf *pf,struct ice_vf *vf) +{ +struct ice_repr *repr =xa_load (&pf->eswitch.reprs, vf->repr_id); +struct devlink *devlink =priv_to_devlink (pf); + +if (!repr) +return ; + +ice_eswitch_stop_reprs (pf); +xa_erase (&pf->eswitch.reprs, repr->id); + +if (xa_empty (&pf->eswitch.reprs)) +ice_eswitch_disable_switchdev (pf); +else +ice_eswitch_cp_change_queues (&pf->eswitch,-1 ); + +ice_eswitch_release_repr (pf, repr); +ice_repr_rem_vf (repr); + +if (xa_empty (&pf->eswitch.reprs)) { +/* since all port representors are destroyed, there is +* no point in keeping the nodes +*/ +ice_devlink_rate_clear_tx_topology (ice_get_main_vsi (pf)); +devl_lock (devlink); +devl_rate_nodes_destroy (devlink); +devl_unlock (devlink); + }else { +ice_eswitch_start_reprs (pf); + } +}
drivers/net/ethernet/intel/ice/ice_eswitch.h +10 -3
@@ -7,8 +7,9 @@#include <net/devlink.h> #ifdef CONFIG_ICE_SWITCHDEV -void ice_eswitch_release (struct ice_pf *pf); -int ice_eswitch_configure (struct ice_pf *pf); +void ice_eswitch_detach (struct ice_pf *pf,struct ice_vf *vf); +int +ice_eswitch_attach (struct ice_pf *pf,struct ice_vf *vf);int ice_eswitch_rebuild (struct ice_pf *pf);int ice_eswitch_mode_get (struct devlink *devlink,u16 *mode);
@@ -26,7 +27,13 @@ void ice_eswitch_set_target_vsi(struct sk_buff *skb,netdev_tx_t ice_eswitch_port_start_xmit (struct sk_buff *skb,struct net_device *netdev);#else /* CONFIG_ICE_SWITCHDEV */ -static inline void ice_eswitch_release (struct ice_pf *pf) { } +static inline void ice_eswitch_detach (struct ice_pf *pf,struct ice_vf *vf) { } + +static inline int +ice_eswitch_attach (struct ice_pf *pf,struct ice_vf *vf) +{ +return -EOPNOTSUPP ; +}static inline void ice_eswitch_stop_all_tx_queues (struct ice_pf *pf) { }
drivers/net/ethernet/intel/ice/ice_repr.c +11 -74
137 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_repr.h +2 -2
@@ -22,8 +22,8 @@ struct ice_repr {#endif }; -int ice_repr_add_for_all_vfs (struct ice_pf *pf); -void ice_repr_rem_from_all_vfs (struct ice_pf *pf); +struct ice_repr *ice_repr_add_vf (struct ice_vf *vf); +void ice_repr_rem_vf (struct ice_repr *repr);void ice_repr_start_tx_queues (struct ice_repr *repr);void ice_repr_stop_tx_queues (struct ice_repr *repr);
drivers/net/ethernet/intel/ice/ice_sriov.c +9 -8
@@ -174,11 +174,10 @@ void ice_free_vfs(struct ice_pf *pf)mutex_lock (&vfs->table_lock); -ice_eswitch_release (pf); -ice_for_each_vf (pf, bkt, vf) {mutex_lock (&vf->cfg_lock); +ice_eswitch_detach (pf, vf);ice_dis_vf_qs (vf);if (test_bit (ICE_VF_STATE_INIT , vf->vf_states)) {
@@ -614,6 +613,14 @@ static int ice_start_vfs(struct ice_pf *pf) goto teardown; } + retval =ice_eswitch_attach (pf, vf); +if (retval) { +dev_err (ice_pf_to_dev (pf),"Failed to attach VF %d to eswitch, error %d" , + vf->vf_id, retval); +ice_vf_vsi_release (vf); + goto teardown; + } +set_bit (ICE_VF_STATE_INIT , vf->vf_states);ice_ena_vf_mappings (vf);wr32 (hw,VFGEN_RSTAT (vf->vf_id),VIRTCHNL_VFR_VFACTIVE );
@@ -932,12 +939,6 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)clear_bit (ICE_VF_DIS , pf->state); - ret =ice_eswitch_configure (pf); -if (ret) { -dev_err (dev,"Failed to configure eswitch, err %d\n" , ret); - goto err_unroll_sriov; - } -/* rearm global interrupts */ if (test_and_clear_bit (ICE_OICR_INTR_DIS , pf->state))ice_irq_dynamic_ena (hw,NULL ,NULL );
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 13/15] ice: add VF representors one by one
Quoted 42 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 13/15] ice: add VF representors one by oneImplement adding representors one by one. Always set switchdev environment when first representor is being added and clear environment when last one is being removed.
Basic switchdev configuration remains the same. Code related to creating and configuring representor was changed.
Instead of setting whole representors in one function handle only one representor in setup function. The same with removing representors.
Stop representors when new one is being added or removed. Stop means, disabling napi, stopping traffic and removing slow path rule. It is needed because ::q_id will change after remapping, so each representor will need new rule.
When representor are stopped rebuild control plane VSI with one more or one less queue. One more if new representor is being added, one less if representor is being removed.
Bridge port is removed during
unregister_netdev()call on PR, so there is no need to call it from driver side.After that do remap new queues to correct vector. At the end start all representors (napi enable, start queues, add slow path rule).
Reviewed-by Piotr Raczynski <[email protected]>Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 351 +++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 13 +- drivers/net/ethernet/intel/ice/ice_repr.c | 85 +---- drivers/net/ethernet/intel/ice/ice_repr.h | 4 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 17 +- 5 files changed, 228 insertions(+), 242 deletions(-)
PATCH 14/15 ice: adjust switchdev rebuild path
In reply to Michal SwiatkowskiThere is no need to use specific functions for rebuilding path. Let's use current implementation by removing all representors and as the result remove switchdev environment.
It will be added in devices rebuild path. For example during adding VFs, port representors for them also will be created.
Rebuild control plane VSI before removing representors with INIT_VSI flag set to reinit VSI in hardware after reset.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 66 +++++++------------- drivers/net/ethernet/intel/ice/ice_main.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +-- 3 files changed, 28 insertions(+), 49 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch.c +23 -43
@@ -406,19 +406,6 @@ ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)return ice_vsi_setup (pf, ¶ms); } -/** -* ice_eswitch_napi_del - remove NAPI handle for all port representors -* @reprs: xarray of reprs -*/ -static void ice_eswitch_napi_del (struct xarray *reprs) -{ -struct ice_repr *repr; -unsigned long id; - -xa_for_each (reprs, id, repr) -netif_napi_del (&repr->q_vector->napi); -} -/** * ice_eswitch_napi_enable - enable NAPI for all port representors * @reprs: xarray of reprs
@@ -624,36 +611,6 @@ static void ice_eswitch_start_reprs(struct ice_pf *pf)ice_eswitch_add_sp_rules (pf); } -/** -* ice_eswitch_rebuild - rebuild eswitch -* @pf: pointer to PF structure -*/ -int ice_eswitch_rebuild (struct ice_pf *pf) -{ -struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi; -int status; - -ice_eswitch_napi_disable (&pf->eswitch.reprs); -ice_eswitch_napi_del (&pf->eswitch.reprs); - - status =ice_eswitch_setup_env (pf); -if (status) -return status; - -ice_eswitch_remap_rings_to_vectors (&pf->eswitch); - -ice_replay_tc_fltrs (pf); - - status =ice_vsi_open (ctrl_vsi); -if (status) -return status; - -ice_eswitch_napi_enable (&pf->eswitch.reprs); -ice_eswitch_start_all_tx_queues (pf); - -return 0 ; -} -static void ice_eswitch_cp_change_queues (struct ice_eswitch *eswitch,int change) {
@@ -752,3 +709,26 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf)ice_eswitch_start_reprs (pf); } } + +/** +* ice_eswitch_rebuild - rebuild eswitch +* @pf: pointer to PF structure +*/ +int ice_eswitch_rebuild (struct ice_pf *pf) +{ +struct ice_repr *repr; +unsigned long id; +int err; + +if (!ice_is_switchdev_running (pf)) +return 0 ; + + err =ice_vsi_rebuild (pf->eswitch.control_vsi,ICE_VSI_FLAG_INIT ); +if (err) +return err; + +xa_for_each (&pf->eswitch.reprs, id, repr) +ice_eswitch_detach (pf, repr->vf); + +return 0 ; +}
drivers/net/ethernet/intel/ice/ice_main.c +2 -2
@@ -7412,9 +7412,9 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)ice_ptp_cfg_timestamp (pf, true); } - err =ice_vsi_rebuild_by_type (pf,ICE_VSI_SWITCHDEV_CTRL ); + err =ice_eswitch_rebuild (pf);if (err) { -dev_err (dev,"Switchdev CTRL VSI rebuild failed: %d\n" , err); +dev_err (dev,"Switchdev rebuild failed: %d\n" , err); goto err_vsi_rebuild; }
drivers/net/ethernet/intel/ice/ice_vf_lib.c +3 -4
@@ -760,6 +760,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)ice_for_each_vf (pf, bkt, vf) {mutex_lock (&vf->cfg_lock); +ice_eswitch_detach (pf, vf); vf->driver_caps =0 ;ice_vc_set_default_allowlist (vf);
@@ -775,13 +776,11 @@ void ice_reset_all_vfs(struct ice_pf *pf)ice_vf_rebuild_vsi (vf);ice_vf_post_vsi_rebuild (vf); +ice_eswitch_attach (pf, vf); +mutex_unlock (&vf->cfg_lock); } -if (ice_is_eswitch_mode_switchdev (pf)) -if (ice_eswitch_rebuild (pf)) -dev_warn (dev,"eswitch rebuild failed\n" ); -ice_flush (hw);clear_bit (ICE_VF_DIS , pf->state);
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 14/15] ice: adjust switchdev rebuild path
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 14/15] ice: adjust switchdev rebuild pathThere is no need to use specific functions for rebuilding path. Let's use current implementation by removing all representors and as the result remove switchdev environment.
It will be added in devices rebuild path. For example during adding VFs, port representors for them also will be created.
Rebuild control plane VSI before removing representors with
INIT_VSIflag set to reinit VSI in hardware after reset.
Quoted 8 lines
Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 66 +++++++------------- drivers/net/ethernet/intel/ice/ice_main.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 7 +-- 3 files changed, 28 insertions(+), 49 deletions(-)
PATCH 15/15 ice: reserve number of CP queues
In reply to Michal SwiatkowskiRebuilding CP VSI each time the PR is created drastically increase the time of maximum VFs creation. Add function to reserve number of CP queues to deal with this problem.
Use the same function to decrease number of queues in case of removing VFs. Assume that caller of ice_eswitch_reserve_cp_queues() will also call ice_eswitch_attach/detach() correct number of times.
Still one by one PR adding is handy for VF resetting routine.
--- drivers/net/ethernet/intel/ice/ice.h | 6 +++ drivers/net/ethernet/intel/ice/ice_eswitch.c | 52 +++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_eswitch.h | 4 ++ drivers/net/ethernet/intel/ice/ice_sriov.c | 3 ++ 4 files changed, 58 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +6 -0
@@ -528,6 +528,12 @@ struct ice_eswitch {struct ice_esw_br_offloads *br_offloads;struct xarray reprs;bool is_running; +/* struct to allow cp queues management optimization */ +struct { +int to_reach; +int value; +bool is_reaching; + } qs; };struct ice_agg_node {
drivers/net/ethernet/intel/ice/ice_eswitch.c +45 -7
88 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_eswitch.h +4 -0
@@ -26,6 +26,7 @@ void ice_eswitch_set_target_vsi(struct sk_buff *skb, struct ice_tx_offload_params *off);netdev_tx_t ice_eswitch_port_start_xmit (struct sk_buff *skb,struct net_device *netdev); +void ice_eswitch_reserve_cp_queues (struct ice_pf *pf,int change);#else /* CONFIG_ICE_SWITCHDEV */ static inline void ice_eswitch_detach (struct ice_pf *pf,struct ice_vf *vf) { }
@@ -76,5 +77,8 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev) {return NETDEV_TX_BUSY ; } + +static inline void +ice_eswitch_reserve_cp_queues (struct ice_pf *pf,int change) { }#endif /* CONFIG_ICE_SWITCHDEV */ #endif /* _ICE_ESWITCH_H_ */
drivers/net/ethernet/intel/ice/ice_sriov.c +3 -0
@@ -172,6 +172,8 @@ void ice_free_vfs(struct ice_pf *pf)else dev_warn (dev,"VFs are assigned - not disabling SR-IOV\n" ); +ice_eswitch_reserve_cp_queues (pf, -ice_get_num_vfs (pf)); +mutex_lock (&vfs->table_lock);ice_for_each_vf (pf, bkt, vf) {
@@ -930,6 +932,7 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs) goto err_unroll_sriov; } +ice_eswitch_reserve_cp_queues (pf, num_vfs); ret =ice_start_vfs (pf);if (ret) {dev_err (dev,"Failed to start %d VFs, err %d\n" , num_vfs, ret);
Signature · 1 line
2.41.0
RE: [Intel-wired-lan] [PATCH iwl-next v1 15/15] ice: reserve number of CP queues
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, October 24, 2023 4:39 PM
To: [email protected]
Cc: Drewek, Wojciech <[email protected]>; Szycik, Marcin <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Keller, Jacob E <[email protected]>; Michal Swiatkowski <[email protected]>; Raczynski, Piotr <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 15/15] ice: reserve number of CP queuesRebuilding CP VSI each time the PR is created drastically increase the time of maximum VFs creation. Add function to reserve number of CP queues to deal with this problem.
Use the same function to decrease number of queues in case of removing VFs. Assume that caller of
ice_eswitch_reserve_cp_queues()will also call ice_eswitch_attach/detach() correct number of times.Still one by one PR adding is handy for VF resetting routine.
Quoted 9 lines
Reviewed-by Wojciech Drewek <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 6 +++ drivers/net/ethernet/intel/ice/ice_eswitch.c | 52 +++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_eswitch.h | 4 ++ drivers/net/ethernet/intel/ice/ice_sriov.c | 3 ++ 4 files changed, 58 insertions(+), 7 deletions(-)
Quoted 10 lines · Tue, Oct 24, 2023 at 01:09:14PM CEST, [email protected] wrote:
Hi,
Currently ice supports creating port representors only for VFs. For that use case they can be created and removed in one step.
This patchset is refactoring current flow to support port representor creation also for subfunctions and SIOV. In this case port representors need to be createad and removed one by one. Also, they can be added and removed while other port representors are running.
Quoted 7 lines
To achieve that we need to change the switchdev configuration flow. Three first patches are only cosmetic (renaming, removing not used code). Next few ones are preparation for new flow. The most important one is "add VF representor one by one". It fully implements new flow.
New type of port representor (for subfunction) will be introduced in follow up patchset.
Examples please. Show new outputs of devlink commands.
Thanks!
Quoted 38 lines
Michal Swiatkowski (15):
ice: rename switchdev to eswitch
ice: remove redundantmax_vsi_numvariable
ice: remove unused control VSI parameter
ice: trackq_idin representor
ice: use repr instead ofvf->repr
ice: track port representors in xarray
ice: remove VF pointer reference in eswitch code
ice: make representor code generic
ice: return pointer to representor
ice: allow changingSWITCHDEV_CTRLVSI queues
ice: set Tx topology every time new repr is added
ice: realloc VSI stats arrays
ice: add VF representors one by one
ice: adjust switchdev rebuild path
ice: reserve number of CP queuesdrivers/net/ethernet/intel/ice/ice.h | 13 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 + drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 562 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 22 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 22 +- drivers/net/ethernet/intel/ice/ice_lib.c | 81 ++- drivers/net/ethernet/intel/ice/ice_main.c | 6 +- drivers/net/ethernet/intel/ice/ice_repr.c | 195 +++--- drivers/net/ethernet/intel/ice/ice_repr.h | 9 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 20 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 14 files changed, 553 insertions(+), 422 deletions(-)Signature · 1 line
2.41.0
Quoted 16 lines · Jiri Pirko
Quoted 15 lines · Tue, Oct 24, 2023 at 01:09:14PM CEST, [email protected] wrote:
Hi,
Currently ice supports creating port representors only for VFs. For that use case they can be created and removed in one step.
This patchset is refactoring current flow to support port representor creation also for subfunctions and SIOV. In this case port representors need to be createad and removed one by one. Also, they can be added and removed while other port representors are running.
To achieve that we need to change the switchdev configuration flow. Three first patches are only cosmetic (renaming, removing not used code). Next few ones are preparation for new flow. The most important one is "add VF representor one by one". It fully implements new flow.
Quoted 7 lines
Quoted 2 lines
New type of port representor (for subfunction) will be introduced in follow up patchset.
Examples please. Show new outputs of devlink commands.
Thanks!
If you mean outputs after refactor to one by one solution nothing has changed:
# devlink port show (after creating 4 VFs in switchdev mode) pci/0000:18:00.0/0: type eth netdev ens785f0np0 flavour physical port 0 splittable true lanes 8 pci/0000:18:00.0/2: type eth netdev ens785f0np0_0 flavour pcivf controller 0 pfnum 0 vfnum 0 external false splittable false pci/0000:18:00.0/4: type eth netdev ens785f0np0_3 flavour pcivf controller 0 pfnum 0 vfnum 3 external false splittable false pci/0000:18:00.0/5: type eth netdev ens785f0np0_1 flavour pcivf controller 0 pfnum 0 vfnum 1 external false splittable false pci/0000:18:00.0/6: type eth netdev ens785f0np0_2 flavour pcivf controller 0 pfnum 0 vfnum 2 external false splittable false
According subfunction, it will also be in cover latter for patchset that is implementing subfunction.
Commands:
# devlink dev eswitch set pci/0000:18:00.0 mode switchdev # devlink port add pci/0000:18:00.0 flavour pcisf pfnum 0 sfnum 1000 # devlink port function set pci/0000:18:00.0/3 state active
Outputs:
Don't have it saved, will send it here after rebasing subfunction of top of this one.
Thanks,
Michal
Quoted 38 lines
Quoted 38 lines
Michal Swiatkowski (15):
ice: rename switchdev to eswitch
ice: remove redundantmax_vsi_numvariable
ice: remove unused control VSI parameter
ice: trackq_idin representor
ice: use repr instead ofvf->repr
ice: track port representors in xarray
ice: remove VF pointer reference in eswitch code
ice: make representor code generic
ice: return pointer to representor
ice: allow changingSWITCHDEV_CTRLVSI queues
ice: set Tx topology every time new repr is added
ice: realloc VSI stats arrays
ice: add VF representors one by one
ice: adjust switchdev rebuild path
ice: reserve number of CP queuesdrivers/net/ethernet/intel/ice/ice.h | 13 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 + drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 562 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 22 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 22 +- drivers/net/ethernet/intel/ice/ice_lib.c | 81 ++- drivers/net/ethernet/intel/ice/ice_main.c | 6 +- drivers/net/ethernet/intel/ice/ice_repr.c | 195 +++--- drivers/net/ethernet/intel/ice/ice_repr.h | 9 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 20 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 14 files changed, 553 insertions(+), 422 deletions(-)Signature · 1 line
2.41.0
Quoted 38 lines · Tue, Oct 24, 2023 at 03:10:46PM CEST, [email protected] wrote:
Quoted 16 lines · Jiri Pirko
Quoted 15 lines · Tue, Oct 24, 2023 at 01:09:14PM CEST, [email protected] wrote:
Hi,
Currently ice supports creating port representors only for VFs. For that use case they can be created and removed in one step.
This patchset is refactoring current flow to support port representor creation also for subfunctions and SIOV. In this case port representors need to be createad and removed one by one. Also, they can be added and removed while other port representors are running.
To achieve that we need to change the switchdev configuration flow. Three first patches are only cosmetic (renaming, removing not used code). Next few ones are preparation for new flow. The most important one is "add VF representor one by one". It fully implements new flow.
Quoted 7 lines
Quoted 2 lines
New type of port representor (for subfunction) will be introduced in follow up patchset.
Examples please. Show new outputs of devlink commands.
Thanks!
If you mean outputs after refactor to one by one solution nothing has changed:
# devlink port show (after creating 4 VFs in switchdev mode) pci/0000:18:00.0/0: type eth netdev ens785f0np0 flavour physical port 0 splittable true lanes 8 pci/0000:18:00.0/2: type eth netdev ens785f0np0_0 flavour pcivf controller 0 pfnum 0 vfnum 0 external false splittable false pci/0000:18:00.0/4: type eth netdev ens785f0np0_3 flavour pcivf controller 0 pfnum 0 vfnum 3 external false splittable false pci/0000:18:00.0/5: type eth netdev ens785f0np0_1 flavour pcivf controller 0 pfnum 0 vfnum 1 external false splittable false pci/0000:18:00.0/6: type eth netdev ens785f0np0_2 flavour pcivf controller 0 pfnum 0 vfnum 2 external false splittable falseAccording subfunction, it will also be in cover latter for patchset that is implementing subfunction.
Quoted 8 lines
Commands:
# devlink dev eswitch set pci/0000:18:00.0 mode switchdev # devlink port add pci/0000:18:00.0 flavour pcisf pfnum 0 sfnum 1000 # devlink port function set pci/0000:18:00.0/3 state activeOutputs:
Don't have it saved, will send it here after rebasing subfunction of top of this one.
Ah, I was under impression it is part of this set. Sorry.
Quoted 42 lines
Thanks,
MichalQuoted 38 lines
Quoted 38 lines
Michal Swiatkowski (15):
ice: rename switchdev to eswitch
ice: remove redundantmax_vsi_numvariable
ice: remove unused control VSI parameter
ice: trackq_idin representor
ice: use repr instead ofvf->repr
ice: track port representors in xarray
ice: remove VF pointer reference in eswitch code
ice: make representor code generic
ice: return pointer to representor
ice: allow changingSWITCHDEV_CTRLVSI queues
ice: set Tx topology every time new repr is added
ice: realloc VSI stats arrays
ice: add VF representors one by one
ice: adjust switchdev rebuild path
ice: reserve number of CP queuesdrivers/net/ethernet/intel/ice/ice.h | 13 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 29 + drivers/net/ethernet/intel/ice/ice_devlink.h | 1 + drivers/net/ethernet/intel/ice/ice_eswitch.c | 562 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_eswitch.h | 22 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 22 +- drivers/net/ethernet/intel/ice/ice_lib.c | 81 ++- drivers/net/ethernet/intel/ice/ice_main.c | 6 +- drivers/net/ethernet/intel/ice/ice_repr.c | 195 +++--- drivers/net/ethernet/intel/ice/ice_repr.h | 9 +- drivers/net/ethernet/intel/ice/ice_sriov.c | 20 +- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 4 +- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 9 +- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 2 +- 14 files changed, 553 insertions(+), 422 deletions(-)Signature · 1 line
2.41.0