Skip to content

Commit ebfc45e

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull more networking fixes from David Miller: 1) Fix mlx4_en_netpoll implementation, it needs to schedule a NAPI context, not synchronize it. From Chris Mason. 2) Ipv4 flow input interface should never be zero, it should be LOOPBACK_IFINDEX instead. From Cong Wang and Julian Anastasov. 3) Properly configure MAC to PHY connection in mvneta devices, from Thomas Petazzoni. 4) sys_recv should use SYSCALL_DEFINE. From Jan Glauber. 5) Tunnel driver ioctls do not use the correct namespace, fix from Nicolas Dichtel. 6) Fix memory leak on seccomp filter attach, from Kees Cook. 7) Fix lockdep warning for nested vlans, from Ding Tianhong. 8) Crashes can happen in SCTP due to how the auth_enable value is managed, fix from Vlad Yasevich. 9) Wireless fixes from John W Linville and co. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (45 commits) net: sctp: cache auth_enable per endpoint tg3: update rx_jumbo_pending ring param only when jumbo frames are enabled vlan: Fix lockdep warning when vlan dev handle notification seccomp: fix memory leak on filter attach isdn: icn: buffer overflow in icn_command() ip6_tunnel: use the right netns in ioctl handler sit: use the right netns in ioctl handler ip_tunnel: use the right netns in ioctl handler net: use SYSCALL_DEFINEx for sys_recv net: mdio-gpio: Add support for separate MDI and MDO gpio pins net: mdio-gpio: Add support for active low gpio pins net: mdio-gpio: Use devm_ functions where possible ipv4, route: pass 0 instead of LOOPBACK_IFINDEX to fib_validate_source() ipv4, fib: pass LOOPBACK_IFINDEX instead of 0 to flowi4_iif mlx4_en: don't use napi_synchronize inside mlx4_en_netpoll net: mvneta: properly configure the MAC <-> PHY connection in all situations net: phy: add minimal support for QSGMII PHY sfc:On MCDI timeout, issue an FLR (and mark MCDI to fail-fast) mwifiex: fix hung task on command timeout mwifiex: process event before command response ...
2 parents 6e66d5d + b14878c commit ebfc45e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+659
-339
lines changed

Documentation/devicetree/bindings/net/ethernet.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following properties are common to the Ethernet controllers:
1010
- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than
1111
the maximum frame size (there's contradiction in ePAPR).
1212
- phy-mode: string, operation mode of the PHY interface; supported values are
13-
"mii", "gmii", "sgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
13+
"mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
1414
"rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto
1515
standard property;
1616
- phy-connection-type: the same as "phy-mode" property but described in ePAPR;

drivers/isdn/icn/icn.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
11551155
ulong a;
11561156
ulong flags;
11571157
int i;
1158-
char cbuf[60];
1158+
char cbuf[80];
11591159
isdn_ctrl cmd;
11601160
icn_cdef cdef;
11611161
char __user *arg;
@@ -1309,7 +1309,6 @@ icn_command(isdn_ctrl *c, icn_card *card)
13091309
break;
13101310
if ((c->arg & 255) < ICN_BCH) {
13111311
char *p;
1312-
char dial[50];
13131312
char dcode[4];
13141313

13151314
a = c->arg;
@@ -1321,10 +1320,10 @@ icn_command(isdn_ctrl *c, icn_card *card)
13211320
} else
13221321
/* Normal Dial */
13231322
strcpy(dcode, "CAL");
1324-
strcpy(dial, p);
1325-
sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
1326-
dcode, dial, c->parm.setup.si1,
1327-
c->parm.setup.si2, c->parm.setup.eazmsn);
1323+
snprintf(cbuf, sizeof(cbuf),
1324+
"%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
1325+
dcode, p, c->parm.setup.si1,
1326+
c->parm.setup.si2, c->parm.setup.eazmsn);
13281327
i = icn_writecmd(cbuf, strlen(cbuf), 0, card);
13291328
}
13301329
break;

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12286,7 +12286,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
1228612286
if (tg3_flag(tp, MAX_RXPEND_64) &&
1228712287
tp->rx_pending > 63)
1228812288
tp->rx_pending = 63;
12289-
tp->rx_jumbo_pending = ering->rx_jumbo_pending;
12289+
12290+
if (tg3_flag(tp, JUMBO_RING_ENABLE))
12291+
tp->rx_jumbo_pending = ering->rx_jumbo_pending;
1229012292

