Skip to content

Commit 62c0278

Browse files
committed
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-05-27 This series contains updates to the ice driver only. Jesse fixes a number of issues, starting with fixing the remaining signed versus unsigned comparison issues. Cleaned up an unused code define. Fixed the implementation of the manage MAC write command, to simplify it by using a simple array to represent the MAC address when writing it. Paul fixes the setting of the VF default LAN address, by removing a check that assumed that the address had been deleted and zeroed. Surabhi prevents a memory leak on filter management initialization failures and during queue initialization and buffer allocation failures. Brett adds additional receive error counters that are reported by ethtool. Fixed the enabling and disabling of VLAN stripping when the PVID has been set. Evan fixes a race condition between the firmware and software, which can occur between the admin queue setup and the first command sent. Marta fixes the driver when XDP transmit rings are destroyed, also make sure the XDP transmit queues are also destroyed. Update the statistics when XDP transmit programs are loaded and packets are sent. Changed the number of XDP transmit queues to match the number of receive queues, instead of matching the number of transmit queues. Bruce avoids undefined behavior by not writing the 8-bit element init_q_state with the associated internal-to-hardware field which is 122-bits. Anirudh (Ani) refactors the receive checksum checks. Krzysztof notifies the user if the fill queue is not long enough to prepare all buffers before packet processing starts and allocates the buffers during the NAPI poll. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 1e372db + 3f0d97c commit 62c0278

15 files changed

