Skip to content

Commit aa1e1c0

Browse files
committed
Merge: bnx2x: update driver to v6.9-rc1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4042 JIRA: https://issues.redhat.com/browse/RHEL-23117 JIRA: https://issues.redhat.com/browse/RHEL-25588 JIRA: https://issues.redhat.com/browse/RHEL-32855 Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents aa9818c + 5933c31 commit aa1e1c0

File tree

9 files changed

+93
-60
lines changed

9 files changed

+93
-60
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,8 @@ struct bnx2x {
15081508
bool cnic_loaded;
15091509
struct cnic_eth_dev *(*cnic_probe)(struct net_device *);
15101510

1511+
bool nic_stopped;
1512+
15111513
/* Flag that indicates that we can start looking for FCoE L2 queue
15121514
* completions in the default status block.
15131515
*/

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ void bnx2x_fill_fw_str(struct bnx2x *bp, char *buf, size_t buf_len)
147147

148148
phy_fw_ver[0] = '\0';
149149
bnx2x_get_ext_phy_fw_version(&bp->link_params,
150-
phy_fw_ver, PHY_FW_VER_LEN);
151-
strscpy(buf, bp->fw_ver, buf_len);
152-
snprintf(buf + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver),
153-
"bc %d.%d.%d%s%s",
150+
phy_fw_ver, sizeof(phy_fw_ver));
151+
/* This may become truncated. */
152+
scnprintf(buf, buf_len,
153+
"%sbc %d.%d.%d%s%s",
154+
bp->fw_ver,
154155
(bp->common.bc_ver & 0xff0000) >> 16,
155156
(bp->common.bc_ver & 0xff00) >> 8,
156157
(bp->common.bc_ver & 0xff),
@@ -672,6 +673,18 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
672673
return 0;
673674
}
674675

676+
static struct sk_buff *
677+
bnx2x_build_skb(const struct bnx2x_fastpath *fp, void *data)
678+
{
679+
struct sk_buff *skb;
680+
681+
if (fp->rx_frag_size)
682+
skb = build_skb(data, fp->rx_frag_size);
683+
else
684+
skb = slab_build_skb(data);
685+
return skb;
686+
}
687+
675688
static void bnx2x_frag_free(const struct bnx2x_fastpath *fp, void *data)
676689
{
677690
if (fp->rx_frag_size)
@@ -779,14 +792,15 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
779792
dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(rx_buf, mapping),
780793
fp->rx_buf_size, DMA_FROM_DEVICE);
781794
if (likely(new_data))
782-
skb = build_skb(data, fp->rx_frag_size);
795+
skb = bnx2x_build_skb(fp, data);
783796