1229112293
for (i = 0; i < tp->irq_max; i++)
1229212294
tp->napi[i].tx_pending = ering->tx_pending;

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@
8989
#define MVNETA_TX_IN_PRGRS BIT(1)
9090
#define MVNETA_TX_FIFO_EMPTY BIT(8)
9191
#define MVNETA_RX_MIN_FRAME_SIZE 0x247c
92-
#define MVNETA_SGMII_SERDES_CFG 0x24A0
92+
#define MVNETA_SERDES_CFG 0x24A0
9393
#define MVNETA_SGMII_SERDES_PROTO 0x0cc7
94+
#define MVNETA_QSGMII_SERDES_PROTO 0x0667
9495
#define MVNETA_TYPE_PRIO 0x24bc
9596
#define MVNETA_FORCE_UNI BIT(21)
9697
#define MVNETA_TXQ_CMD_1 0x24e4
@@ -711,35 +712,6 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
711712
mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
712713
}
713714

714-
715-
716-
/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
717-
static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
718-
{
719-
u32 val;
720-
721-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
722-
723-
if (enable)
724-
val |= MVNETA_GMAC2_PORT_RGMII;
725-
else
726-
val &= ~MVNETA_GMAC2_PORT_RGMII;
727-
728-
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
729-
}
730-
731-
/* Config SGMII port */
732-
static void mvneta_port_sgmii_config(struct mvneta_port *pp)
733-
{
734-
u32 val;
735-
736-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
737-
val |= MVNETA_GMAC2_PCS_ENABLE;
738-
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
739-
740-
mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
741-
}
742-
743715
/* Start the Ethernet port RX and TX activity */
744716
static void mvneta_port_up(struct mvneta_port *pp)
745717
{
@@ -2749,26 +2721,44 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
27492721
}
27502722

27512723
/* Power up the port */
2752-
static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2724+
static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
27532725
{
2754-
u32 val;
2726+
u32 ctrl;
27552727

27562728
/* MAC Cause register should be cleared */
27572729
mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
27582730

2759-
if (phy_mode == PHY_INTERFACE_MODE_SGMII)
2760-
mvneta_port_sgmii_config(pp);
2731+
ctrl = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
27612732

2762-
mvneta_gmac_rgmii_set(pp, 1);
2733+
/* Even though it might look weird, when we're configured in
2734+
* SGMII or QSGMII mode, the RGMII bit needs to be set.
2735+
*/
2736+
switch(phy_mode) {
2737+
case PHY_INTERFACE_MODE_QSGMII:
2738+
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO);
2739+
ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
2740+
break;
2741+
case PHY_INTERFACE_MODE_SGMII:
2742+
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
2743+
ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
2744+
break;
2745+
case PHY_INTERFACE_MODE_RGMII:
2746+
case PHY_INTERFACE_MODE_RGMII_ID:
2747+
ctrl |= MVNETA_GMAC2_PORT_RGMII;
2748+
break;
2749+
default:
2750+
return -EINVAL;
2751+
}
27632752

27642753
/* Cancel Port Reset */
2765-
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
2766-
val &= ~MVNETA_GMAC2_PORT_RESET;
2767-
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
2754+
ctrl &= ~MVNETA_GMAC2_PORT_RESET;
2755+
mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);
27682756

27692757
while ((mvreg_read(pp, MVNETA_GMAC_CTRL_2) &
27702758
MVNETA_GMAC2_PORT_RESET) != 0)
27712759
continue;
2760+
2761+
return 0;
27722762
}
27732763

27742764
/* Device initialization routine */
@@ -2879,7 +2869,12 @@ static int mvneta_probe(struct platform_device *pdev)
28792869
dev_err(&pdev->dev, "can't init eth hal\n");
28802870
goto err_free_stats;
28812871
}
2882-
mvneta_port_power_up(pp, phy_mode);
2872+
2873+
err = mvneta_port_power_up(pp, phy_mode);
2874+
if (err < 0) {
2875+
dev_err(&pdev->dev, "can't power up port\n");
2876+
goto err_deinit;
2877+
}
28832878

28842879
dram_target_info = mv_mbus_dram_info();
28852880
if (dram_target_info)

drivers/net/ethernet/mellanox/mlx4/en_cq.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
6666

6767
cq->ring = ring;
6868
cq->is_tx = mode;
69-
spin_lock_init(&cq->lock);
7069