+234
-143
lines changed

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,11 @@ struct ice_aqc_manage_mac_write {
156156
#define ICE_AQC_MAN_MAC_WR_MC_MAG_EN BIT(0)
157157
#define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP BIT(1)
158158
#define ICE_AQC_MAN_MAC_WR_S 6
159-
#define ICE_AQC_MAN_MAC_WR_M (3 << ICE_AQC_MAN_MAC_WR_S)
159+
#define ICE_AQC_MAN_MAC_WR_M ICE_M(3, ICE_AQC_MAN_MAC_WR_S)
160160
#define ICE_AQC_MAN_MAC_UPDATE_LAA 0
161-
#define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL (BIT(0) << ICE_AQC_MAN_MAC_WR_S)
162-
/* High 16 bits of MAC address in big endian order */
163-
__be16 sah;
164-
/* Low 32 bits of MAC address in big endian order */
165-
__be32 sal;
161+
#define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL BIT(ICE_AQC_MAN_MAC_WR_S)
162+
/* byte stream in network order */
163+
u8 mac_addr[ETH_ALEN];
166164
__le32 addr_high;
167165
__le32 addr_low;
168166
};

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg)
1515
{
16-
int offset, i;
16+
unsigned int offset, i;
1717

1818
mutex_lock(qs_cfg->qs_mutex);
1919
offset = bitmap_find_next_zero_area(qs_cfg->pf_map, qs_cfg->pf_map_size,
@@ -39,7 +39,7 @@ static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg)
3939
*/
4040
static int __ice_vsi_get_qs_sc(struct ice_qs_cfg *qs_cfg)
4141
{
42-
int i, index = 0;
42+
unsigned int i, index = 0;
4343

4444
mutex_lock(qs_cfg->qs_mutex);
4545
for (i = 0; i < qs_cfg->q_count; i++) {
@@ -281,7 +281,9 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
281281
*/
282282
int ice_setup_rx_ctx(struct ice_ring *ring)
283283
{
284+
struct device *dev = ice_pf_to_dev(ring->vsi->back);
284285
int chain_len = ICE_MAX_CHAINED_RX_BUFS;
286+
u16 num_bufs = ICE_DESC_UNUSED(ring);
285287
struct ice_vsi *vsi = ring->vsi;
286288
u32 rxdid = ICE_RXDID_FLEX_NIC;
287289
struct ice_rlan_ctx rlan_ctx;
@@ -324,7 +326,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
324326
return err;
325327
xsk_buff_set_rxq_info(ring->xsk_umem, &ring->xdp_rxq);
326328

327-
dev_info(ice_pf_to_dev(vsi->back), "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",
329+
dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",
328330
ring->q_index);
329331
} else {
330332
if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
@@ -408,7 +410,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
408410
/* Absolute queue number out of 2K needs to be passed */
409411
err = ice_write_rxq_ctx(hw, &rlan_ctx, pf_q);
410412
if (err) {
411-
dev_err(ice_pf_to_dev(vsi->back), "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
413+
dev_err(dev, "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
412414
pf_q, err);
413415
return -EIO;
414416
}
@@ -426,13 +428,23 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
426428
ring->tail = hw->hw_addr + QRX_TAIL(pf_q);
427429
writel(0, ring->tail);
428430

429-
err = ring->xsk_umem ?
430-
ice_alloc_rx_bufs_zc(ring, ICE_DESC_UNUSED(ring)) :
431-
ice_alloc_rx_bufs(ring, ICE_DESC_UNUSED(ring));
432-
if (err)
433-
dev_info(ice_pf_to_dev(vsi->back), "Failed allocate some buffers on %sRx ring %d (pf_q %d)\n",
434-
ring->xsk_umem ? "UMEM enabled " : "",
435-
ring->q_index, pf_q);
431+
if (ring->xsk_umem) {
432+
if (!xsk_buff_can_alloc(ring->xsk_umem, num_bufs)) {
433+
dev_warn(dev, "UMEM does not provide enough addresses to fill %d buffers on Rx ring %d\n",
434+
num_bufs, ring->q_index);
435+
dev_warn(dev, "Change Rx ring/fill queue size to avoid performance issues\n");
436+
437+
return 0;
438+
}
439+
440+
err = ice_alloc_rx_bufs_zc(ring, num_bufs);
441+
if (err)
442+
dev_info(dev, "Failed to allocate some buffers on UMEM enabled Rx ring %d (pf_q %d)\n",
443+
ring->q_index, pf_q);
444+
return 0;
445+
}
446+
447+
ice_alloc_rx_bufs(ring, num_bufs);
436448

437449
return 0;
438450
}
@@ -638,6 +650,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
638650
struct ice_aqc_add_txqs_perq *txq;
639651
struct ice_pf *pf = vsi->back;
640652
u8 buf_len = sizeof(*qg_buf);
653+
struct ice_hw *hw = &pf->hw;
641654
enum ice_status status;
642655
u16 pf_q;
643656
u8 tc;
@@ -646,13 +659,13 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
646659
ice_setup_tx_ctx(ring, &tlan_ctx, pf_q);
647660
/* copy context contents into the qg_buf */
648661
qg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);
649-
ice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
662+
ice_set_ctx(hw, (u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
650663
ice_tlan_ctx_info);
651664

652665
/* init queue specific tail reg. It is referred as
653666
* transmit comm scheduler queue doorbell.
654667
*/
655-
ring->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);
668+
ring->tail = hw->hw_addr + QTX_COMM_DBELL(pf_q);
656669

657670
if (IS_ENABLED(CONFIG_DCB))
658671
tc = ring->dcb_tc;

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, struct ice_sq_cd *cd)
387387
static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
388388
{
389389
struct ice_switch_info *sw;
390+
enum ice_status status;
390391

391392
hw->switch_info = devm_kzalloc(ice_hw_to_dev(hw),
392393
sizeof(*hw->switch_info), GFP_KERNEL);
@@ -397,7 +398,12 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
397398

398399
INIT_LIST_HEAD(&sw->vsi_list_map_head);
399400

400-
return ice_init_def_sw_recp(hw);
401+
status = ice_init_def_sw_recp(hw);
402+
if (status) {
403+
devm_kfree(ice_hw_to_dev(hw), hw->switch_info);
404+
return status;
405+
}
406+
return 0;
401407
}
402408

403409
/**
@@ -1092,7 +1098,7 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
10921098

10931099
rlan_ctx->prefena = 1;
10941100

1095-
ice_set_ctx((u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info);
1101+
ice_set_ctx(hw, (u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info);
10961102
return ice_copy_rxq_ctx_to_hw(hw, ctx_buf, rxq_index);
10971103
}
10981104

@@ -1994,10 +2000,7 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
19942000
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write);
19952001

19962002
cmd->flags = flags;
1997-
1998-
/* Prep values for flags, sah, sal */
1999-
cmd->sah = htons(*((const u16 *)mac_addr));
2000-
cmd->sal = htonl(*((const u32 *)(mac_addr + 2)));
2003+
ether_addr_copy(cmd->mac_addr, mac_addr);
20012004

20022005
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
20032006
}
@@ -3196,12 +3199,14 @@ ice_write_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
31963199

31973200
/**
31983201
* ice_set_ctx - set context bits in packed structure
3202+
* @hw: pointer to the hardware structure
31993203
* @src_ctx: pointer to a generic non-packed context structure
32003204
* @dest_ctx: pointer to memory for the packed structure
32013205
* @ce_info: a description of the structure to be transformed
32023206
*/
32033207
enum ice_status
3204-
ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
3208+
ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
3209+
const struct ice_ctx_ele *ce_info)
32053210
{
32063211
int f;
32073212

@@ -3210,6 +3215,12 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
32103215
* using the correct size so that we are correct regardless
32113216
* of the endianness of the machine.
32123217
*/
3218+
if (ce_info[f].width > (ce_info[f].size_of * BITS_PER_BYTE)) {
3219+
ice_debug(hw, ICE_DBG_QCTX,
3220+
"Field %d width of %d bits larger than size of %d byte(s) ... skipping write\n",
3221+
f, ce_info[f].width, ce_info[f].size_of);
3222+
continue;
3223+
}
32133224
switch (ce_info[f].size_of) {
32143225
case sizeof(u8):
32153226
ice_write_byte(src_ctx, dest_ctx, &ce_info[f]);

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);
7070
void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode);
7171
extern const struct ice_ctx_ele ice_tlan_ctx_info[];
7272
enum ice_status
73-
ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info);
73+
ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
74+
const struct ice_ctx_ele *ce_info);
7475

7576
extern struct mutex ice_global_cfg_lock_sw;
7677

0 commit comments

Comments
 (0)