Skip to content

Commit f83e830

Browse files
committed
Merge branch 'bnxt_en-dcbnl'
Michael Chan says: ==================== bnxt_en: Add DCBNL support. This series adds DCBNL operations to support host-based IEEE DCBX. v2: Updated to the latest firmware interface spec. David, please consider this series for net-next. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents c7a6131 + c77192f commit f83e830

File tree

9 files changed

+1672
-715
lines changed

9 files changed

+1672
-715
lines changed

drivers/net/ethernet/broadcom/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,14 @@ config BNXT_SRIOV
203203
Virtualization support in the NetXtreme-C/E products. This
204204
allows for virtual function acceleration in virtual environments.
205205

206+
config BNXT_DCB
207+
bool "Data Center Bridging (DCB) Support"
208+
default n
209+
depends on BNXT && DCB
210+
---help---
211+
Say Y here if you want to use Data Center Bridging (DCB) in the
212+
driver.
213+
214+
If unsure, say N.
215+
206216
endif # NET_VENDOR_BROADCOM
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
obj-$(CONFIG_BNXT) += bnxt_en.o
22

3-
bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o
3+
bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "bnxt.h"
5555
#include "bnxt_sriov.h"
5656
#include "bnxt_ethtool.h"
57+
#include "bnxt_dcb.h"
5758

5859
#define BNXT_TX_TIMEOUT (5 * HZ)
5960

@@ -186,11 +187,11 @@ static const u16 bnxt_vf_req_snif[] = {
186187
};
187188

188189
static const u16 bnxt_async_events_arr[] = {
189-
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE,
190-
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD,
191-
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED,
192-
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE,
193-
HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE,
190+
ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE,
191+
ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD,
192+
ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED,
193+
ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE,
194+
ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE,
194195
};
195196

196197
static bool bnxt_vf_pciid(enum board_idx idx)
@@ -1476,8 +1477,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
14761477
}
14771478

14781479
#define BNXT_GET_EVENT_PORT(data) \
1479-
((data) & \
1480-
HWRM_ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_PORT_ID_MASK)
1480+
((data) & \
1481+
ASYNC_EVENT_CMPL_PORT_CONN_NOT_ALLOWED_EVENT_DATA1_PORT_ID_MASK)
14811482

14821483
static int bnxt_async_event_process(struct bnxt *bp,
14831484
struct hwrm_async_event_cmpl *cmpl)
@@ -1486,7 +1487,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
14861487

14871488
/* TODO CHIMP_FW: Define event id's for link change, error etc */
14881489
switch (event_id) {
1489-
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: {
1490+
case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: {
14901491
u32 data1 = le32_to_cpu(cmpl->event_data1);
14911492
struct bnxt_link_info *link_info = &bp->link_info;
14921493

@@ -1502,13 +1503,13 @@ static int bnxt_async_event_process(struct bnxt *bp,
15021503
set_bit(BNXT_LINK_SPEED_CHNG_SP_EVENT, &bp->sp_event);
15031504
/* fall thru */
15041505
}
1505-
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
1506+
case ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
15061507
set_bit(BNXT_LINK_CHNG_SP_EVENT, &bp->sp_event);
15071508
break;
1508-
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
1509+
case ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
15091510
set_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event);
15101511
break;
1511-
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: {
1512+
case ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: {
15121513
u32 data1 = le32_to_cpu(cmpl->event_data1);
15131514
u16 port_id = BNXT_GET_EVENT_PORT(data1);
15141515

@@ -1521,7 +1522,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
15211522
set_bit(BNXT_HWRM_PORT_MODULE_SP_EVENT, &bp->sp_event);
15221523
break;
15231524
}
1524-
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
1525+
case ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE:
15251526
if (BNXT_PF(bp))
15261527
goto async_event_process_exit;
15271528
set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event);
@@ -4261,12 +4262,16 @@ static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
42614262
goto qportcfg_exit;
42624263
}
42634264
bp->max_tc = resp->max_configurable_queues;
4265+
bp->max_lltc = resp->max_configurable_lossless_queues;
42644266
if (bp->max_tc > BNXT_MAX_QUEUE)
42654267
bp->max_tc = BNXT_MAX_QUEUE;
42664268

42674269
if (resp->queue_cfg_info & QUEUE_QPORTCFG_RESP_QUEUE_CFG_INFO_ASYM_CFG)
42684270
bp->max_tc = 1;
42694271

4272+
if (bp->max_lltc > bp->max_tc)
4273+
bp->max_lltc = bp->max_tc;
4274+
42704275
qptr = &resp->queue_id0;
42714276
for (i = 0; i < bp->max_tc; i++) {
42724277
bp->q_info[i].queue_id = *qptr++;
@@ -4993,7 +4998,7 @@ static void bnxt_enable_napi(struct bnxt *bp)
49934998
}
49944999
}
49955000

4996-
static void bnxt_tx_disable(struct bnxt *bp)
5001+
void bnxt_tx_disable(struct bnxt *bp)
49975002
{
49985003
int i;
49995004
struct bnxt_tx_ring_info *txr;
@@ -5011,7 +5016,7 @@ static void bnxt_tx_disable(struct bnxt *bp)
50115016
netif_carrier_off(bp->dev);
50125017
}
50135018

5014-
static void bnxt_tx_enable(struct bnxt *bp)
5019+
void bnxt_tx_enable(struct bnxt *bp)
50155020
{
50165021
int i;
50175022
struct bnxt_tx_ring_info *txr;
@@ -6337,17 +6342,10 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)
63376342
return 0;
63386343
}
63396344

6340-
static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
6341-
struct tc_to_netdev *ntc)
6345+
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
63426346
{
63436347
struct bnxt *bp = netdev_priv(dev);
63446348
bool sh = false;
6345-
u8 tc;
6346-
6347-
if (ntc->type != TC_SETUP_MQPRIO)
6348-
return -EINVAL;
6349-
6350-
tc = ntc->tc;
63516349

63526350
if (tc > bp->max_tc) {
63536351
netdev_err(dev, "too many traffic classes requested: %d Max supported is %d\n",
@@ -6390,6 +6388,15 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
63906388
return 0;
63916389
}
63926390

6391+
static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
6392+
struct tc_to_netdev *ntc)
6393+
{
6394+
if (ntc->type != TC_SETUP_MQPRIO)
6395+
return -EINVAL;
6396+
6397+
return bnxt_setup_mq_tc(dev, ntc->tc);
6398+
}
6399+
63936400
#ifdef CONFIG_RFS_ACCEL
63946401
static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
63956402
struct bnxt_ntuple_filter *f2)
@@ -6680,6 +6687,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)
66806687

66816688
bnxt_hwrm_func_drv_unrgtr(bp);
66826689
bnxt_free_hwrm_resources(bp);
6690+
bnxt_dcb_free(bp);
66836691
pci_iounmap(pdev, bp->bar2);
66846692
pci_iounmap(pdev, bp->bar1);
66856693
pci_iounmap(pdev, bp->bar0);
@@ -6907,6 +6915,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
69076915
dev->min_mtu = ETH_ZLEN;
69086916
dev->max_mtu = 9500;
69096917

6918+
bnxt_dcb_init(bp);
6919+
69106920
#ifdef CONFIG_BNXT_SRIOV
69116921
init_waitqueue_head(&bp->sriov_cfg_wait);
69126922
#endif

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#define BNXT_H
1212

1313
#define DRV_MODULE_NAME "bnxt_en"
14-
#define DRV_MODULE_VERSION "1.5.0"
14+
#define DRV_MODULE_VERSION "1.6.0"
1515

1616
#define DRV_VER_MAJ 1
17-
#define DRV_VER_MIN 5
17+
#define DRV_VER_MIN 6
1818
#define DRV_VER_UPD 0
1919

2020
struct tx_bd {
@@ -1010,6 +1010,7 @@ struct bnxt {
10101010
u32 rss_hash_cfg;
10111011

10121012
u8 max_tc;
1013+
u8 max_lltc; /* lossless TCs */
10131014
struct bnxt_queue_info q_info[BNXT_MAX_QUEUE];
10141015

10151016
unsigned int current_interval;
@@ -1025,6 +1026,13 @@ struct bnxt {
10251026
struct bnxt_irq *irq_tbl;
10261027
u8 mac_addr[ETH_ALEN];
10271028

1029+
#ifdef CONFIG_BNXT_DCB
1030+
struct ieee_pfc *ieee_pfc;
1031+
struct ieee_ets *ieee_ets;
1032+
u8 dcbx_cap;
1033+
u8 default_pri;
1034+
#endif /* CONFIG_BNXT_DCB */
1035+
10281036
u32 msg_enable;
10291037

10301038
u32 hwrm_spec_code;
@@ -1116,6 +1124,13 @@ struct bnxt {
11161124
u32 lpi_tmr_hi;
11171125
};
11181126

1127+
#define BNXT_RX_STATS_OFFSET(counter) \
1128+
(offsetof(struct rx_port_stats, counter) / 8)
1129+
1130+
#define BNXT_TX_STATS_OFFSET(counter) \
1131+
((offsetof(struct tx_port_stats, counter) + \
1132+
sizeof(struct rx_port_stats) + 512) / 8)
1133+
11191134
#ifdef CONFIG_NET_RX_BUSY_POLL
11201135
static inline void bnxt_enable_poll(struct bnxt_napi *bnapi)
11211136
{
@@ -1220,10 +1235,13 @@ int hwrm_send_message(struct bnxt *, void *, u32, int);
12201235
int hwrm_send_message_silent(struct bnxt *, void *, u32, int);
12211236
int bnxt_hwrm_set_coal(struct bnxt *);
12221237
int bnxt_hwrm_func_qcaps(struct bnxt *);
1238+
void bnxt_tx_disable(struct bnxt *bp);
1239+
void bnxt_tx_enable(struct bnxt *bp);
12231240
int bnxt_hwrm_set_pause(struct bnxt *);
12241241
int bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool);
12251242
int bnxt_hwrm_fw_set_time(struct bnxt *);
12261243
int bnxt_open_nic(struct bnxt *, bool, bool);
12271244
int bnxt_close_nic(struct bnxt *, bool, bool);
1245+
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
12281246
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
12291247
#endif

0 commit comments

Comments
 (0)