Skip to content

Commit 024af15

Browse files
committed
Merge branch 'amd-xgbe-next'
Tom Lendacky says: ==================== amd-xgbe: AMD XGBE driver updates 2016-02-12 The following updates and fixes are included in this driver update series: - Disable VLAN filtering in promiscuous mode - Change from using napi_complete to napi_complete_done - Use __napi_schedule_irqoff when running in interrupt context - Verify ethtool speed setting is valid for the selected speedset - Enable PFC based on the pfc_en setting - Fix the mapping of priorities to traffic classes - Do traffic class setup when DCB nl callbacks are invoked - Check Rx queue fifos before stopping Rx queue DMA - Switch from disable_irq to masking interrupts for auto-negotiation This patch series is based on net-next. Changes from v1: - Removed #ifndef and #define of CRCPOLY_LE as part of the patch to disable VLAN filtering in promiscuous mode - Reworked changes to xgbe_setup_tc to resolve conflicts with commit 16e5cc6 (net: rework setup_tc ndo op to consume general tc operand) ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 7009212 + ced3fca commit 024af15

File tree

8 files changed

+340
-217
lines changed

8 files changed

+340
-217
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-common.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* License 1: GPLv2
88
*
9-
* Copyright (c) 2014 Advanced Micro Devices, Inc.
9+
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
1010
*
1111
* This file is free software; you may copy, redistribute and/or modify
1212
* it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@
5656
*
5757
* License 2: Modified BSD
5858
*
59-
* Copyright (c) 2014 Advanced Micro Devices, Inc.
59+
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
6060
* All rights reserved.
6161
*
6262
* Redistribution and use in source and binary forms, with or without
@@ -768,12 +768,16 @@
768768
#define MTL_Q_TQDR 0x08
769769
#define MTL_Q_RQOMR 0x40
770770
#define MTL_Q_RQMPOCR 0x44
771-
#define MTL_Q_RQDR 0x4c
771+
#define MTL_Q_RQDR 0x48
772772
#define MTL_Q_RQFCR 0x50
773773
#define MTL_Q_IER 0x70
774774
#define MTL_Q_ISR 0x74
775775

776776
/* MTL queue register entry bit positions and sizes */
777+
#define MTL_Q_RQDR_PRXQ_INDEX 16
778+
#define MTL_Q_RQDR_PRXQ_WIDTH 14
779+
#define MTL_Q_RQDR_RXQSTS_INDEX 4
780+
#define MTL_Q_RQDR_RXQSTS_WIDTH 2
777781
#define MTL_Q_RQFCR_RFA_INDEX 1
778782
#define MTL_Q_RQFCR_RFA_WIDTH 6
779783
#define MTL_Q_RQFCR_RFD_INDEX 17

drivers/net/ethernet/amd/xgbe/xgbe-dcb.c

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* License 1: GPLv2
88
*
9-
* Copyright (c) 2014 Advanced Micro Devices, Inc.
9+
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
1010
*
1111
* This file is free software; you may copy, redistribute and/or modify
1212
* it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@
5656
*
5757
* License 2: Modified BSD
5858
*
59-
* Copyright (c) 2014 Advanced Micro Devices, Inc.
59+
* Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
6060
* All rights reserved.
6161
*
6262
* Redistribution and use in source and binary forms, with or without
@@ -146,6 +146,7 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
146146
{
147147
struct xgbe_prv_data *pdata = netdev_priv(netdev);
148148
unsigned int i, tc_ets, tc_ets_weight;
149+
u8 max_tc = 0;
149150

150151
tc_ets = 0;
151152
tc_ets_weight = 0;
@@ -157,12 +158,9 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
157158
netif_dbg(pdata, drv, netdev, "PRIO%u: TC=%hhu\n", i,
158159
ets->prio_tc[i]);
159160

160-
if ((ets->tc_tx_bw[i] || ets->tc_tsa[i]) &&
161-
(i >= pdata->hw_feat.tc_cnt))
162-
return -EINVAL;
163-
164-
if (ets->prio_tc[i] >= pdata->hw_feat.tc_cnt)
165-
return -EINVAL;
161+
max_tc = max_t(u8, max_tc, ets->prio_tc[i]);
162+
if ((ets->tc_tx_bw[i] || ets->tc_tsa[i]))
163+
max_tc = max_t(u8, max_tc, i);
166164

167165
switch (ets->tc_tsa[i]) {
168166
case IEEE_8021QAZ_TSA_STRICT:
@@ -171,15 +169,28 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
171169
tc_ets = 1;
172170
tc_ets_weight += ets->tc_tx_bw[i];
173171
break;
174-
175172
default:
173+
netif_err(pdata, drv, netdev,
174+
"unsupported TSA algorithm (%hhu)\n",
175+
ets->tc_tsa[i]);
176176
return -EINVAL;
177177
}
178178
}
179179

180+
/* Check maximum traffic class requested */
181+
if (max_tc >= pdata->hw_feat.tc_cnt) {
182+
netif_err(pdata, drv, netdev,
183+
"exceeded number of supported traffic classes\n");
184+
return -EINVAL;
185+
}
186+
180187
/* Weights must add up to 100% */
181-
if (tc_ets && (tc_ets_weight != 100))
188+
if (tc_ets && (tc_ets_weight != 100)) {
189+
netif_err(pdata, drv, netdev,
190+
"sum of ETS algorithm weights is not 100 (%u)\n",
191+
tc_ets_weight);
182192
return -EINVAL;
193+
}
183194

184195
if (!pdata->ets) {
185196
pdata->ets = devm_kzalloc(pdata->dev, sizeof(*pdata->ets),
@@ -188,6 +199,7 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
188199
return -ENOMEM;
189200
}
190201

202+
pdata->num_tcs = max_tc + 1;
191203
memcpy(pdata->ets, ets, sizeof(*pdata->ets));
192204

193205
pdata->hw_if.config_dcb_tc(pdata);
@@ -221,6 +233,13 @@ static int xgbe_dcb_ieee_setpfc(struct net_device *netdev,
221233
"cap=%hhu, en=%#hhx, mbc=%hhu, delay=%hhu\n",
222234
pfc->pfc_cap, pfc->pfc_en, pfc->mbc, pfc->delay);
223235

236+
/* Check PFC for supported number of traffic classes */
237+
if (pfc->pfc_en & ~((1 << pdata->hw_feat.tc_cnt) - 1)) {
238+
netif_err(pdata, drv, netdev,
239+
"PFC requested for unsupported traffic class\n");
240+
return -EINVAL;
241+
}
242+
224243
if (!pdata->pfc) {
225244
pdata->pfc = devm_kzalloc(pdata->dev, sizeof(*pdata->pfc),
226245
GFP_KERNEL);

0 commit comments

Comments
 (0)