784797
if (likely(skb)) {
785798
#ifdef BNX2X_STOP_ON_ERROR
786799
if (pad + len > fp->rx_buf_size) {
787800
BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n",
788801
pad, len, fp->rx_buf_size);
789802
bnx2x_panic();
803+
bnx2x_frag_free(fp, new_data);
790804
return;
791805
}
792806
#endif
@@ -1045,7 +1059,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
10451059
dma_unmap_addr(rx_buf, mapping),
10461060
fp->rx_buf_size,
10471061
DMA_FROM_DEVICE);
1048-
skb = build_skb(data, fp->rx_frag_size);
1062+
skb = bnx2x_build_skb(fp, data);
10491063
if (unlikely(!skb)) {
10501064
bnx2x_frag_free(fp, data);
10511065
bnx2x_fp_qstats(bp, fp)->
@@ -2702,6 +2716,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
27022716
bnx2x_add_all_napi(bp);
27032717
DP(NETIF_MSG_IFUP, "napi added\n");
27042718
bnx2x_napi_enable(bp);
2719+
bp->nic_stopped = false;
27052720

27062721
if (IS_PF(bp)) {
27072722
/* set pf load just before approaching the MCP */
@@ -2947,6 +2962,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
29472962
load_error1:
29482963
bnx2x_napi_disable(bp);
29492964
bnx2x_del_all_napi(bp);
2965+
bp->nic_stopped = true;
29502966

29512967
/* clear pf_load status, as it was already set */
29522968
if (IS_PF(bp))
@@ -3082,14 +3098,17 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
30823098
if (!CHIP_IS_E1x(bp))
30833099
bnx2x_pf_disable(bp);
30843100

3085-
/* Disable HW interrupts, NAPI */
3086-
bnx2x_netif_stop(bp, 1);
3087-
/* Delete all NAPI objects */
3088-
bnx2x_del_all_napi(bp);
3089-
if (CNIC_LOADED(bp))
3090-
bnx2x_del_all_napi_cnic(bp);
3091-
/* Release IRQs */
3092-
bnx2x_free_irq(bp);
3101+
if (!bp->nic_stopped) {
3102+
/* Disable HW interrupts, NAPI */
3103+
bnx2x_netif_stop(bp, 1);
3104+
/* Delete all NAPI objects */
3105+
bnx2x_del_all_napi(bp);
3106+
if (CNIC_LOADED(bp))
3107+
bnx2x_del_all_napi_cnic(bp);
3108+
/* Release IRQs */
3109+
bnx2x_free_irq(bp);
3110+
bp->nic_stopped = true;
3111+
}
30933112

30943113
/* Report UNLOAD_DONE to MCP */
30953114
bnx2x_send_unload_done(bp, false);

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,9 +1002,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,
10021002
static inline void bnx2x_free_rx_mem_pool(struct bnx2x *bp,
10031003
struct bnx2x_alloc_pool *pool)
10041004
{
1005-
if (!pool->page)
1006-
return;
1007-
10081005
put_page(pool->page);
10091006

10101007
pool->page = NULL;
@@ -1015,6 +1012,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp,
10151012
{
10161013
int i;
10171014

1015+
if (!fp->page_pool.page)
1016+
return;
1017+
10181018
if (fp->mode == TPA_MODE_DISABLED)
10191019
return;
10201020

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
11321132
}
11331133

11341134
memset(version, 0, sizeof(version));
1135-
bnx2x_fill_fw_str(bp, version, ETHTOOL_FWVERS_LEN);
1135+
bnx2x_fill_fw_str(bp, version, sizeof(version));
11361136
strlcat(info->fw_version, version, sizeof(info->fw_version));
11371137

11381138
strscpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));

drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,8 +6163,8 @@ static void bnx2x_link_int_ack(struct link_params *params,
61636163

61646164
static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len)
61656165
{
6166-
str[0] = '\0';
6167-
(*len)--;
6166+
if (*len)
6167+
str[0] = '\0';
61686168
return 0;
61696169
}
61706170

@@ -6173,7 +6173,7 @@ static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
61736173
u16 ret;
61746174

61756175
if (*len < 10) {
6176-
/* Need more than 10chars for this format */
6176+
/* Need more than 10 chars for this format */
61776177
bnx2x_null_format_ver(num, str, len);
61786178
return -EINVAL;
61796179
}
@@ -6188,8 +6188,8 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
61886188
{
61896189
u16 ret;
61906190

6191-
if (*len < 10) {
6192-
/* Need more than 10chars for this format */
6191+
if (*len < 9) {
6192+
/* Need more than 9 chars for this format */
61936193
bnx2x_null_format_ver(num, str, len);
61946194
return -EINVAL;
61956195
}
@@ -6208,7 +6208,7 @@ int bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 *version,
62086208
int status = 0;
62096209
u8 *ver_p = version;
62106210
u16 remain_len = len;
6211-
if (version == NULL || params == NULL)
6211+
if (version == NULL || params == NULL || len == 0)
62126212
return -EINVAL;
62136213
bp = params->bp;
62146214

@@ -11546,7 +11546,7 @@ static int bnx2x_7101_format_ver(u32 spirom_ver, u8 *str, u16 *len)
1154611546
str[2] = (spirom_ver & 0xFF0000) >> 16;
1154711547
str[3] = (spirom_ver & 0xFF000000) >> 24;
1154811548
str[4] = '\0';
11549-
*len -= 5;
11549+
*len -= 4;
1155011550
return 0;
1155111551
}
1155211552

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9474,15 +9474,18 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
94749474
}
94759475
}
94769476

9477-
/* Disable HW interrupts, NAPI */
9478-
bnx2x_netif_stop(bp, 1);
9479-
/* Delete all NAPI objects */
9480-
bnx2x_del_all_napi(bp);
9481-
if (CNIC_LOADED(bp))
9482-
bnx2x_del_all_napi_cnic(bp);
9477+
if (!bp->nic_stopped) {
9478+
/* Disable HW interrupts, NAPI */
9479+
bnx2x_netif_stop(bp, 1);
9480+
/* Delete all NAPI objects */
9481+
bnx2x_del_all_napi(bp);
9482+
if (CNIC_LOADED(bp))
9483+
bnx2x_del_all_napi_cnic(bp);
94839484

9484-
/* Release IRQs */
9485-
bnx2x_free_irq(bp);
9485+
/* Release IRQs */
9486+
bnx2x_free_irq(bp);
9487+
bp->nic_stopped = true;
9488+
}
94869489

94879490
/* Reset the chip, unless PCI function is offline. If we reach this
94889491
* point following a PCI error handling, it means device is really
@@ -14238,13 +14241,16 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
1423814241
}
1423914242
bnx2x_drain_tx_queues(bp);
1424014243
bnx2x_send_unload_req(bp, UNLOAD_RECOVERY);
14241-
bnx2x_netif_stop(bp, 1);
14242-
bnx2x_del_all_napi(bp);
14244+
if (!bp->nic_stopped) {
14245+
bnx2x_netif_stop(bp, 1);
14246+
bnx2x_del_all_napi(bp);
1424314247

14244-
if (CNIC_LOADED(bp))
14245-
bnx2x_del_all_napi_cnic(bp);
14248+
if (CNIC_LOADED(bp))
14249+
bnx2x_del_all_napi_cnic(bp);
1424614250

14247-
bnx2x_free_irq(bp);
14251+
bnx2x_free_irq(bp);
14252+
bp->nic_stopped = true;
14253+
}
1424814254

1424914255
/* Report UNLOAD_DONE to MCP */
1425014256
bnx2x_send_unload_done(bp, true);
@@ -14294,11 +14300,16 @@ static void bnx2x_io_resume(struct pci_dev *pdev)
1429414300
bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
1429514301
DRV_MSG_SEQ_NUMBER_MASK;
1429614302