7170
/* Allocate HW buffers on provided NUMA node.
7271
* dev->numa_node is used in mtt range allocation flow.

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,15 +1304,11 @@ static void mlx4_en_netpoll(struct net_device *dev)
13041304
{
13051305
struct mlx4_en_priv *priv = netdev_priv(dev);
13061306
struct mlx4_en_cq *cq;
1307-
unsigned long flags;
13081307
int i;
13091308

13101309
for (i = 0; i < priv->rx_ring_num; i++) {
13111310
cq = priv->rx_cq[i];
1312-
spin_lock_irqsave(&cq->lock, flags);
1313-
napi_synchronize(&cq->napi);
1314-
mlx4_en_process_rx_cq(dev, cq, 0);
1315-
spin_unlock_irqrestore(&cq->lock, flags);
1311+
napi_schedule(&cq->napi);
13161312
}
13171313
}
13181314
#endif

drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ struct mlx4_en_cq {
319319
struct mlx4_cq mcq;
320320
struct mlx4_hwq_resources wqres;
321321
int ring;
322-
spinlock_t lock;
323322
struct net_device *dev;
324323
struct napi_struct napi;
325324
int size;

drivers/net/ethernet/sfc/ef10.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,11 @@ static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type)
738738
/* If it was a port reset, trigger reallocation of MC resources.
739739
* Note that on an MC reset nothing needs to be done now because we'll
740740
* detect the MC reset later and handle it then.
741+
* For an FLR, we never get an MC reset event, but the MC has reset all
742+
* resources assigned to us, so we have to trigger reallocation now.
741743
*/
742-
if (reset_type == RESET_TYPE_ALL && !rc)
744+
if ((reset_type == RESET_TYPE_ALL ||
745+
reset_type == RESET_TYPE_MCDI_TIMEOUT) && !rc)
743746
efx_ef10_reset_mc_allocations(efx);
744747
return rc;
745748
}
@@ -2141,6 +2144,11 @@ static int efx_ef10_fini_dmaq(struct efx_nic *efx)
21412144
return 0;
21422145
}
21432146

