diff options
| author | Ivan Vecera <[email protected]> | 2023-11-24 15:03:41 +0000 |
|---|---|---|
| committer | Tony Nguyen <[email protected]> | 2024-02-16 17:28:14 +0000 |
| commit | b7fac08db5e32a7de8c53e50dc7c841d123dda05 (patch) | |
| tree | 989f4a5fd40e0d4e5e19b333b1540b4ba73b6ed7 /drivers/net/ethernet/intel/i40e/i40e.h | |
| parent | i40e: Introduce and use macros for iterating VSIs and VEBs (diff) | |
| download | kernel-b7fac08db5e32a7de8c53e50dc7c841d123dda05.tar.gz kernel-b7fac08db5e32a7de8c53e50dc7c841d123dda05.zip | |
i40e: Add helpers to find VSI and VEB by SEID and use them
Add two helpers i40e_(veb|vsi)_get_by_seid() to find corresponding
VEB or VSI by their SEID value and use these helpers to replace
existing open-coded loops.
Reviewed-by: Wojciech Drewek <[email protected]>
Signed-off-by: Ivan Vecera <[email protected]>
Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e.h')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 5acb26644be7..2990ff4f0306 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -1355,4 +1355,40 @@ static inline struct i40e_pf *i40e_hw_to_pf(struct i40e_hw *hw) struct device *i40e_hw_to_dev(struct i40e_hw *hw); +/** + * i40e_pf_get_vsi_by_seid - find VSI by SEID + * @pf: pointer to a PF + * @seid: SEID of the VSI + **/ +static inline struct i40e_vsi * +i40e_pf_get_vsi_by_seid(struct i40e_pf *pf, u16 seid) +{ + struct i40e_vsi *vsi; + int i; + + i40e_pf_for_each_vsi(pf, i, vsi) + if (vsi->seid == seid) + return vsi; + + return NULL; +} + +/** + * i40e_pf_get_veb_by_seid - find VEB by SEID + * @pf: pointer to a PF + * @seid: SEID of the VSI + **/ +static inline struct i40e_veb * +i40e_pf_get_veb_by_seid(struct i40e_pf *pf, u16 seid) +{ + struct i40e_veb *veb; + int i; + + i40e_pf_for_each_veb(pf, i, veb) + if (veb->seid == seid) + return veb; + + return NULL; +} + #endif /* _I40E_H_ */ |
