On 09.06.2025 15:11, Dave Ertman wrote:
(...)
> +static void ice_lag_aa_move_vf_qs(struct ice_lag *lag, u8 dest, u16 vsi_num,
> + bool all, bool *odd, struct ice_pf *e_pf)
> +{
> + DEFINE_RAW_FLEX(struct ice_aqc_cfg_txqs_buf, qbuf, queue_info, 1);
> + struct ice_hw *old_hw, *new_hw, *pri_hw, *sec_hw;
> + struct device *dev = ice_pf_to_dev(lag->pf);
> + struct ice_vsi_ctx *pv_ctx, *sv_ctx;
> + struct ice_lag_netdev_list ndlist;
> + u16 num_q, qbuf_size, sec_vsi_num;
> + u8 pri_lport, sec_lport;
> + u32 pvf_teid, svf_teid;
> + u16 vf_id;
> +
> + vf_id = lag->pf->vsi[vsi_num]->vf->vf_id;
> + /* If sec_vf[] not defined, then no second interface to share with */
> + if (lag->sec_vf[vf_id])
> + sec_vsi_num = lag->sec_vf[vf_id]->idx;
> + else
> + return;
> +
> + pri_lport = lag->bond_lport_pri;
> + sec_lport = lag->bond_lport_sec;
> +
> + if (pri_lport == ICE_LAG_INVALID_PORT ||
> + sec_lport == ICE_LAG_INVALID_PORT)
> + return;
> +
> + if (!e_pf)
> + ice_lag_build_netdev_list(lag, &ndlist);
> +
> + pri_hw = &lag->pf->hw;
> + if (e_pf && lag->pf != e_pf)
> + sec_hw = &e_pf->hw;
> + else
> + sec_hw = ice_lag_find_hw_by_lport(lag, sec_lport);
> +
> + if (!pri_hw || !sec_hw)
> + return;
> +
> + if (dest == ICE_LAGP_IDX) {
> + old_hw = sec_hw;
> + new_hw = pri_hw;
> + ice_lag_config_eswitch(lag, lag->pf->vsi[0]->netdev);
ice_get_main_vsi(lag->pf)->netdev should probably be used instead for clarity.
Actually now that I look at it, pf->vsi[0] is used multiple times in ice_lag.c,
might be a case for a small refactor at some point later.
> + } else {
> + struct ice_pf *sec_pf = sec_hw->back;
> +
> + old_hw = pri_hw;
> + new_hw = sec_hw;
> + ice_lag_config_eswitch(lag, sec_pf->vsi[0]->netdev);
Same
(...)
> /**
> - * ice_lag_config_eswitch - configure eswitch to work with LAG
> - * @lag: lag info struct
> - * @netdev: active network interface device struct
> - *
> - * Updates all port representors in eswitch to use @netdev for Tx.
> - *
> - * Configures the netdev to keep dst metadata (also used in representor Tx).
> - * This is required for an uplink without switchdev mode configured.
> - */
> -static void ice_lag_config_eswitch(struct ice_lag *lag,
> - struct net_device *netdev)
> -{
> - struct ice_repr *repr;
> - unsigned long id;
> -
> - xa_for_each(&lag->pf->eswitch.reprs, id, repr)
> - repr->dst->u.port_info.lower_dev = netdev;
> -
> - netif_keep_dst(netdev);
> -}
There's already patch 4/8 that moves a function with no changes, this should be
a part of it.
Thanks,
Marcin