14297-
if (netif_running(dev))
14298-
bnx2x_nic_load(bp, LOAD_NORMAL);
14303+
if (netif_running(dev)) {
14304+
if (bnx2x_nic_load(bp, LOAD_NORMAL)) {
14305+
netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n");
14306+
goto done;
14307+
}
14308+
}
1429914309

1430014310
netif_device_attach(dev);
1430114311

14312+
done:
1430214313
rtnl_unlock();
1430314314
}
1430414315

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ static void bnx2x_set_one_mac_e2(struct bnx2x *bp,
890890
(struct eth_classify_rules_ramrod_data *)(raw->rdata);
891891
int rule_cnt = rule_idx + 1, cmd = elem->cmd_data.vlan_mac.cmd;
892892
union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
893-
bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
893+
bool add = cmd == BNX2X_VLAN_MAC_ADD;
894894
unsigned long *vlan_mac_flags = &elem->cmd_data.vlan_mac.vlan_mac_flags;
895895
u8 *mac = elem->cmd_data.vlan_mac.u.mac.mac;
896896

@@ -1075,7 +1075,7 @@ static void bnx2x_set_one_vlan_e2(struct bnx2x *bp,
10751075
int rule_cnt = rule_idx + 1;
10761076
union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
10771077
enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
1078-
bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
1078+
bool add = cmd == BNX2X_VLAN_MAC_ADD;
10791079
u16 vlan = elem->cmd_data.vlan_mac.u.vlan.vlan;
10801080

10811081
/* Reset the ramrod data buffer for the first rule */
@@ -1125,7 +1125,7 @@ static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp,
11251125
int rule_cnt = rule_idx + 1;
11261126
union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
11271127
enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
1128-
bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
1128+
bool add = cmd == BNX2X_VLAN_MAC_ADD;
11291129
u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan;
11301130
u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac;
11311131
u16 inner_mac;

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -795,16 +795,20 @@ static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf)
795795

796796
static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
797797
{
798-
struct pci_dev *dev;
799798
struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid);
799+
struct pci_dev *dev;
800+
bool pending;
800801

801802
if (!vf)
802803
return false;
803804

804805
dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn);
805-
if (dev)
806-
return bnx2x_is_pcie_pending(dev);
807-
return false;
806+
if (!dev)
807+
return false;
808+
pending = bnx2x_is_pcie_pending(dev);
809+
pci_dev_put(dev);
810+
811+
return pending;
808812
}
809813

810814
int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid)
@@ -1867,7 +1871,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
18671871
{
18681872
int i;
18691873
int first_queue_query_index, num_queues_req;
1870-
dma_addr_t cur_data_offset;
18711874
struct stats_query_entry *cur_query_entry;
18721875
u8 stats_count = 0;
18731876
bool is_fcoe = false;
@@ -1888,10 +1891,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
18881891
BNX2X_NUM_ETH_QUEUES(bp), is_fcoe, first_queue_query_index,
18891892
first_queue_query_index + num_queues_req);
18901893

1891-
cur_data_offset = bp->fw_stats_data_mapping +
1892-
offsetof(struct bnx2x_fw_stats_data, queue_stats) +
1893-
num_queues_req * sizeof(struct per_queue_stats);
1894-
18951894
cur_query_entry = &bp->fw_stats_req->
18961895
query[first_queue_query_index + num_queues_req];
18971896

@@ -1942,7 +1941,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
19421941
cur_query_entry->funcID,
19431942
j, cur_query_entry->index);
19441943
cur_query_entry++;
1945-
cur_data_offset += sizeof(struct per_queue_stats);
19461944
stats_count++;
19471945

19481946
/* all stats are coalesced to the leading queue */

drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,16 @@ void bnx2x_vfpf_close_vf(struct bnx2x *bp)
529529
bnx2x_vfpf_finalize(bp, &req->first_tlv);
530530

531531
free_irq:
532-
/* Disable HW interrupts, NAPI */
533-
bnx2x_netif_stop(bp, 0);
534-
/* Delete all NAPI objects */
535-
bnx2x_del_all_napi(bp);
536-
537-
/* Release IRQs */
538-
bnx2x_free_irq(bp);
532+
if (!bp->nic_stopped) {
533+
/* Disable HW interrupts, NAPI */
534+
bnx2x_netif_stop(bp, 0);
535+
/* Delete all NAPI objects */
536+
bnx2x_del_all_napi(bp);
537+
538+
/* Release IRQs */
539+
bnx2x_free_irq(bp);
540+
bp->nic_stopped = true;
541+
}
539542
}
540543

541544
static void bnx2x_leading_vfq_init(struct bnx2x *bp, struct bnx2x_virtf *vf,

0 commit comments

Comments
 (0)