Skip to content

Commit 4fc8c67

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
i40e: genericize the partition bandwidth control
Partition bandwidth control is not in just one form of MFP (multi-function partitioning), so make the code more generic and be sure to nudge the Tx scheduler for all MFP. Copyright updated to 2017. Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 83d14c5 commit 4fc8c67

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Driver
4-
* Copyright(c) 2013 - 2016 Intel Corporation.
4+
* Copyright(c) 2013 - 2017 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -516,9 +516,8 @@ struct i40e_pf {
516516
bool ptp_tx;
517517
bool ptp_rx;
518518
u16 rss_table_size; /* HW RSS table size */
519-
/* These are only valid in NPAR modes */
520-
u32 npar_max_bw;
521-
u32 npar_min_bw;
519+
u32 max_bw;
520+
u32 min_bw;
522521

523522
u32 ioremap_len;
524523
u32 fd_inv;
@@ -971,9 +970,9 @@ int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr);
971970
void i40e_ptp_init(struct i40e_pf *pf);
972971
void i40e_ptp_stop(struct i40e_pf *pf);
973972
int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
974-
i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);
975-
i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);
976-
i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
973+
i40e_status i40e_get_partition_bw_setting(struct i40e_pf *pf);
974+
i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf);
975+
i40e_status i40e_commit_partition_bw_setting(struct i40e_pf *pf);
977976
void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);
978977

979978
static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)

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

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
*
33
* Intel Ethernet Controller XL710 Family Linux Driver
4-
* Copyright(c) 2013 - 2016 Intel Corporation.
4+
* Copyright(c) 2013 - 2017 Intel Corporation.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms and conditions of the GNU General Public License,
@@ -8740,10 +8740,10 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count)
87408740
}
87418741

87428742
/**
8743-
* i40e_get_npar_bw_setting - Retrieve BW settings for this PF partition
8743+
* i40e_get_partition_bw_setting - Retrieve BW settings for this PF partition
87448744
* @pf: board private structure
87458745
**/
8746-
i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf)
8746+
i40e_status i40e_get_partition_bw_setting(struct i40e_pf *pf)
87478747
{
87488748
i40e_status status;
87498749
bool min_valid, max_valid;
@@ -8754,27 +8754,27 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf)
87548754

87558755
if (!status) {
87568756
if (min_valid)
8757-
pf->npar_min_bw = min_bw;
8757+
pf->min_bw = min_bw;
87588758
if (max_valid)
8759-
pf->npar_max_bw = max_bw;
8759+
pf->max_bw = max_bw;
87608760
}
87618761

87628762
return status;
87638763
}
87648764

87658765
/**
8766-
* i40e_set_npar_bw_setting - Set BW settings for this PF partition
8766+
* i40e_set_partition_bw_setting - Set BW settings for this PF partition
87678767
* @pf: board private structure
87688768
**/
8769-
i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf)
8769+
i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf)
87708770
{
87718771
struct i40e_aqc_configure_partition_bw_data bw_data;
87728772
i40e_status status;
87738773

87748774
/* Set the valid bit for this PF */
87758775
bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id));
8776-
bw_data.max_bw[pf->hw.pf_id] = pf->npar_max_bw & I40E_ALT_BW_VALUE_MASK;
8777-
bw_data.min_bw[pf->hw.pf_id] = pf->npar_min_bw & I40E_ALT_BW_VALUE_MASK;
8776+
bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK;
8777+
bw_data.min_bw[pf->hw.pf_id] = pf->min_bw & I40E_ALT_BW_VALUE_MASK;
87788778

87798779
/* Set the new bandwidths */
87808780
status = i40e_aq_configure_partition_bw(&pf->hw, &bw_data, NULL);
@@ -8783,10 +8783,10 @@ i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf)
87838783
}
87848784

87858785
/**
8786-
* i40e_commit_npar_bw_setting - Commit BW settings for this PF partition
8786+
* i40e_commit_partition_bw_setting - Commit BW settings for this PF partition
87878787
* @pf: board private structure
87888788
**/
8789-
i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf)
8789+
i40e_status i40e_commit_partition_bw_setting(struct i40e_pf *pf)
87908790
{
87918791
/* Commit temporary BW setting to permanent NVM image */
87928792
enum i40e_admin_queue_err last_aq_status;
@@ -8905,16 +8905,19 @@ static int i40e_sw_init(struct i40e_pf *pf)
89058905
if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.flex10_enable) {
89068906
pf->flags |= I40E_FLAG_MFP_ENABLED;
89078907
dev_info(&pf->pdev->dev, "MFP mode Enabled\n");
8908-
if (i40e_get_npar_bw_setting(pf))
8908+
if (i40e_get_partition_bw_setting(pf)) {
89098909
dev_warn(&pf->pdev->dev,
8910-
"Could not get NPAR bw settings\n");
8911-
else
8910+
"Could not get partition bw settings\n");
8911+
} else {
89128912
dev_info(&pf->pdev->dev,
8913-
"Min BW = %8.8x, Max BW = %8.8x\n",
8914-
pf->npar_min_bw, pf->npar_max_bw);
8913+
"Partition BW Min = %8.8x, Max = %8.8x\n",
8914+
pf->min_bw, pf->max_bw);
8915+
8916+
/* nudge the Tx scheduler */
8917+
i40e_set_partition_bw_setting(pf);
8918+
}
89158919
}
89168920

8917-
/* FW/NVM is not yet fixed in this regard */
89188921
if ((pf->hw.func_caps.fd_filters_guaranteed > 0) ||
89198922
(pf->hw.func_caps.fd_filters_best_effort > 0)) {
89208923
pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
@@ -9017,10 +9020,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
90179020

90189021
mutex_init(&pf->switch_mutex);
90199022

9020-
/* If NPAR is enabled nudge the Tx scheduler */
9021-
if (pf->hw.func_caps.npar_enable && (!i40e_get_npar_bw_setting(pf)))
9022-
i40e_set_npar_bw_setting(pf);
9023-
90249023
sw_init_done:
90259024
return err;
90269025
}

0 commit comments

Comments
 (0)