Commit 247ca657 authored by David S. Miller's avatar David S. Miller

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
100GbE Intel Wired LAN Driver Updates 2021-03-31

This series contains updates to ice driver only.

Benita adds support for XPS.

Ani moves netdev registration to the end of probe to prevent use before
the interface is ready and moves up an error check to possibly avoid
an unneeded call. He also consolidates the VSI state and flag fields to
a single field.

Dan changes the segment where package information is pulled.

Paul S ensures correct ITR values are set when increasing ring size.

Paul G rewords a link misconfiguration message as this could be
expected.

Bruce removes setting an unnecessary AQ flag and corrects a memory
allocation call. Also fixes checkpatch issues for 'COMPLEX_MACRO'.

Qi aligns PTYPE bitmap naming by adding 'ptype' prefix to the bitmaps
missing it.

Brett removes limiting Rx queue mapping to RSS size as there is not a
dependency on this. He also refactors RSS configuration by introducing
individual functions for LUT and key configuration and by passing a
structure containing pertinent information instead of individual
arguments.

Tony corrects a comment block to follow netdev style.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 04080634 a07cc178
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
#define ICE_INVAL_Q_INDEX 0xffff #define ICE_INVAL_Q_INDEX 0xffff
#define ICE_INVAL_VFID 256 #define ICE_INVAL_VFID 256
#define ICE_MAX_RXQS_PER_TC 256 /* Used when setting VSI context per TC Rx queues */
#define ICE_MAX_RESET_WAIT 20 #define ICE_MAX_RESET_WAIT 20
#define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4) #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4)
...@@ -192,7 +193,7 @@ struct ice_sw { ...@@ -192,7 +193,7 @@ struct ice_sw {
u8 dflt_vsi_ena:1; /* true if above dflt_vsi is enabled */ u8 dflt_vsi_ena:1; /* true if above dflt_vsi is enabled */
}; };
enum ice_state { enum ice_pf_state {
__ICE_TESTING, __ICE_TESTING,
__ICE_DOWN, __ICE_DOWN,
__ICE_NEEDS_RESTART, __ICE_NEEDS_RESTART,
...@@ -235,12 +236,14 @@ enum ice_state { ...@@ -235,12 +236,14 @@ enum ice_state {
__ICE_STATE_NBITS /* must be last */ __ICE_STATE_NBITS /* must be last */
}; };
enum ice_vsi_flags { enum ice_vsi_state {
ICE_VSI_FLAG_UMAC_FLTR_CHANGED, ICE_VSI_DOWN,
ICE_VSI_FLAG_MMAC_FLTR_CHANGED, ICE_VSI_NEEDS_RESTART,
ICE_VSI_FLAG_VLAN_FLTR_CHANGED, ICE_VSI_UMAC_FLTR_CHANGED,
ICE_VSI_FLAG_PROMISC_CHANGED, ICE_VSI_MMAC_FLTR_CHANGED,
ICE_VSI_FLAG_NBITS /* must be last */ ICE_VSI_VLAN_FLTR_CHANGED,
ICE_VSI_PROMISC_CHANGED,
ICE_VSI_STATE_NBITS /* must be last */
}; };
/* struct that defines a VSI, associated with a dev */ /* struct that defines a VSI, associated with a dev */
...@@ -256,8 +259,7 @@ struct ice_vsi { ...@@ -256,8 +259,7 @@ struct ice_vsi {
irqreturn_t (*irq_handler)(int irq, void *data); irqreturn_t (*irq_handler)(int irq, void *data);
u64 tx_linearize; u64 tx_linearize;
DECLARE_BITMAP(state, __ICE_STATE_NBITS); DECLARE_BITMAP(state, ICE_VSI_STATE_NBITS);
DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS);
unsigned int current_netdev_flags; unsigned int current_netdev_flags;
u32 tx_restart; u32 tx_restart;
u32 tx_busy; u32 tx_busy;
...@@ -503,7 +505,7 @@ ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, ...@@ -503,7 +505,7 @@ ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi,
val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M | val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |
(itr << GLINT_DYN_CTL_ITR_INDX_S); (itr << GLINT_DYN_CTL_ITR_INDX_S);
if (vsi) if (vsi)
if (test_bit(__ICE_DOWN, vsi->state)) if (test_bit(ICE_VSI_DOWN, vsi->state))
return; return;
wr32(hw, GLINT_DYN_CTL(vector), val); wr32(hw, GLINT_DYN_CTL(vector), val);
} }
...@@ -620,8 +622,10 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi); ...@@ -620,8 +622,10 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi);
int int
ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
u32 flags); u32 flags);
int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size);
int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size);
int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed);
int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed);
void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
void ice_print_link_msg(struct ice_vsi *vsi, bool isup); void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
......
...@@ -1407,8 +1407,7 @@ struct ice_aqc_nvm_comp_tbl { ...@@ -1407,8 +1407,7 @@ struct ice_aqc_nvm_comp_tbl {
u8 cvs[]; /* Component Version String */ u8 cvs[]; /* Component Version String */
} __packed; } __packed;
/* /* Send to PF command (indirect 0x0801) ID is only used by PF
* Send to PF command (indirect 0x0801) ID is only used by PF
* *
* Send to VF command (indirect 0x0802) ID is only used by PF * Send to VF command (indirect 0x0802) ID is only used by PF
* *
...@@ -1790,6 +1789,7 @@ struct ice_pkg_ver { ...@@ -1790,6 +1789,7 @@ struct ice_pkg_ver {
}; };
#define ICE_PKG_NAME_SIZE 32 #define ICE_PKG_NAME_SIZE 32
#define ICE_SEG_ID_SIZE 28
#define ICE_SEG_NAME_SIZE 28 #define ICE_SEG_NAME_SIZE 28
struct ice_aqc_get_pkg_info { struct ice_aqc_get_pkg_info {
......
...@@ -581,8 +581,7 @@ void ice_free_cpu_rx_rmap(struct ice_vsi *vsi) ...@@ -581,8 +581,7 @@ void ice_free_cpu_rx_rmap(struct ice_vsi *vsi)
return; return;
netdev = vsi->netdev; netdev = vsi->netdev;
if (!netdev || !netdev->rx_cpu_rmap || if (!netdev || !netdev->rx_cpu_rmap)
netdev->reg_state != NETREG_REGISTERED)
return; return;
free_irq_cpu_rmap(netdev->rx_cpu_rmap); free_irq_cpu_rmap(netdev->rx_cpu_rmap);
...@@ -604,8 +603,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi) ...@@ -604,8 +603,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)
pf = vsi->back; pf = vsi->back;
netdev = vsi->netdev; netdev = vsi->netdev;
if (!pf || !netdev || !vsi->num_q_vectors || if (!pf || !netdev || !vsi->num_q_vectors)
vsi->netdev->reg_state != NETREG_REGISTERED)
return -EINVAL; return -EINVAL;
netdev_dbg(netdev, "Setup CPU RMAP: vsi type 0x%x, ifname %s, q_vectors %d\n", netdev_dbg(netdev, "Setup CPU RMAP: vsi type 0x%x, ifname %s, q_vectors %d\n",
......
...@@ -214,6 +214,26 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc) ...@@ -214,6 +214,26 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc)
return ring->q_index - vsi->tc_cfg.tc_info[tc].qoffset; return ring->q_index - vsi->tc_cfg.tc_info[tc].qoffset;
} }
/**
* ice_cfg_xps_tx_ring - Configure XPS for a Tx ring
* @ring: The Tx ring to configure
*
* This enables/disables XPS for a given Tx descriptor ring
* based on the TCs enabled for the VSI that ring belongs to.
*/
static void ice_cfg_xps_tx_ring(struct ice_ring *ring)
{
if (!ring->q_vector || !ring->netdev)
return;
/* We only initialize XPS once, so as not to overwrite user settings */
if (test_and_set_bit(ICE_TX_XPS_INIT_DONE, ring->xps_state))
return;
netif_set_xps_queue(ring->netdev, &ring->q_vector->affinity_mask,
ring->q_index);
}
/** /**
* ice_setup_tx_ctx - setup a struct ice_tlan_ctx instance * ice_setup_tx_ctx - setup a struct ice_tlan_ctx instance
* @ring: The Tx ring to configure * @ring: The Tx ring to configure
...@@ -664,6 +684,9 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring, ...@@ -664,6 +684,9 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
u16 pf_q; u16 pf_q;
u8 tc; u8 tc;
/* Configure XPS */
ice_cfg_xps_tx_ring(ring);
pf_q = ring->reg_idx; pf_q = ring->reg_idx;
ice_setup_tx_ctx(ring, &tlan_ctx, pf_q); ice_setup_tx_ctx(ring, &tlan_ctx, pf_q);
/* copy context contents into the qg_buf */ /* copy context contents into the qg_buf */
......
...@@ -3186,7 +3186,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, ...@@ -3186,7 +3186,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_sff_eeprom); ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_sff_eeprom);
cmd = &desc.params.read_write_sff_param; cmd = &desc.params.read_write_sff_param;
desc.flags = cpu_to_le16(ICE_AQ_FLAG_RD | ICE_AQ_FLAG_BUF); desc.flags = cpu_to_le16(ICE_AQ_FLAG_RD);
cmd->lport_num = (u8)(lport & 0xff); cmd->lport_num = (u8)(lport & 0xff);
cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); cmd->lport_num_valid = (u8)((lport >> 8) & 0x01);
cmd->i2c_bus_addr = cpu_to_le16(((bus_addr >> 1) & cmd->i2c_bus_addr = cpu_to_le16(((bus_addr >> 1) &
...@@ -3206,23 +3206,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, ...@@ -3206,23 +3206,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
/** /**
* __ice_aq_get_set_rss_lut * __ice_aq_get_set_rss_lut
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @vsi_id: VSI FW index * @params: RSS LUT parameters
* @lut_type: LUT table type
* @lut: pointer to the LUT buffer provided by the caller
* @lut_size: size of the LUT buffer
* @glob_lut_idx: global LUT index
* @set: set true to set the table, false to get the table * @set: set true to set the table, false to get the table
* *
* Internal function to get (0x0B05) or set (0x0B03) RSS look up table * Internal function to get (0x0B05) or set (0x0B03) RSS look up table
*/ */
static enum ice_status static enum ice_status
__ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set)
u16 lut_size, u8 glob_lut_idx, bool set)
{ {
u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle;
struct ice_aqc_get_set_rss_lut *cmd_resp; struct ice_aqc_get_set_rss_lut *cmd_resp;
struct ice_aq_desc desc; struct ice_aq_desc desc;
enum ice_status status; enum ice_status status;
u16 flags = 0; u8 *lut;
if (!params)
return ICE_ERR_PARAM;
vsi_handle = params->vsi_handle;
lut = params->lut;
if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
return ICE_ERR_PARAM;
lut_size = params->lut_size;
lut_type = params->lut_type;
glob_lut_idx = params->global_lut_id;
vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
cmd_resp = &desc.params.get_set_rss_lut; cmd_resp = &desc.params.get_set_rss_lut;
...@@ -3296,43 +3306,27 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ...@@ -3296,43 +3306,27 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
/** /**
* ice_aq_get_rss_lut * ice_aq_get_rss_lut
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle * @get_params: RSS LUT parameters used to specify which RSS LUT to get
* @lut_type: LUT table type
* @lut: pointer to the LUT buffer provided by the caller
* @lut_size: size of the LUT buffer
* *
* get the RSS lookup table, PF or VSI type * get the RSS lookup table, PF or VSI type
*/ */
enum ice_status enum ice_status
ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params)
u8 *lut, u16 lut_size)
{ {
if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) return __ice_aq_get_set_rss_lut(hw, get_params, false);
return ICE_ERR_PARAM;
return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle),
lut_type, lut, lut_size, 0, false);
} }
/** /**
* ice_aq_set_rss_lut * ice_aq_set_rss_lut
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @vsi_handle: software VSI handle * @set_params: RSS LUT parameters used to specify how to set the RSS LUT
* @lut_type: LUT table type
* @lut: pointer to the LUT buffer provided by the caller
* @lut_size: size of the LUT buffer
* *
* set the RSS lookup table, PF or VSI type * set the RSS lookup table, PF or VSI type
*/ */
enum ice_status enum ice_status
ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params)
u8 *lut, u16 lut_size)
{ {
if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) return __ice_aq_get_set_rss_lut(hw, set_params, true);
return ICE_ERR_PARAM;
return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle),
lut_type, lut, lut_size, 0, true);
} }
/** /**
......
...@@ -51,11 +51,9 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx, ...@@ -51,11 +51,9 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
u32 rxq_index); u32 rxq_index);
enum ice_status enum ice_status
ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);
u16 lut_size);
enum ice_status enum ice_status
ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params);
u16 lut_size);
enum ice_status enum ice_status
ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle, ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle,
struct ice_aqc_get_set_rss_keys *keys); struct ice_aqc_get_set_rss_keys *keys);
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
(&(((struct ice_aq_desc *)((R).desc_buf.va))[i])) (&(((struct ice_aq_desc *)((R).desc_buf.va))[i]))
#define ICE_CTL_Q_DESC_UNUSED(R) \ #define ICE_CTL_Q_DESC_UNUSED(R) \
(u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ ((u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
(R)->next_to_clean - (R)->next_to_use - 1) (R)->next_to_clean - (R)->next_to_use - 1))
/* Defines that help manage the driver vs FW API checks. /* Defines that help manage the driver vs FW API checks.
* Take a look at ice_aq_ver_check in ice_controlq.c for actual usage. * Take a look at ice_aq_ver_check in ice_controlq.c for actual usage.
......
...@@ -2886,7 +2886,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) ...@@ -2886,7 +2886,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
/* Bring interface down, copy in the new ring info, then restore the /* Bring interface down, copy in the new ring info, then restore the
* interface. if VSI is up, bring it down and then back up * interface. if VSI is up, bring it down and then back up
*/ */
if (!test_and_set_bit(__ICE_DOWN, vsi->state)) { if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {
ice_down(vsi); ice_down(vsi);
if (tx_rings) { if (tx_rings) {
...@@ -3140,7 +3140,7 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) ...@@ -3140,7 +3140,7 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
int ret = 0, i; int err, i;
u8 *lut; u8 *lut;
if (hfunc) if (hfunc)
...@@ -3159,17 +3159,20 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) ...@@ -3159,17 +3159,20 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
if (!lut) if (!lut)
return -ENOMEM; return -ENOMEM;
if (ice_get_rss(vsi, key, lut, vsi->rss_table_size)) { err = ice_get_rss_key(vsi, key);
ret = -EIO; if (err)
goto out;
err = ice_get_rss_lut(vsi, lut, vsi->rss_table_size);
if (err)
goto out; goto out;
}
for (i = 0; i < vsi->rss_table_size; i++) for (i = 0; i < vsi->rss_table_size; i++)
indir[i] = (u32)(lut[i]); indir[i] = (u32)(lut[i]);
out: out:
kfree(lut); kfree(lut);
return ret; return err;
} }
/** /**
...@@ -3190,7 +3193,7 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -3190,7 +3193,7 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
struct device *dev; struct device *dev;
u8 *seed = NULL; int err;
dev = ice_pf_to_dev(pf); dev = ice_pf_to_dev(pf);
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
...@@ -3211,7 +3214,10 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -3211,7 +3214,10 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
return -ENOMEM; return -ENOMEM;
} }
memcpy(vsi->rss_hkey_user, key, ICE_VSIQF_HKEY_ARRAY_SIZE); memcpy(vsi->rss_hkey_user, key, ICE_VSIQF_HKEY_ARRAY_SIZE);
seed = vsi->rss_hkey_user;
err = ice_set_rss_key(vsi, vsi->rss_hkey_user);
if (err)
return err;
} }
if (!vsi->rss_lut_user) { if (!vsi->rss_lut_user) {
...@@ -3232,8 +3238,9 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -3232,8 +3238,9 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
vsi->rss_size); vsi->rss_size);
} }
if (ice_set_rss(vsi, seed, vsi->rss_lut_user, vsi->rss_table_size)) err = ice_set_rss_lut(vsi, vsi->rss_lut_user, vsi->rss_table_size);
return -EIO; if (err)
return err;
return 0; return 0;
} }
...@@ -3329,10 +3336,9 @@ static int ice_get_valid_rss_size(struct ice_hw *hw, int new_size) ...@@ -3329,10 +3336,9 @@ static int ice_get_valid_rss_size(struct ice_hw *hw, int new_size)
static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size) static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size)
{ {
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
enum ice_status status;
struct device *dev; struct device *dev;
struct ice_hw *hw; struct ice_hw *hw;
int err = 0; int err;
u8 *lut; u8 *lut;
dev = ice_pf_to_dev(pf); dev = ice_pf_to_dev(pf);
...@@ -3353,14 +3359,10 @@ static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size) ...@@ -3353,14 +3359,10 @@ static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size)
/* create/set RSS LUT */ /* create/set RSS LUT */
ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size); ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size);
status = ice_aq_set_rss_lut(hw, vsi->idx, vsi->rss_lut_type, lut, err = ice_set_rss_lut(vsi, lut, vsi->rss_table_size);
vsi->rss_table_size); if (err)
if (status) { dev_err(dev, "Cannot set RSS lut, err %d aq_err %s\n", err,
dev_err(dev, "Cannot set RSS lut, err %s aq_err %s\n",
ice_stat_str(status),
ice_aq_str(hw->adminq.sq_last_status)); ice_aq_str(hw->adminq.sq_last_status));
err = -EIO;
}
kfree(lut); kfree(lut);
return err; return err;
...@@ -3926,14 +3928,14 @@ ice_get_module_eeprom(struct net_device *netdev, ...@@ -3926,14 +3928,14 @@ ice_get_module_eeprom(struct net_device *netdev,
u8 value = 0; u8 value = 0;
u8 page = 0; u8 page = 0;
status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0,
&value, 1, 0, NULL);
if (status)
return -EIO;
if (!ee || !ee->len || !data) if (!ee || !ee->len || !data)
return -EINVAL; return -EINVAL;
status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0, &value, 1, 0,
NULL);
if (status)
return -EIO;
if (value == ICE_MODULE_TYPE_SFP) if (value == ICE_MODULE_TYPE_SFP)
is_sfp = true; is_sfp = true;
......
...@@ -1063,32 +1063,36 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg) ...@@ -1063,32 +1063,36 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)
static enum ice_status static enum ice_status
ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)
{ {
struct ice_global_metadata_seg *meta_seg;
struct ice_generic_seg_hdr *seg_hdr; struct ice_generic_seg_hdr *seg_hdr;
if (!pkg_hdr) if (!pkg_hdr)
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
meta_seg = (struct ice_global_metadata_seg *) seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr);
ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr); if (seg_hdr) {
if (meta_seg) { struct ice_meta_sect *meta;
hw->pkg_ver = meta_seg->pkg_ver; struct ice_pkg_enum state;
memcpy(hw->pkg_name, meta_seg->pkg_name, sizeof(hw->pkg_name));
memset(&state, 0, sizeof(state));
/* Get package information from the Metadata Section */
meta = ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state,
ICE_SID_METADATA);
if (!meta) {
ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n");
return ICE_ERR_CFG;
}
hw->pkg_ver = meta->ver;
memcpy(hw->pkg_name, meta->name, sizeof(meta->name));
ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n",
meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor, meta->ver.major, meta->ver.minor, meta->ver.update,
meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, meta->ver.draft, meta->name);
meta_seg->pkg_name);
} else {
ice_debug(hw, ICE_DBG_INIT, "Did not find metadata segment in driver package\n");
return ICE_ERR_CFG;
}
seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver;
if (seg_hdr) { memcpy(hw->ice_seg_id, seg_hdr->seg_id,
hw->ice_pkg_ver = seg_hdr->seg_format_ver; sizeof(hw->ice_seg_id));
memcpy(hw->ice_pkg_name, seg_hdr->seg_id,
sizeof(hw->ice_pkg_name));
ice_debug(hw, ICE_DBG_PKG, "Ice Seg: %d.%d.%d.%d, %s\n", ice_debug(hw, ICE_DBG_PKG, "Ice Seg: %d.%d.%d.%d, %s\n",
seg_hdr->seg_format_ver.major, seg_hdr->seg_format_ver.major,
......
...@@ -109,6 +109,7 @@ struct ice_buf_hdr { ...@@ -109,6 +109,7 @@ struct ice_buf_hdr {
(ent_sz)) (ent_sz))
/* ice package section IDs */ /* ice package section IDs */
#define ICE_SID_METADATA 1
#define ICE_SID_XLT0_SW 10 #define ICE_SID_XLT0_SW 10
#define ICE_SID_XLT_KEY_BUILDER_SW 11 #define ICE_SID_XLT_KEY_BUILDER_SW 11
#define ICE_SID_XLT1_SW 12 #define ICE_SID_XLT1_SW 12
...@@ -117,6 +118,14 @@ struct ice_buf_hdr { ...@@ -117,6 +118,14 @@ struct ice_buf_hdr {
#define ICE_SID_PROFID_REDIR_SW 15 #define ICE_SID_PROFID_REDIR_SW 15
#define ICE_SID_FLD_VEC_SW 16 #define ICE_SID_FLD_VEC_SW 16
#define ICE_SID_CDID_KEY_BUILDER_SW 17 #define ICE_SID_CDID_KEY_BUILDER_SW 17
struct ice_meta_sect {
struct ice_pkg_ver ver;
#define ICE_META_SECT_NAME_SIZE 28
char name[ICE_META_SECT_NAME_SIZE];
__le32 track_id;
};
#define ICE_SID_CDID_REDIR_SW 18 #define ICE_SID_CDID_REDIR_SW 18
#define ICE_SID_XLT0_ACL 20 #define ICE_SID_XLT0_ACL 20
...@@ -488,8 +497,8 @@ struct ice_xlt1 { ...@@ -488,8 +497,8 @@ struct ice_xlt1 {
#define ICE_PF_NUM_S 13 #define ICE_PF_NUM_S 13
#define ICE_PF_NUM_M (0x07 << ICE_PF_NUM_S) #define ICE_PF_NUM_M (0x07 << ICE_PF_NUM_S)
#define ICE_VSIG_VALUE(vsig, pf_id) \ #define ICE_VSIG_VALUE(vsig, pf_id) \
(u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \ ((u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \
(((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M)) (((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M)))
#define ICE_DEFAULT_VSIG 0 #define ICE_DEFAULT_VSIG 0
/* XLT2 Table */ /* XLT2 Table */
......
...@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv6_il[] = { ...@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv6_il[] = {
}; };
/* Packet types for packets with an Outer/First/Single IPv4 header - no L4 */ /* Packet types for packets with an Outer/First/Single IPv4 header - no L4 */
static const u32 ice_ipv4_ofos_no_l4[] = { static const u32 ice_ptypes_ipv4_ofos_no_l4[] = {
0x10C00000, 0x04000800, 0x00000000, 0x00000000, 0x10C00000, 0x04000800, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
...@@ -262,7 +262,7 @@ static const u32 ice_ptypes_arp_of[] = { ...@@ -262,7 +262,7 @@ static const u32 ice_ptypes_arp_of[] = {
}; };
/* Packet types for packets with an Innermost/Last IPv4 header - no L4 */ /* Packet types for packets with an Innermost/Last IPv4 header - no L4 */
static const u32 ice_ipv4_il_no_l4[] = { static const u32 ice_ptypes_ipv4_il_no_l4[] = {
0x60000000, 0x18043008, 0x80000002, 0x6010c021, 0x60000000, 0x18043008, 0x80000002, 0x6010c021,
0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
...@@ -274,7 +274,7 @@ static const u32 ice_ipv4_il_no_l4[] = { ...@@ -274,7 +274,7 @@ static const u32 ice_ipv4_il_no_l4[] = {
}; };
/* Packet types for packets with an Outer/First/Single IPv6 header - no L4 */ /* Packet types for packets with an Outer/First/Single IPv6 header - no L4 */
static const u32 ice_ipv6_ofos_no_l4[] = { static const u32 ice_ptypes_ipv6_ofos_no_l4[] = {
0x00000000, 0x00000000, 0x43000000, 0x10002000, 0x00000000, 0x00000000, 0x43000000, 0x10002000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
...@@ -286,7 +286,7 @@ static const u32 ice_ipv6_ofos_no_l4[] = { ...@@ -286,7 +286,7 @@ static const u32 ice_ipv6_ofos_no_l4[] = {
}; };
/* Packet types for packets with an Innermost/Last IPv6 header - no L4 */ /* Packet types for packets with an Innermost/Last IPv6 header - no L4 */
static const u32 ice_ipv6_il_no_l4[] = { static const u32 ice_ptypes_ipv6_il_no_l4[] = {
0x00000000, 0x02180430, 0x0000010c, 0x086010c0, 0x00000000, 0x02180430, 0x0000010c, 0x086010c0,
0x00000430, 0x00000000, 0x00000000, 0x00000000, 0x00000430, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
...@@ -749,8 +749,8 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) ...@@ -749,8 +749,8 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
ICE_FLOW_PTYPE_MAX); ICE_FLOW_PTYPE_MAX);
} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) && } else if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) &&
!(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) { !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) {
src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 : src = !i ? (const unsigned long *)ice_ptypes_ipv4_ofos_no_l4 :
(const unsigned long *)ice_ipv4_il_no_l4; (const unsigned long *)ice_ptypes_ipv4_il_no_l4;
bitmap_and(params->ptypes, params->ptypes, src, bitmap_and(params->ptypes, params->ptypes, src,
ICE_FLOW_PTYPE_MAX); ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_IPV4) { } else if (hdrs & ICE_FLOW_SEG_HDR_IPV4) {
...@@ -760,8 +760,8 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) ...@@ -760,8 +760,8 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
ICE_FLOW_PTYPE_MAX); ICE_FLOW_PTYPE_MAX);
} else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) && } else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) &&
!(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) { !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) {
src = !i ? (const unsigned long *)ice_ipv6_ofos_no_l4 : src = !i ? (const unsigned long *)ice_ptypes_ipv6_ofos_no_l4 :
(const unsigned long *)ice_ipv6_il_no_l4; (const unsigned long *)ice_ptypes_ipv6_il_no_l4;
bitmap_and(params->ptypes, params->ptypes, src, bitmap_and(params->ptypes, params->ptypes, src,
ICE_FLOW_PTYPE_MAX); ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_IPV6) { } else if (hdrs & ICE_FLOW_SEG_HDR_IPV6) {
...@@ -2008,9 +2008,9 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof) ...@@ -2008,9 +2008,9 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
* [63] - Encapsulation flag, 0 if non-tunneled, 1 if tunneled * [63] - Encapsulation flag, 0 if non-tunneled, 1 if tunneled
*/ */
#define ICE_FLOW_GEN_PROFID(hash, hdr, segs_cnt) \ #define ICE_FLOW_GEN_PROFID(hash, hdr, segs_cnt) \
(u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \ ((u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \
(((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \ (((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \
((u8)((segs_cnt) - 1) ? ICE_FLOW_PROF_ENCAP_M : 0)) ((u8)((segs_cnt) - 1) ? ICE_FLOW_PROF_ENCAP_M : 0)))
/** /**
* ice_add_rss_cfg_sync - add an RSS configuration * ice_add_rss_cfg_sync - add an RSS configuration
......
This diff is collapsed.
This diff is collapsed.
...@@ -920,7 +920,7 @@ ice_create_vsi_list_map(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, ...@@ -920,7 +920,7 @@ ice_create_vsi_list_map(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi,
struct ice_vsi_list_map_info *v_map; struct ice_vsi_list_map_info *v_map;
int i; int i;
v_map = devm_kcalloc(ice_hw_to_dev(hw), 1, sizeof(*v_map), GFP_KERNEL); v_map = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*v_map), GFP_KERNEL);
if (!v_map) if (!v_map)
return NULL; return NULL;
......
...@@ -309,7 +309,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget) ...@@ -309,7 +309,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget)
smp_mb(); smp_mb();
if (__netif_subqueue_stopped(tx_ring->netdev, if (__netif_subqueue_stopped(tx_ring->netdev,
tx_ring->q_index) && tx_ring->q_index) &&
!test_bit(__ICE_DOWN, vsi->state)) { !test_bit(ICE_VSI_DOWN, vsi->state)) {
netif_wake_subqueue(tx_ring->netdev, netif_wake_subqueue(tx_ring->netdev,
tx_ring->q_index); tx_ring->q_index);
++tx_ring->tx_stats.restart_q; ++tx_ring->tx_stats.restart_q;
...@@ -569,7 +569,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, ...@@ -569,7 +569,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
struct ice_ring *xdp_ring; struct ice_ring *xdp_ring;
int nxmit = 0, i; int nxmit = 0, i;
if (test_bit(__ICE_DOWN, vsi->state)) if (test_bit(ICE_VSI_DOWN, vsi->state))
return -ENETDOWN; return -ENETDOWN;
if (!ice_is_xdp_ena_vsi(vsi) || queue_index >= vsi->num_xdp_txq) if (!ice_is_xdp_ena_vsi(vsi) || queue_index >= vsi->num_xdp_txq)
...@@ -1520,7 +1520,7 @@ static void ice_update_ena_itr(struct ice_q_vector *q_vector) ...@@ -1520,7 +1520,7 @@ static void ice_update_ena_itr(struct ice_q_vector *q_vector)
q_vector->itr_countdown--; q_vector->itr_countdown--;
} }
if (!test_bit(__ICE_DOWN, vsi->state)) if (!test_bit(ICE_VSI_DOWN, vsi->state))
wr32(&vsi->back->hw, GLINT_DYN_CTL(q_vector->reg_idx), itr_val); wr32(&vsi->back->hw, GLINT_DYN_CTL(q_vector->reg_idx), itr_val);
} }
......
...@@ -195,6 +195,11 @@ struct ice_rxq_stats { ...@@ -195,6 +195,11 @@ struct ice_rxq_stats {
u64 gro_dropped; /* GRO returned dropped */ u64 gro_dropped; /* GRO returned dropped */
}; };
enum ice_ring_state_t {
ICE_TX_XPS_INIT_DONE,
ICE_TX_NBITS,
};
/* this enum matches hardware bits and is meant to be used by DYN_CTLN /* this enum matches hardware bits and is meant to be used by DYN_CTLN
* registers and QINT registers or more generally anywhere in the manual * registers and QINT registers or more generally anywhere in the manual
* mentioning ITR_INDX, ITR_NONE cannot be used as an index 'n' into any * mentioning ITR_INDX, ITR_NONE cannot be used as an index 'n' into any
...@@ -292,6 +297,7 @@ struct ice_ring { ...@@ -292,6 +297,7 @@ struct ice_ring {
}; };
struct rcu_head rcu; /* to avoid race on free */ struct rcu_head rcu; /* to avoid race on free */
DECLARE_BITMAP(xps_state, ICE_TX_NBITS); /* XPS Config State */
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
struct xsk_buff_pool *xsk_pool; struct xsk_buff_pool *xsk_pool;
u16 rx_offset; u16 rx_offset;
...@@ -351,6 +357,8 @@ struct ice_coalesce_stored { ...@@ -351,6 +357,8 @@ struct ice_coalesce_stored {
u16 itr_tx; u16 itr_tx;
u16 itr_rx; u16 itr_rx;
u8 intrl; u8 intrl;
u8 tx_valid;
u8 rx_valid;
}; };
/* iterator for handling rings in ring container */ /* iterator for handling rings in ring container */
......
...@@ -720,13 +720,13 @@ struct ice_hw { ...@@ -720,13 +720,13 @@ struct ice_hw {
enum ice_aq_err pkg_dwnld_status; enum ice_aq_err pkg_dwnld_status;
/* Driver's package ver - (from the Metadata seg) */ /* Driver's package ver - (from the Ice Metadata section) */
struct ice_pkg_ver pkg_ver; struct ice_pkg_ver pkg_ver;
u8 pkg_name[ICE_PKG_NAME_SIZE]; u8 pkg_name[ICE_PKG_NAME_SIZE];
/* Driver's Ice package version (from the Ice seg) */ /* Driver's Ice segment format version and ID (from the Ice seg) */
struct ice_pkg_ver ice_pkg_ver; struct ice_pkg_ver ice_seg_fmt_ver;
u8 ice_pkg_name[ICE_PKG_NAME_SIZE]; u8 ice_seg_id[ICE_SEG_ID_SIZE];
/* Pointer to the ice segment */ /* Pointer to the ice segment */
struct ice_seg *seg; struct ice_seg *seg;
...@@ -827,6 +827,14 @@ struct ice_hw_port_stats { ...@@ -827,6 +827,14 @@ struct ice_hw_port_stats {
u64 fd_sb_match; u64 fd_sb_match;
}; };
struct ice_aq_get_set_rss_lut_params {
u16 vsi_handle; /* software VSI handle */
u16 lut_size; /* size of the LUT buffer */
u8 lut_type; /* type of the LUT (i.e. VSI, PF, Global) */
u8 *lut; /* input RSS LUT for set and output RSS LUT for get */
u8 global_lut_id; /* only valid when lut_type is global */
};
/* Checksum and Shadow RAM pointers */ /* Checksum and Shadow RAM pointers */
#define ICE_SR_NVM_CTRL_WORD 0x00 #define ICE_SR_NVM_CTRL_WORD 0x00
#define ICE_SR_BOOT_CFG_PTR 0x132 #define ICE_SR_BOOT_CFG_PTR 0x132
......
...@@ -2233,7 +2233,7 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) ...@@ -2233,7 +2233,7 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
if (ice_set_rss(vsi, vrk->key, NULL, 0)) if (ice_set_rss_key(vsi, vrk->key))
v_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR; v_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;
error_param: error_param:
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_KEY, v_ret, return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_KEY, v_ret,
...@@ -2280,7 +2280,7 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) ...@@ -2280,7 +2280,7 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
if (ice_set_rss(vsi, NULL, vrl->lut, ICE_VSIQF_HLUT_ARRAY_SIZE)) if (ice_set_rss_lut(vsi, vrl->lut, ICE_VSIQF_HLUT_ARRAY_SIZE))
v_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR; v_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;
error_param: error_param:
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_LUT, v_ret, return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_LUT, v_ret,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment