Commit 27aa6228 authored by David S. Miller's avatar David S. Miller

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

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2020-02-15

This series contains updates to ice driver only.

Brett adds support for "Queue in Queue" (QinQ) support, by supporting
S-tag & C-tag VLAN traffic by disabling pruning when there are no 0x8100
VLAN interfaces currently on top of the PF.  Also refactored the port
VLAN configuration to re-use the common code for enabling and disabling
a port VLAN in single function.  Added a helper function to determine if
the VF link is up.  Fixed how the port VLAN configures the priority bits
for a VF interface.  Fixed the port VLAN to only see its own broadcast
and multicast traffic.  Added support to enable and disable all receive
queues, by refactoring adding a new function to do the necessary steps
to enable/disable a queue with the necessary read flush.  Fixed how we
set the mapping mode for transmit and receive queues.  Added support for
VF queues to handle LAN overflow events.  Fixed and refactored how
receive queues get disabled for VFs, which was being handled one queue
at at time, so improve it to handle when the VF is requesting more than
one queue to be disabled.  Fixed how the virtchnl_queue_select bitmap is
validated.

Finally a patch not authored by Brett, Bruce cleans up "fallthrough"
comments which are unnecessary.  Also replaces the "fallthough" comments
with the GCC reserved word fallthrough, along with other GCC compiler
fixes.  Add missing function header comment regarding a function
argument that was missing.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2bd5662d fb0c5b05
...@@ -1661,6 +1661,13 @@ struct ice_aqc_get_pkg_info_resp { ...@@ -1661,6 +1661,13 @@ struct ice_aqc_get_pkg_info_resp {
struct ice_aqc_get_pkg_info pkg_info[1]; struct ice_aqc_get_pkg_info pkg_info[1];
}; };
/* Lan Queue Overflow Event (direct, 0x1001) */
struct ice_aqc_event_lan_overflow {
__le32 prtdcb_ruptq;
__le32 qtx_ctl;
u8 reserved[8];
};
/** /**
* struct ice_aq_desc - Admin Queue (AQ) descriptor * struct ice_aq_desc - Admin Queue (AQ) descriptor
* @flags: ICE_AQ_FLAG_* flags * @flags: ICE_AQ_FLAG_* flags
...@@ -1730,6 +1737,7 @@ struct ice_aq_desc { ...@@ -1730,6 +1737,7 @@ struct ice_aq_desc {
struct ice_aqc_alloc_free_res_cmd sw_res_ctrl; struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
struct ice_aqc_set_event_mask set_event_mask; struct ice_aqc_set_event_mask set_event_mask;
struct ice_aqc_get_link_status get_link_status; struct ice_aqc_get_link_status get_link_status;
struct ice_aqc_event_lan_overflow lan_overflow;
} params; } params;
}; };
...@@ -1860,6 +1868,9 @@ enum ice_adminq_opc { ...@@ -1860,6 +1868,9 @@ enum ice_adminq_opc {
ice_aqc_opc_update_pkg = 0x0C42, ice_aqc_opc_update_pkg = 0x0C42,
ice_aqc_opc_get_pkg_info_list = 0x0C43, ice_aqc_opc_get_pkg_info_list = 0x0C43,
/* Standalone Commands/Events */
ice_aqc_opc_event_lan_overflow = 0x1001,
/* debug commands */ /* debug commands */
ice_aqc_opc_fw_logging = 0xFF09, ice_aqc_opc_fw_logging = 0xFF09,
ice_aqc_opc_fw_logging_info = 0xFF10, ice_aqc_opc_fw_logging_info = 0xFF10,
......
...@@ -247,7 +247,6 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q) ...@@ -247,7 +247,6 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
*/ */
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_LB: case ICE_VSI_LB:
/* fall through */
case ICE_VSI_PF: case ICE_VSI_PF:
tlan_ctx->vmvf_type = ICE_TLAN_CTX_VMVF_TYPE_PF; tlan_ctx->vmvf_type = ICE_TLAN_CTX_VMVF_TYPE_PF;
break; break;
...@@ -459,17 +458,20 @@ int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg) ...@@ -459,17 +458,20 @@ int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg)
} }
/** /**
* ice_vsi_ctrl_rx_ring - Start or stop a VSI's Rx ring * ice_vsi_ctrl_one_rx_ring - start/stop VSI's Rx ring with no busy wait
* @vsi: the VSI being configured * @vsi: the VSI being configured
* @ena: start or stop the Rx rings * @ena: start or stop the Rx ring
* @rxq_idx: Rx queue index * @rxq_idx: 0-based Rx queue index for the VSI passed in
* @wait: wait or don't wait for configuration to finish in hardware
*
* Return 0 on success and negative on error.
*/ */
int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx) int
ice_vsi_ctrl_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx, bool wait)
{ {
int pf_q = vsi->rxq_map[rxq_idx]; int pf_q = vsi->rxq_map[rxq_idx];
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
int ret = 0;
u32 rx_reg; u32 rx_reg;
rx_reg = rd32(hw, QRX_CTRL(pf_q)); rx_reg = rd32(hw, QRX_CTRL(pf_q));
...@@ -485,13 +487,30 @@ int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx) ...@@ -485,13 +487,30 @@ int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx)
rx_reg &= ~QRX_CTRL_QENA_REQ_M; rx_reg &= ~QRX_CTRL_QENA_REQ_M;
wr32(hw, QRX_CTRL(pf_q), rx_reg); wr32(hw, QRX_CTRL(pf_q), rx_reg);
/* wait for the change to finish */ if (!wait)
ret = ice_pf_rxq_wait(pf, pf_q, ena); return 0;
if (ret)
dev_err(ice_pf_to_dev(pf), "VSI idx %d Rx ring %d %sable timeout\n", ice_flush(hw);
vsi->idx, pf_q, (ena ? "en" : "dis")); return ice_pf_rxq_wait(pf, pf_q, ena);
}
return ret; /**
* ice_vsi_wait_one_rx_ring - wait for a VSI's Rx ring to be stopped/started
* @vsi: the VSI being configured
* @ena: true/false to verify Rx ring has been enabled/disabled respectively
* @rxq_idx: 0-based Rx queue index for the VSI passed in
*
* This routine will wait for the given Rx queue of the VSI to reach the
* enabled or disabled state. Returns -ETIMEDOUT in case of failing to reach
* the requested state after multiple retries; else will return 0 in case of
* success.
*/
int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx)
{
int pf_q = vsi->rxq_map[rxq_idx];
struct ice_pf *pf = vsi->back;
return ice_pf_rxq_wait(pf, pf_q, ena);
} }
/** /**
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
int ice_setup_rx_ctx(struct ice_ring *ring); int ice_setup_rx_ctx(struct ice_ring *ring);
int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg); int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg);
int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx); int
ice_vsi_ctrl_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx, bool wait);
int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx);
int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi); int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi);
void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi); void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi);
void ice_vsi_free_q_vectors(struct ice_vsi *vsi); void ice_vsi_free_q_vectors(struct ice_vsi *vsi);
......
...@@ -1181,7 +1181,7 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf, ...@@ -1181,7 +1181,7 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf,
case ice_aqc_opc_release_res: case ice_aqc_opc_release_res:
if (le16_to_cpu(cmd->res_id) == ICE_AQC_RES_ID_GLBL_LOCK) if (le16_to_cpu(cmd->res_id) == ICE_AQC_RES_ID_GLBL_LOCK)
break; break;
/* fall-through */ fallthrough;
default: default:
mutex_lock(&ice_global_cfg_lock_sw); mutex_lock(&ice_global_cfg_lock_sw);
lock_acquired = true; lock_acquired = true;
...@@ -2703,7 +2703,7 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, ...@@ -2703,7 +2703,7 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,
ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M; ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
break; break;
} }
/* fall-through */ fallthrough;
default: default:
status = ICE_ERR_PARAM; status = ICE_ERR_PARAM;
goto ice_aq_get_set_rss_lut_exit; goto ice_aq_get_set_rss_lut_exit;
......
...@@ -462,7 +462,7 @@ static int ice_lbtest_prepare_rings(struct ice_vsi *vsi) ...@@ -462,7 +462,7 @@ static int ice_lbtest_prepare_rings(struct ice_vsi *vsi)
if (status) if (status)
goto err_setup_rx_ring; goto err_setup_rx_ring;
status = ice_vsi_start_rx_rings(vsi); status = ice_vsi_start_all_rx_rings(vsi);
if (status) if (status)
goto err_start_rx_ring; goto err_start_rx_ring;
...@@ -494,7 +494,7 @@ static int ice_lbtest_disable_rings(struct ice_vsi *vsi) ...@@ -494,7 +494,7 @@ static int ice_lbtest_disable_rings(struct ice_vsi *vsi)
netdev_err(vsi->netdev, "Failed to stop Tx rings, VSI %d error %d\n", netdev_err(vsi->netdev, "Failed to stop Tx rings, VSI %d error %d\n",
vsi->vsi_num, status); vsi->vsi_num, status);
status = ice_vsi_stop_rx_rings(vsi); status = ice_vsi_stop_all_rx_rings(vsi);
if (status) if (status)
netdev_err(vsi->netdev, "Failed to stop Rx rings, VSI %d error %d\n", netdev_err(vsi->netdev, "Failed to stop Rx rings, VSI %d error %d\n",
vsi->vsi_num, status); vsi->vsi_num, status);
...@@ -1091,7 +1091,6 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam) ...@@ -1091,7 +1091,6 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)
fecparam->active_fec = ETHTOOL_FEC_BASER; fecparam->active_fec = ETHTOOL_FEC_BASER;
break; break;
case ICE_AQ_LINK_25G_RS_528_FEC_EN: case ICE_AQ_LINK_25G_RS_528_FEC_EN:
/* fall through */
case ICE_AQ_LINK_25G_RS_544_FEC_EN: case ICE_AQ_LINK_25G_RS_544_FEC_EN:
fecparam->active_fec = ETHTOOL_FEC_RS; fecparam->active_fec = ETHTOOL_FEC_RS;
break; break;
...@@ -1781,7 +1780,6 @@ ice_get_settings_link_up(struct ethtool_link_ksettings *ks, ...@@ -1781,7 +1780,6 @@ ice_get_settings_link_up(struct ethtool_link_ksettings *ks,
Asym_Pause); Asym_Pause);
break; break;
case ICE_FC_PFC: case ICE_FC_PFC:
/* fall through */
default: default:
ethtool_link_ksettings_del_link_mode(ks, lp_advertising, Pause); ethtool_link_ksettings_del_link_mode(ks, lp_advertising, Pause);
ethtool_link_ksettings_del_link_mode(ks, lp_advertising, ethtool_link_ksettings_del_link_mode(ks, lp_advertising,
......
...@@ -286,6 +286,8 @@ ...@@ -286,6 +286,8 @@
#define GL_PWR_MODE_CTL 0x000B820C #define GL_PWR_MODE_CTL 0x000B820C
#define GL_PWR_MODE_CTL_CAR_MAX_BW_S 30 #define GL_PWR_MODE_CTL_CAR_MAX_BW_S 30
#define GL_PWR_MODE_CTL_CAR_MAX_BW_M ICE_M(0x3, 30) #define GL_PWR_MODE_CTL_CAR_MAX_BW_M ICE_M(0x3, 30)
#define GLDCB_RTCTQ_RXQNUM_S 0
#define GLDCB_RTCTQ_RXQNUM_M ICE_M(0x7FF, 0)
#define GLPRT_BPRCL(_i) (0x00381380 + ((_i) * 8)) #define GLPRT_BPRCL(_i) (0x00381380 + ((_i) * 8))
#define GLPRT_BPTCL(_i) (0x00381240 + ((_i) * 8)) #define GLPRT_BPTCL(_i) (0x00381240 + ((_i) * 8))
#define GLPRT_CRCERRS(_i) (0x00380100 + ((_i) * 8)) #define GLPRT_CRCERRS(_i) (0x00380100 + ((_i) * 8))
......
...@@ -26,16 +26,26 @@ const char *ice_vsi_type_str(enum ice_vsi_type type) ...@@ -26,16 +26,26 @@ const char *ice_vsi_type_str(enum ice_vsi_type type)
} }
/** /**
* ice_vsi_ctrl_rx_rings - Start or stop a VSI's Rx rings * ice_vsi_ctrl_all_rx_rings - Start or stop a VSI's Rx rings
* @vsi: the VSI being configured * @vsi: the VSI being configured
* @ena: start or stop the Rx rings * @ena: start or stop the Rx rings
*
* First enable/disable all of the Rx rings, flush any remaining writes, and
* then verify that they have all been enabled/disabled successfully. This will
* let all of the register writes complete when enabling/disabling the Rx rings
* before waiting for the change in hardware to complete.
*/ */
static int ice_vsi_ctrl_rx_rings(struct ice_vsi *vsi, bool ena) static int ice_vsi_ctrl_all_rx_rings(struct ice_vsi *vsi, bool ena)
{ {
int i, ret = 0; int i, ret = 0;
for (i = 0; i < vsi->num_rxq; i++)
ice_vsi_ctrl_one_rx_ring(vsi, ena, i, false);
ice_flush(&vsi->back->hw);
for (i = 0; i < vsi->num_rxq; i++) { for (i = 0; i < vsi->num_rxq; i++) {
ret = ice_vsi_ctrl_rx_ring(vsi, ena, i); ret = ice_vsi_wait_one_rx_ring(vsi, ena, i);
if (ret) if (ret)
break; break;
} }
...@@ -111,7 +121,6 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi) ...@@ -111,7 +121,6 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
{ {
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_PF: case ICE_VSI_PF:
/* fall through */
case ICE_VSI_LB: case ICE_VSI_LB:
vsi->num_rx_desc = ICE_DFLT_NUM_RX_DESC; vsi->num_rx_desc = ICE_DFLT_NUM_RX_DESC;
vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC; vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC;
...@@ -433,7 +442,7 @@ static int ice_vsi_get_qs(struct ice_vsi *vsi) ...@@ -433,7 +442,7 @@ static int ice_vsi_get_qs(struct ice_vsi *vsi)
.scatter_count = ICE_MAX_SCATTER_TXQS, .scatter_count = ICE_MAX_SCATTER_TXQS,
.vsi_map = vsi->txq_map, .vsi_map = vsi->txq_map,
.vsi_map_offset = 0, .vsi_map_offset = 0,
.mapping_mode = vsi->tx_mapping_mode .mapping_mode = ICE_VSI_MAP_CONTIG
}; };
struct ice_qs_cfg rx_qs_cfg = { struct ice_qs_cfg rx_qs_cfg = {
.qs_mutex = &pf->avail_q_mutex, .qs_mutex = &pf->avail_q_mutex,
...@@ -443,18 +452,21 @@ static int ice_vsi_get_qs(struct ice_vsi *vsi) ...@@ -443,18 +452,21 @@ static int ice_vsi_get_qs(struct ice_vsi *vsi)
.scatter_count = ICE_MAX_SCATTER_RXQS, .scatter_count = ICE_MAX_SCATTER_RXQS,
.vsi_map = vsi->rxq_map, .vsi_map = vsi->rxq_map,
.vsi_map_offset = 0, .vsi_map_offset = 0,
.mapping_mode = vsi->rx_mapping_mode .mapping_mode = ICE_VSI_MAP_CONTIG
}; };
int ret = 0; int ret;
vsi->tx_mapping_mode = ICE_VSI_MAP_CONTIG;
vsi->rx_mapping_mode = ICE_VSI_MAP_CONTIG;
ret = __ice_vsi_get_qs(&tx_qs_cfg); ret = __ice_vsi_get_qs(&tx_qs_cfg);
if (!ret) if (ret)
ret = __ice_vsi_get_qs(&rx_qs_cfg); return ret;
vsi->tx_mapping_mode = tx_qs_cfg.mapping_mode;
ret = __ice_vsi_get_qs(&rx_qs_cfg);
if (ret)
return ret; return ret;
vsi->rx_mapping_mode = rx_qs_cfg.mapping_mode;
return 0;
} }
/** /**
...@@ -804,7 +816,6 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi) ...@@ -804,7 +816,6 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)
ctxt->info = vsi->info; ctxt->info = vsi->info;
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_LB: case ICE_VSI_LB:
/* fall through */
case ICE_VSI_PF: case ICE_VSI_PF:
ctxt->flags = ICE_AQ_VSI_TYPE_PF; ctxt->flags = ICE_AQ_VSI_TYPE_PF;
break; break;
...@@ -1348,7 +1359,9 @@ int ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid) ...@@ -1348,7 +1359,9 @@ int ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid)
list_add(&tmp->list_entry, &tmp_add_list); list_add(&tmp->list_entry, &tmp_add_list);
status = ice_add_vlan(&pf->hw, &tmp_add_list); status = ice_add_vlan(&pf->hw, &tmp_add_list);
if (status) { if (!status) {
vsi->num_vlan++;
} else {
err = -ENODEV; err = -ENODEV;
dev_err(dev, "Failure Adding VLAN %d on VSI %i\n", vid, dev_err(dev, "Failure Adding VLAN %d on VSI %i\n", vid,
vsi->vsi_num); vsi->vsi_num);
...@@ -1390,10 +1403,12 @@ int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid) ...@@ -1390,10 +1403,12 @@ int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)
list_add(&list->list_entry, &tmp_add_list); list_add(&list->list_entry, &tmp_add_list);
status = ice_remove_vlan(&pf->hw, &tmp_add_list); status = ice_remove_vlan(&pf->hw, &tmp_add_list);
if (status == ICE_ERR_DOES_NOT_EXIST) { if (!status) {
vsi->num_vlan--;
} else if (status == ICE_ERR_DOES_NOT_EXIST) {
dev_dbg(dev, "Failed to remove VLAN %d on VSI %i, it does not exist, status: %d\n", dev_dbg(dev, "Failed to remove VLAN %d on VSI %i, it does not exist, status: %d\n",
vid, vsi->vsi_num, status); vid, vsi->vsi_num, status);
} else if (status) { } else {
dev_err(dev, "Error removing VLAN %d on vsi %i error: %d\n", dev_err(dev, "Error removing VLAN %d on vsi %i error: %d\n",
vid, vsi->vsi_num, status); vid, vsi->vsi_num, status);
err = -EIO; err = -EIO;
...@@ -1678,25 +1693,25 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) ...@@ -1678,25 +1693,25 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
} }
/** /**
* ice_vsi_start_rx_rings - start VSI's Rx rings * ice_vsi_start_all_rx_rings - start/enable all of a VSI's Rx rings
* @vsi: the VSI whose rings are to be started * @vsi: the VSI whose rings are to be enabled
* *
* Returns 0 on success and a negative value on error * Returns 0 on success and a negative value on error
*/ */
int ice_vsi_start_rx_rings(struct ice_vsi *vsi) int ice_vsi_start_all_rx_rings(struct ice_vsi *vsi)
{ {
return ice_vsi_ctrl_rx_rings(vsi, true); return ice_vsi_ctrl_all_rx_rings(vsi, true);
} }
/** /**
* ice_vsi_stop_rx_rings - stop VSI's Rx rings * ice_vsi_stop_all_rx_rings - stop/disable all of a VSI's Rx rings
* @vsi: the VSI * @vsi: the VSI whose rings are to be disabled
* *
* Returns 0 on success and a negative value on error * Returns 0 on success and a negative value on error
*/ */
int ice_vsi_stop_rx_rings(struct ice_vsi *vsi) int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi)
{ {
return ice_vsi_ctrl_rx_rings(vsi, false); return ice_vsi_ctrl_all_rx_rings(vsi, false);
} }
/** /**
...@@ -1755,6 +1770,26 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi) ...@@ -1755,6 +1770,26 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)
return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings); return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings);
} }
/**
* ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
* @vsi: VSI to check whether or not VLAN pruning is enabled.
*
* returns true if Rx VLAN pruning and Tx VLAN anti-spoof is enabled and false
* otherwise.
*/
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)
{
u8 rx_pruning = ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
u8 tx_pruning = ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<
ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;
if (!vsi)
return false;
return ((vsi->info.sw_flags2 & rx_pruning) &&
(vsi->info.sec_flags & tx_pruning));
}
/** /**
* ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI
* @vsi: VSI to enable or disable VLAN pruning on * @vsi: VSI to enable or disable VLAN pruning on
...@@ -2025,6 +2060,17 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -2025,6 +2060,17 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
if (ret) if (ret)
goto unroll_vector_base; goto unroll_vector_base;
/* Always add VLAN ID 0 switch rule by default. This is needed
* in order to allow all untagged and 0 tagged priority traffic
* if Rx VLAN pruning is enabled. Also there are cases where we
* don't get the call to add VLAN 0 via ice_vlan_rx_add_vid()
* so this handles those cases (i.e. adding the PF to a bridge
* without the 8021q module loaded).
*/
ret = ice_vsi_add_vlan(vsi, 0);
if (ret)
goto unroll_clear_rings;
ice_vsi_map_rings_to_vectors(vsi); ice_vsi_map_rings_to_vectors(vsi);
/* Do not exit if configuring RSS had an issue, at least /* Do not exit if configuring RSS had an issue, at least
...@@ -2104,6 +2150,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -2104,6 +2150,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
return vsi; return vsi;
unroll_clear_rings:
ice_vsi_clear_rings(vsi);
unroll_vector_base: unroll_vector_base:
/* reclaim SW interrupts back to the common pool */ /* reclaim SW interrupts back to the common pool */
ice_free_res(pf->irq_tracker, vsi->base_vector, vsi->idx); ice_free_res(pf->irq_tracker, vsi->base_vector, vsi->idx);
......
...@@ -30,9 +30,9 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi); ...@@ -30,9 +30,9 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi);
int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena); int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena);
int ice_vsi_start_rx_rings(struct ice_vsi *vsi); int ice_vsi_start_all_rx_rings(struct ice_vsi *vsi);
int ice_vsi_stop_rx_rings(struct ice_vsi *vsi); int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi);
int int
ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
...@@ -42,6 +42,8 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi); ...@@ -42,6 +42,8 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi);
int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi); int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);
bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi);
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc); int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc);
void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create); void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create);
......
...@@ -706,7 +706,6 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup) ...@@ -706,7 +706,6 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup)
/* Get FEC mode based on negotiated link info */ /* Get FEC mode based on negotiated link info */
switch (vsi->port_info->phy.link_info.fec_info) { switch (vsi->port_info->phy.link_info.fec_info) {
case ICE_AQ_LINK_25G_RS_528_FEC_EN: case ICE_AQ_LINK_25G_RS_528_FEC_EN:
/* fall through */
case ICE_AQ_LINK_25G_RS_544_FEC_EN: case ICE_AQ_LINK_25G_RS_544_FEC_EN:
fec = "RS-FEC"; fec = "RS-FEC";
break; break;
...@@ -1029,6 +1028,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) ...@@ -1029,6 +1028,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
if (ice_handle_link_event(pf, &event)) if (ice_handle_link_event(pf, &event))
dev_err(dev, "Could not handle link event\n"); dev_err(dev, "Could not handle link event\n");
break; break;
case ice_aqc_opc_event_lan_overflow:
ice_vf_lan_overflow_event(pf, &event);
break;
case ice_mbx_opc_send_msg_to_pf: case ice_mbx_opc_send_msg_to_pf:
ice_vc_process_vf_msg(pf, &event); ice_vc_process_vf_msg(pf, &event);
break; break;
...@@ -2461,16 +2463,19 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto, ...@@ -2461,16 +2463,19 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,
if (vsi->info.pvid) if (vsi->info.pvid)
return -EINVAL; return -EINVAL;
/* Enable VLAN pruning when VLAN 0 is added */ /* VLAN 0 is added by default during load/reset */
if (unlikely(!vid)) { if (!vid)
return 0;
/* Enable VLAN pruning when a VLAN other than 0 is added */
if (!ice_vsi_is_vlan_pruning_ena(vsi)) {
ret = ice_cfg_vlan_pruning(vsi, true, false); ret = ice_cfg_vlan_pruning(vsi, true, false);
if (ret) if (ret)
return ret; return ret;
} }
/* Add all VLAN IDs including 0 to the switch filter. VLAN ID 0 is /* Add a switch rule for this VLAN ID so its corresponding VLAN tagged
* needed to continue allowing all untagged packets since VLAN prune * packets aren't pruned by the device's internal switch on Rx
* list is applied to all packets by the switch
*/ */
ret = ice_vsi_add_vlan(vsi, vid); ret = ice_vsi_add_vlan(vsi, vid);
if (!ret) { if (!ret) {
...@@ -2500,6 +2505,10 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto, ...@@ -2500,6 +2505,10 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,
if (vsi->info.pvid) if (vsi->info.pvid)
return -EINVAL; return -EINVAL;
/* don't allow removal of VLAN 0 */
if (!vid)
return 0;
/* Make sure ice_vsi_kill_vlan is successful before updating VLAN /* Make sure ice_vsi_kill_vlan is successful before updating VLAN
* information * information
*/ */
...@@ -2507,8 +2516,8 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto, ...@@ -2507,8 +2516,8 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,
if (ret) if (ret)
return ret; return ret;
/* Disable VLAN pruning when VLAN 0 is removed */ /* Disable pruning when VLAN 0 is the only VLAN rule */
if (unlikely(!vid)) if (vsi->num_vlan == 1 && ice_vsi_is_vlan_pruning_ena(vsi))
ret = ice_cfg_vlan_pruning(vsi, false, false); ret = ice_cfg_vlan_pruning(vsi, false, false);
vsi->vlan_ena = false; vsi->vlan_ena = false;
...@@ -2945,7 +2954,6 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status) ...@@ -2945,7 +2954,6 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status)
} }
break; break;
case ICE_ERR_BUF_TOO_SHORT: case ICE_ERR_BUF_TOO_SHORT:
/* fall-through */
case ICE_ERR_CFG: case ICE_ERR_CFG:
dev_err(dev, "The DDP package file is invalid. Entering Safe Mode.\n"); dev_err(dev, "The DDP package file is invalid. Entering Safe Mode.\n");
break; break;
...@@ -2977,7 +2985,7 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status) ...@@ -2977,7 +2985,7 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status)
default: default:
break; break;
} }
/* fall-through */ fallthrough;
default: default:
dev_err(dev, "An unknown error (%d) occurred when loading the DDP package. Entering Safe Mode.\n", dev_err(dev, "An unknown error (%d) occurred when loading the DDP package. Entering Safe Mode.\n",
*status); *status);
...@@ -3961,7 +3969,7 @@ static int ice_up_complete(struct ice_vsi *vsi) ...@@ -3961,7 +3969,7 @@ static int ice_up_complete(struct ice_vsi *vsi)
* Tx queue group list was configured and the context bits were * Tx queue group list was configured and the context bits were
* programmed using ice_vsi_cfg_txqs * programmed using ice_vsi_cfg_txqs
*/ */
err = ice_vsi_start_rx_rings(vsi); err = ice_vsi_start_all_rx_rings(vsi);
if (err) if (err)
return err; return err;
...@@ -4340,7 +4348,7 @@ int ice_down(struct ice_vsi *vsi) ...@@ -4340,7 +4348,7 @@ int ice_down(struct ice_vsi *vsi)
vsi->vsi_num, tx_err); vsi->vsi_num, tx_err);
} }
rx_err = ice_vsi_stop_rx_rings(vsi); rx_err = ice_vsi_stop_all_rx_rings(vsi);
if (rx_err) if (rx_err)
netdev_err(vsi->netdev, "Failed stop Rx rings, VSI %d error %d\n", netdev_err(vsi->netdev, "Failed stop Rx rings, VSI %d error %d\n",
vsi->vsi_num, rx_err); vsi->vsi_num, rx_err);
...@@ -5027,6 +5035,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, ...@@ -5027,6 +5035,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
/** /**
* ice_tx_timeout - Respond to a Tx Hang * ice_tx_timeout - Respond to a Tx Hang
* @netdev: network interface device structure * @netdev: network interface device structure
* @txqueue: Tx queue
*/ */
static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue)
{ {
......
...@@ -121,9 +121,7 @@ u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed) ...@@ -121,9 +121,7 @@ u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed)
speed = (u32)VIRTCHNL_LINK_SPEED_25GB; speed = (u32)VIRTCHNL_LINK_SPEED_25GB;
break; break;
case ICE_AQ_LINK_SPEED_40GB: case ICE_AQ_LINK_SPEED_40GB:
/* fall through */
case ICE_AQ_LINK_SPEED_50GB: case ICE_AQ_LINK_SPEED_50GB:
/* fall through */
case ICE_AQ_LINK_SPEED_100GB: case ICE_AQ_LINK_SPEED_100GB:
speed = (u32)VIRTCHNL_LINK_SPEED_40GB; speed = (u32)VIRTCHNL_LINK_SPEED_40GB;
break; break;
......
...@@ -760,7 +760,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, ...@@ -760,7 +760,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
break; break;
case ICE_SW_LKUP_ETHERTYPE_MAC: case ICE_SW_LKUP_ETHERTYPE_MAC:
daddr = f_info->l_data.ethertype_mac.mac_addr; daddr = f_info->l_data.ethertype_mac.mac_addr;
/* fall-through */ fallthrough;
case ICE_SW_LKUP_ETHERTYPE: case ICE_SW_LKUP_ETHERTYPE:
off = (__force __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET); off = (__force __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
*off = cpu_to_be16(f_info->l_data.ethertype_mac.ethertype); *off = cpu_to_be16(f_info->l_data.ethertype_mac.ethertype);
...@@ -771,7 +771,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, ...@@ -771,7 +771,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
break; break;
case ICE_SW_LKUP_PROMISC_VLAN: case ICE_SW_LKUP_PROMISC_VLAN:
vlan_id = f_info->l_data.mac_vlan.vlan_id; vlan_id = f_info->l_data.mac_vlan.vlan_id;
/* fall-through */ fallthrough;
case ICE_SW_LKUP_PROMISC: case ICE_SW_LKUP_PROMISC:
daddr = f_info->l_data.mac_vlan.mac_addr; daddr = f_info->l_data.mac_vlan.mac_addr;
break; break;
......
...@@ -453,10 +453,10 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, ...@@ -453,10 +453,10 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp,
break; break;
default: default:
bpf_warn_invalid_xdp_action(act); bpf_warn_invalid_xdp_action(act);
/* fallthrough -- not supported action */ fallthrough;
case XDP_ABORTED: case XDP_ABORTED:
trace_xdp_exception(rx_ring->netdev, xdp_prog, act); trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
/* fallthrough -- handle aborts by dropping frame */ fallthrough;
case XDP_DROP: case XDP_DROP:
result = ICE_XDP_CONSUMED; result = ICE_XDP_CONSUMED;
break; break;
...@@ -1188,7 +1188,6 @@ ice_adjust_itr_by_size_and_speed(struct ice_port_info *port_info, ...@@ -1188,7 +1188,6 @@ ice_adjust_itr_by_size_and_speed(struct ice_port_info *port_info,
avg_pkt_size + 640); avg_pkt_size + 640);
break; break;
case ICE_AQ_LINK_SPEED_10GB: case ICE_AQ_LINK_SPEED_10GB:
/* fall through */
default: default:
itr += DIV_ROUND_UP(170 * (avg_pkt_size + 24), itr += DIV_ROUND_UP(170 * (avg_pkt_size + 24),
avg_pkt_size + 640); avg_pkt_size + 640);
......
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
#define _ICE_VIRTCHNL_PF_H_ #define _ICE_VIRTCHNL_PF_H_
#include "ice.h" #include "ice.h"
#define ICE_MAX_VLANID 4095
#define ICE_VLAN_PRIORITY_S 12
#define ICE_VLAN_M 0xFFF
#define ICE_PRIORITY_M 0x7000
/* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */ /* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */
#define ICE_MAX_VLAN_PER_VF 8 #define ICE_MAX_VLAN_PER_VF 8
#define ICE_MAX_MACADDR_PER_VF 12 #define ICE_MAX_MACADDR_PER_VF 12
...@@ -74,7 +69,7 @@ struct ice_vf { ...@@ -74,7 +69,7 @@ struct ice_vf {
struct virtchnl_ether_addr dflt_lan_addr; struct virtchnl_ether_addr dflt_lan_addr;
DECLARE_BITMAP(txq_ena, ICE_MAX_BASE_QS_PER_VF); DECLARE_BITMAP(txq_ena, ICE_MAX_BASE_QS_PER_VF);
DECLARE_BITMAP(rxq_ena, ICE_MAX_BASE_QS_PER_VF); DECLARE_BITMAP(rxq_ena, ICE_MAX_BASE_QS_PER_VF);
u16 port_vlan_id; u16 port_vlan_info; /* Port VLAN ID and QoS */
u8 pf_set_mac:1; /* VF MAC address set by VMM admin */ u8 pf_set_mac:1; /* VF MAC address set by VMM admin */
u8 trusted:1; u8 trusted:1;
u8 spoofchk:1; u8 spoofchk:1;
...@@ -95,7 +90,6 @@ struct ice_vf { ...@@ -95,7 +90,6 @@ struct ice_vf {
u8 num_req_qs; /* num of queue pairs requested by VF */ u8 num_req_qs; /* num of queue pairs requested by VF */
u16 num_mac; u16 num_mac;
u16 num_vf_qs; /* num of queue configured per VF */ u16 num_vf_qs; /* num of queue configured per VF */
u16 num_qs_ena; /* total num of Tx/Rx queue enabled */
}; };
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
...@@ -127,6 +121,9 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf); ...@@ -127,6 +121,9 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf);
int int
ice_get_vf_stats(struct net_device *netdev, int vf_id, ice_get_vf_stats(struct net_device *netdev, int vf_id,
struct ifla_vf_stats *vf_stats); struct ifla_vf_stats *vf_stats);
void
ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
#else /* CONFIG_PCI_IOV */ #else /* CONFIG_PCI_IOV */
#define ice_process_vflr_event(pf) do {} while (0) #define ice_process_vflr_event(pf) do {} while (0)
#define ice_free_vfs(pf) do {} while (0) #define ice_free_vfs(pf) do {} while (0)
...@@ -134,6 +131,7 @@ ice_get_vf_stats(struct net_device *netdev, int vf_id, ...@@ -134,6 +131,7 @@ ice_get_vf_stats(struct net_device *netdev, int vf_id,
#define ice_vc_notify_link_state(pf) do {} while (0) #define ice_vc_notify_link_state(pf) do {} while (0)
#define ice_vc_notify_reset(pf) do {} while (0) #define ice_vc_notify_reset(pf) do {} while (0)
#define ice_set_vf_state_qs_dis(vf) do {} while (0) #define ice_set_vf_state_qs_dis(vf) do {} while (0)
#define ice_vf_lan_overflow_event(pf, event) do {} while (0)
static inline bool static inline bool
ice_reset_all_vfs(struct ice_pf __always_unused *pf, ice_reset_all_vfs(struct ice_pf __always_unused *pf,
......
...@@ -183,7 +183,7 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) ...@@ -183,7 +183,7 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx)
if (err) if (err)
return err; return err;
} }
err = ice_vsi_ctrl_rx_ring(vsi, false, q_idx); err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, true);
if (err) if (err)
return err; return err;
...@@ -243,7 +243,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx) ...@@ -243,7 +243,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)
ice_qvec_cfg_msix(vsi, q_vector); ice_qvec_cfg_msix(vsi, q_vector);
err = ice_vsi_ctrl_rx_ring(vsi, true, q_idx); err = ice_vsi_ctrl_one_rx_ring(vsi, true, q_idx, true);
if (err) if (err)
goto free_buf; goto free_buf;
...@@ -609,7 +609,7 @@ ice_alloc_buf_slow_zc(struct ice_ring *rx_ring, struct ice_rx_buf *rx_buf) ...@@ -609,7 +609,7 @@ ice_alloc_buf_slow_zc(struct ice_ring *rx_ring, struct ice_rx_buf *rx_buf)
*/ */
static bool static bool
ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, int count, ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, int count,
bool alloc(struct ice_ring *, struct ice_rx_buf *)) bool (*alloc)(struct ice_ring *, struct ice_rx_buf *))
{ {
union ice_32b_rx_flex_desc *rx_desc; union ice_32b_rx_flex_desc *rx_desc;
u16 ntu = rx_ring->next_to_use; u16 ntu = rx_ring->next_to_use;
...@@ -816,10 +816,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) ...@@ -816,10 +816,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp)
break; break;
default: default:
bpf_warn_invalid_xdp_action(act); bpf_warn_invalid_xdp_action(act);
/* fallthrough -- not supported action */ fallthrough;
case XDP_ABORTED: case XDP_ABORTED:
trace_xdp_exception(rx_ring->netdev, xdp_prog, act); trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
/* fallthrough -- handle aborts by dropping frame */ fallthrough;
case XDP_DROP: case XDP_DROP:
result = ICE_XDP_CONSUMED; result = ICE_XDP_CONSUMED;
break; break;
...@@ -841,8 +841,8 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget) ...@@ -841,8 +841,8 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
unsigned int total_rx_bytes = 0, total_rx_packets = 0; unsigned int total_rx_bytes = 0, total_rx_packets = 0;
u16 cleaned_count = ICE_DESC_UNUSED(rx_ring); u16 cleaned_count = ICE_DESC_UNUSED(rx_ring);
unsigned int xdp_xmit = 0; unsigned int xdp_xmit = 0;
bool failure = false;
struct xdp_buff xdp; struct xdp_buff xdp;
bool failure = 0;
xdp.rxq = &rx_ring->xdp_rxq; xdp.rxq = &rx_ring->xdp_rxq;
......
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