Skip to content

Commit 386a0af

Browse files
aabodunrinJeff Kirsher
authored andcommitted
i40e: Move code to enable/disable Loopback to the main file
Since changes made to enable or disable loopback for all VSIs, not only SR-IOV or PCIOV, then it became necessary to move the associated functions to main file - so that other non-SRIOV supported driver can take advantage of the changes. Change-ID: I59a49fd23a6136acda5e16f8d1e5ac7fd9c5fc05 Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 1e200e4 commit 386a0af

File tree

3 files changed

+68
-70
lines changed

3 files changed

+68
-70
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5912,6 +5912,74 @@ static void i40e_verify_eeprom(struct i40e_pf *pf)
59125912
}
59135913
}
59145914

5915+
/**
5916+
* i40e_enable_pf_switch_lb
5917+
* @pf: pointer to the pf structure
5918+
*
5919+
* enable switch loop back or die - no point in a return value
5920+
**/
5921+
static void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
5922+
{
5923+
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
5924+
struct i40e_vsi_context ctxt;
5925+
int aq_ret;
5926+
5927+
ctxt.seid = pf->main_vsi_seid;
5928+
ctxt.pf_num = pf->hw.pf_id;
5929+
ctxt.vf_num = 0;
5930+
aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
5931+
if (aq_ret) {
5932+
dev_info(&pf->pdev->dev,
5933+
"%s couldn't get pf vsi config, err %d, aq_err %d\n",
5934+
__func__, aq_ret, pf->hw.aq.asq_last_status);
5935+
return;
5936+
}
5937+
ctxt.flags = I40E_AQ_VSI_TYPE_PF;
5938+
ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
5939+
ctxt.info.switch_id |= cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
5940+
5941+
aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);
5942+
if (aq_ret) {
5943+
dev_info(&pf->pdev->dev,
5944+
"%s: update vsi switch failed, aq_err=%d\n",
5945+
__func__, vsi->back->hw.aq.asq_last_status);
5946+
}
5947+
}
5948+
5949+
/**
5950+
* i40e_disable_pf_switch_lb
5951+
* @pf: pointer to the pf structure
5952+
*
5953+
* disable switch loop back or die - no point in a return value
5954+
**/
5955+
static void i40e_disable_pf_switch_lb(struct i40e_pf *pf)
5956+
{
5957+
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
5958+
struct i40e_vsi_context ctxt;
5959+
int aq_ret;
5960+
5961+
ctxt.seid = pf->main_vsi_seid;
5962+
ctxt.pf_num = pf->hw.pf_id;
5963+
ctxt.vf_num = 0;
5964+
aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
5965+
if (aq_ret) {
5966+
dev_info(&pf->pdev->dev,
5967+
"%s couldn't get pf vsi config, err %d, aq_err %d\n",
5968+
__func__, aq_ret, pf->hw.aq.asq_last_status);
5969+
return;
5970+
}
5971+
ctxt.flags = I40E_AQ_VSI_TYPE_PF;
5972+
ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
5973+
ctxt.info.switch_id &= ~cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
5974+
5975+
aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);
5976+
if (aq_ret) {
5977+
dev_info(&pf->pdev->dev,
5978+
"%s: update vsi switch failed, aq_err=%d\n",
5979+
__func__, vsi->back->hw.aq.asq_last_status);
5980+
}
5981+
}
5982+
59155983
/**
59165984
* i40e_config_bridge_mode - Configure the HW bridge mode
59175985
* @veb: pointer to the bridge instance

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -709,74 +709,6 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
709709
clear_bit(__I40E_VF_DISABLE, &pf->state);
710710
}
711711

712-
/**
713-
* i40e_enable_pf_switch_lb
714-
* @pf: pointer to the pf structure
715-
*
716-
* enable switch loop back or die - no point in a return value
717-
**/
718-
void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
719-
{
720-
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
721-
struct i40e_vsi_context ctxt;
722-
int aq_ret;
723-
724-
ctxt.seid = pf->main_vsi_seid;
725-
ctxt.pf_num = pf->hw.pf_id;
726-
ctxt.vf_num = 0;
727-
aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
728-
if (aq_ret) {
729-
dev_info(&pf->pdev->dev,
730-
"%s couldn't get pf vsi config, err %d, aq_err %d\n",
731-
__func__, aq_ret, pf->hw.aq.asq_last_status);
732-
return;
733-
}
734-
ctxt.flags = I40E_AQ_VSI_TYPE_PF;
735-
ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
736-
ctxt.info.switch_id |= cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
737-
738-
aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);
739-
if (aq_ret) {
740-
dev_info(&pf->pdev->dev,
741-
"%s: update vsi switch failed, aq_err=%d\n",
742-
__func__, vsi->back->hw.aq.asq_last_status);
743-
}
744-
}
745-
746-
/**
747-
* i40e_disable_pf_switch_lb
748-
* @pf: pointer to the pf structure
749-
*
750-
* disable switch loop back or die - no point in a return value
751-
**/
752-
void i40e_disable_pf_switch_lb(struct i40e_pf *pf)
753-
{
754-
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
755-
struct i40e_vsi_context ctxt;
756-
int aq_ret;
757-
758-
ctxt.seid = pf->main_vsi_seid;
759-
ctxt.pf_num = pf->hw.pf_id;
760-
ctxt.vf_num = 0;
761-
aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
762-
if (aq_ret) {
763-
dev_info(&pf->pdev->dev,
764-
"%s couldn't get pf vsi config, err %d, aq_err %d\n",
765-
__func__, aq_ret, pf->hw.aq.asq_last_status);
766-
return;
767-
}
768-
ctxt.flags = I40E_AQ_VSI_TYPE_PF;
769-
ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
770-
ctxt.info.switch_id &= ~cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
771-
772-
aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);
773-
if (aq_ret) {
774-
dev_info(&pf->pdev->dev,
775-
"%s: update vsi switch failed, aq_err=%d\n",
776-
__func__, vsi->back->hw.aq.asq_last_status);
777-
}
778-
}
779-
780712
/**
781713
* i40e_free_vfs
782714
* @pf: pointer to the pf structure

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,5 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);
126126

127127
void i40e_vc_notify_link_state(struct i40e_pf *pf);
128128
void i40e_vc_notify_reset(struct i40e_pf *pf);
129-
void i40e_enable_pf_switch_lb(struct i40e_pf *pf);
130-
void i40e_disable_pf_switch_lb(struct i40e_pf *pf);
131129

132130
#endif /* _I40E_VIRTCHNL_PF_H_ */

0 commit comments

Comments
 (0)