2147+
static void efx_ef10_prepare_flr(struct efx_nic *efx)
2148+
{
2149+
atomic_set(&efx->active_queues, 0);
2150+
}
2151+
21442152
static bool efx_ef10_filter_equal(const struct efx_filter_spec *left,
21452153
const struct efx_filter_spec *right)
21462154
{
@@ -3603,6 +3611,8 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
36033611
.probe_port = efx_mcdi_port_probe,
36043612
.remove_port = efx_mcdi_port_remove,
36053613
.fini_dmaq = efx_ef10_fini_dmaq,
3614+
.prepare_flr = efx_ef10_prepare_flr,
3615+
.finish_flr = efx_port_dummy_op_void,
36063616
.describe_stats = efx_ef10_describe_stats,
36073617
.update_stats = efx_ef10_update_stats,
36083618
.start_stats = efx_mcdi_mac_start_stats,

drivers/net/ethernet/sfc/efx.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ const char *const efx_reset_type_names[] = {
7676
[RESET_TYPE_RECOVER_OR_ALL] = "RECOVER_OR_ALL",
7777
[RESET_TYPE_WORLD] = "WORLD",
7878
[RESET_TYPE_RECOVER_OR_DISABLE] = "RECOVER_OR_DISABLE",
79+
[RESET_TYPE_MC_BIST] = "MC_BIST",
7980
[RESET_TYPE_DISABLE] = "DISABLE",
8081
[RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG",
8182
[RESET_TYPE_INT_ERROR] = "INT_ERROR",
8283
[RESET_TYPE_RX_RECOVERY] = "RX_RECOVERY",
8384
[RESET_TYPE_DMA_ERROR] = "DMA_ERROR",
8485
[RESET_TYPE_TX_SKIP] = "TX_SKIP",
8586
[RESET_TYPE_MC_FAILURE] = "MC_FAILURE",
86-
[RESET_TYPE_MC_BIST] = "MC_BIST",
87+
[RESET_TYPE_MCDI_TIMEOUT] = "MCDI_TIMEOUT (FLR)",
8788
};
8889

8990
/* Reset workqueue. If any NIC has a hardware failure then a reset will be
@@ -1739,7 +1740,8 @@ static void efx_start_all(struct efx_nic *efx)
17391740

17401741
/* Check that it is appropriate to restart the interface. All
17411742
* of these flags are safe to read under just the rtnl lock */
1742-
if (efx->port_enabled || !netif_running(efx->net_dev))
1743+
if (efx->port_enabled || !netif_running(efx->net_dev) ||
1744+
efx->reset_pending)
17431745
return;
17441746

17451747
efx_start_port(efx);
@@ -2334,6 +2336,9 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method)
23342336
{
23352337
EFX_ASSERT_RESET_SERIALISED(efx);
23362338

2339+
if (method == RESET_TYPE_MCDI_TIMEOUT)
2340+
efx->type->prepare_flr(efx);
2341+
23372342
efx_stop_all(efx);
23382343
efx_disable_interrupts(efx);
23392344

@@ -2354,6 +2359,10 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
23542359

23552360
EFX_ASSERT_RESET_SERIALISED(efx);
23562361

2362+
if (method == RESET_TYPE_MCDI_TIMEOUT)
2363+
efx->type->finish_flr(efx);
2364+
2365+
/* Ensure that SRAM is initialised even if we're disabling the device */
23572366
rc = efx->type->init(efx);
23582367
if (rc) {
23592368
netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n");
@@ -2417,7 +2426,10 @@ int efx_reset(struct efx_nic *efx, enum reset_type method)
24172426
/* Clear flags for the scopes we covered. We assume the NIC and
24182427
* driver are now quiescent so that there is no race here.
24192428
*/
2420-
efx->reset_pending &= -(1 << (method + 1));
2429+
if (method < RESET_TYPE_MAX_METHOD)
2430+
efx->reset_pending &= -(1 << (method + 1));
2431+
else /* it doesn't fit into the well-ordered scope hierarchy */
2432+
__clear_bit(method, &efx->reset_pending);
24212433

24222434
/* Reinitialise bus-mastering, which may have been turned off before
24232435
* the reset was scheduled. This is still appropriate, even in the
@@ -2546,6 +2558,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type)
25462558
case RESET_TYPE_DISABLE:
25472559
case RESET_TYPE_RECOVER_OR_DISABLE:
25482560
case RESET_TYPE_MC_BIST:
2561+
case RESET_TYPE_MCDI_TIMEOUT:
25492562
method = type;
25502563
netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n",
25512564
RESET_TYPE(method));

drivers/net/ethernet/sfc/enum.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,29 +143,38 @@ enum efx_loopback_mode {
143143
* @RESET_TYPE_WORLD: Reset as much as possible
144144
* @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if
145145
* unsuccessful.
146+
* @RESET_TYPE_MC_BIST: MC entering BIST mode.
146147
* @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled
147148
* @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
148149
* @RESET_TYPE_INT_ERROR: reset due to internal error
149150
* @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors
150151
* @RESET_TYPE_DMA_ERROR: DMA error
151152
* @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
152153
* @RESET_TYPE_MC_FAILURE: MC reboot/assertion
154+
* @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout.
153155
*/
154156
enum reset_type {
155-
RESET_TYPE_INVISIBLE = 0,
156-
RESET_TYPE_RECOVER_OR_ALL = 1,
157-
RESET_TYPE_ALL = 2,
158-
RESET_TYPE_WORLD = 3,
159-
RESET_TYPE_RECOVER_OR_DISABLE = 4,
160-
RESET_TYPE_DISABLE = 5,
157+
RESET_TYPE_INVISIBLE,
158+
RESET_TYPE_RECOVER_OR_ALL,
159+
RESET_TYPE_ALL,
160+
RESET_TYPE_WORLD,
161+
RESET_TYPE_RECOVER_OR_DISABLE,
162+
RESET_TYPE_MC_BIST,
163+
RESET_TYPE_DISABLE,
161164
RESET_TYPE_MAX_METHOD,
162165
RESET_TYPE_TX_WATCHDOG,
163166
RESET_TYPE_INT_ERROR,
164167
RESET_TYPE_RX_RECOVERY,
165168
RESET_TYPE_DMA_ERROR,
166169
RESET_TYPE_TX_SKIP,
167170
RESET_TYPE_MC_FAILURE,
168-
RESET_TYPE_MC_BIST,
171+
/* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but
172+
* it doesn't fit the scope hierarchy (not well-ordered by inclusion).
173+
* We encode this by having its enum value be greater than
174+
* RESET_TYPE_MAX_METHOD. This also prevents issuing it with
175+
* efx_ioctl_reset.
176+
*/
177+
RESET_TYPE_MCDI_TIMEOUT,
169178
RESET_TYPE_MAX,
170179
};
171180

0 commit comments

Comments
 (0)