Skip to content

Commit ddea368

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix SKB leak in 8139cp, from Dave Jones. 2) Fix use of *_PAGES interfaces with mlx5 firmware, from Moshe Lazar. 3) RCU conversion of macvtap introduced two races, fixes by Eric Dumazet 4) Synchronize statistic flows in bnx2x driver to prevent corruption, from Dmitry Kravkov 5) Undo optimization in IP tunneling, we were using the inner IP header in some cases to inherit the IP ID, but that isn't correct in some circumstances. From Pravin B Shelar 6) Use correct struct size when parsing netlink attributes in rtnl_bridge_getlink(). From Asbjoern Sloth Toennesen 7) Length verifications in tun_get_user() are bogus, from Weiping Pan and Dan Carpenter 8) Fix bad merge resolution during 3.11 networking development in openvswitch, albeit a harmless one which added some unreachable code. From Jesse Gross 9) Wrong size used in flexible array allocation in openvswitch, from Pravin B Shelar 10) Clear out firmware capability flags the be2net driver isn't ready to handle yet, from Sarveshwar Bandi 11) Revert DMA mapping error checking addition to cxgb3 driver, it's buggy. From Alexey Kardashevskiy 12) Fix regression in packet scheduler rate limiting when working with a link layer of ATM. From Jesper Dangaard Brouer 13) Fix several errors in TCP Cubic congestion control, in particular overflow errors in timestamp calculations. From Eric Dumazet and Van Jacobson 14) In ipv6 routing lookups, we need to backtrack if subtree traversal don't result in a match. From Hannes Frederic Sowa 15) ipgre_header() returns incorrect packet offset. Fix from Timo Teräs 16) Get "low latency" out of the new MIB counter names. From Eliezer Tamir 17) State check in ndo_dflt_fdb_del() is inverted, from Sridhar Samudrala 18) Handle TCP Fast Open properly in netfilter conntrack, from Yuchung Cheng 19) Wrong memcpy length in pcan_usb driver, from Stephane Grosjean 20) Fix dealock in TIPC, from Wang Weidong and Ding Tianhong 21) call_rcu() call to destroy SCTP transport is done too early and might result in an oops. From Daniel Borkmann 22) Fix races in genetlink family dumps, from Johannes Berg 23) Flags passed into macvlan by the user need to be validated properly, from Michael S Tsirkin 24) Fix skge build on 32-bit, from Stephen Hemminger 25) Handle malformed TCP headers properly in xt_TCPMSS, from Pablo Neira Ayuso 26) Fix handling of stacked vlans in vlan_dev_real_dev(), from Nikolay Aleksandrov 27) Eliminate MTU calculation overflows in esp{4,6}, from Daniel Borkmann 28) neigh_parms need to be setup before calling the ->ndo_neigh_setup() method. From Veaceslav Falico 29) Kill out-of-bounds prefetch in fib_trie, from Eric Dumazet 30) Don't dereference MLD query message if the length isn't value in the bridge multicast code, from Linus Lüssing 31) Fix VXLAN IGMP join regression due to an inverted check, from Cong Wang * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (70 commits) net/mlx5_core: Support MANAGE_PAGES and QUERY_PAGES firmware command changes tun: signedness bug in tun_get_user() qlcnic: Fix diagnostic interrupt test for 83xx adapters qlcnic: Fix beacon state return status handling qlcnic: Fix set driver version command net: tg3: fix NULL pointer dereference in tg3_io_error_detected and tg3_io_slot_reset net_sched: restore "linklayer atm" handling drivers/net/ethernet/via/via-velocity.c: update napi implementation Revert "cxgb3: Check and handle the dma mapping errors" be2net: Clear any capability flags that driver is not interested in. openvswitch: Reset tunnel key between input and output. openvswitch: Use correct type while allocating flex array. openvswitch: Fix bad merge resolution. tun: compare with 0 instead of total_len rtnetlink: rtnl_bridge_getlink: Call nlmsg_find_attr() with ifinfomsg header ethernet/arc/arc_emac - fix NAPI "work > weight" warning ip_tunnel: Do not use inner ip-header-id for tunnel ip-header-id. bnx2x: prevent crash in shutdown flow with CNIC bnx2x: fix PTE write access error bnx2x: fix memory leak in VF ...
2 parents 2b04725 + 0a324f3 commit ddea368

Some content is hidden

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

80 files changed

+651
-377
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5581,9 +5581,9 @@ S: Maintained
55815581
F: drivers/media/tuners/mxl5007t.*
55825582

55835583
MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
5584-
M: Andrew Gallatin <gallatin@myri.com>
5584+
M: Hyong-Youb Kim <hykim@myri.com>
55855585
5586-
W: http://www.myri.com/scs/download-Myri10GE.html
5586+
W: https://www.myricom.com/support/downloads/myri10ge.html
55875587
S: Supported
55885588
F: drivers/net/ethernet/myricom/myri10ge/
55895589

drivers/net/bonding/bond_main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3714,11 +3714,17 @@ static int bond_neigh_init(struct neighbour *n)
37143714
* The bonding ndo_neigh_setup is called at init time beofre any
37153715
* slave exists. So we must declare proxy setup function which will
37163716
* be used at run time to resolve the actual slave neigh param setup.
3717+
*
3718+
* It's also called by master devices (such as vlans) to setup their
3719+
* underlying devices. In that case - do nothing, we're already set up from
3720+
* our init.
37173721
*/
37183722
static int bond_neigh_setup(struct net_device *dev,
37193723
struct neigh_parms *parms)
37203724
{
3721-
parms->neigh_setup = bond_neigh_init;
3725+
/* modify only our neigh_parms */
3726+
if (parms->dev == dev)
3727+
parms->neigh_setup = bond_neigh_init;
37223728

37233729
return 0;
37243730
}

drivers/net/can/usb/peak_usb/pcan_usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
649649
if ((mc->ptr + rec_len) > mc->end)
650650
goto decode_failed;
651651

652-
memcpy(cf->data, mc->ptr, rec_len);
652+
memcpy(cf->data, mc->ptr, cf->can_dlc);
653653
mc->ptr += rec_len;
654654
}
655655

drivers/net/ethernet/arc/emac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget)
199199
struct arc_emac_priv *priv = netdev_priv(ndev);
200200
unsigned int work_done;
201201

202-
for (work_done = 0; work_done <= budget; work_done++) {
202+
for (work_done = 0; work_done < budget; work_done++) {
203203
unsigned int *last_rx_bd = &priv->last_rx_bd;
204204
struct net_device_stats *stats = &priv->stats;
205205
struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ struct bnx2x {
15021502
#define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21)
15031503
#define IS_VF_FLAG (1 << 22)
15041504
#define INTERRUPTS_ENABLED_FLAG (1 << 23)
1505+
#define BC_SUPPORTS_RMMOD_CMD (1 << 24)
15051506

15061507
#define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG)
15071508

@@ -1830,6 +1831,8 @@ struct bnx2x {
18301831

18311832
int fp_array_size;
18321833
u32 dump_preset_idx;
1834+
bool stats_started;
1835+
struct semaphore stats_sema;
18331836
};
18341837

18351838
/* Tx queues may be less or equal to Rx queues */
@@ -2451,4 +2454,6 @@ enum bnx2x_pci_bus_speed {
24512454
BNX2X_PCI_LINK_SPEED_5000 = 5000,
24522455
BNX2X_PCI_LINK_SPEED_8000 = 8000
24532456
};
2457+
2458+
void bnx2x_set_local_cmng(struct bnx2x *bp);
24542459
#endif /* bnx2x.h */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,10 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
753753
bnx2x_pfc_set_pfc(bp);
754754

755755
bnx2x_dcbx_update_ets_params(bp);
756+
757+
/* ets may affect cmng configuration: reinit it in hw */
758+
bnx2x_set_local_cmng(bp);
759+
756760
bnx2x_dcbx_resume_hw_tx(bp);
757761

758762
return;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,9 @@ struct drv_func_mb {
13001300

13011301
#define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000
13021302

1303+
#define DRV_MSG_CODE_RMMOD 0xdb000000
1304+
#define REQ_BC_VER_4_RMMOD_CMD 0x0007080f
1305+
13031306
#define DRV_MSG_CODE_SET_MF_BW 0xe0000000
13041307
#define REQ_BC_VER_4_SET_MF_BW 0x00060202
13051308
#define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000
@@ -1372,6 +1375,8 @@ struct drv_func_mb {
13721375

13731376
#define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000
13741377

1378+
#define FW_MSG_CODE_RMMOD_ACK 0xdb100000
1379+
13751380
#define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000
13761381
#define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
13771382

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

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,7 +2476,7 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type)
24762476

24772477
input.port_rate = bp->link_vars.line_speed;
24782478

2479-
if (cmng_type == CMNG_FNS_MINMAX) {
2479+
if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) {
24802480
int vn;
24812481

24822482
/* read mf conf from shmem */
@@ -2533,6 +2533,21 @@ static void storm_memset_cmng(struct bnx2x *bp,
25332533
}
25342534
}
25352535

2536+
/* init cmng mode in HW according to local configuration */
2537+
void bnx2x_set_local_cmng(struct bnx2x *bp)
2538+
{
2539+
int cmng_fns = bnx2x_get_cmng_fns_mode(bp);
2540+
2541+
if (cmng_fns != CMNG_FNS_NONE) {
2542+
bnx2x_cmng_fns_init(bp, false, cmng_fns);
2543+
storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));
2544+
} else {
2545+
/* rate shaping and fairness are disabled */
2546+
DP(NETIF_MSG_IFUP,
2547+
"single function mode without fairness\n");
2548+
}
2549+
}
2550+
25362551
/* This function is called upon link interrupt */
25372552
static void bnx2x_link_attn(struct bnx2x *bp)
25382553
{
@@ -2568,17 +2583,8 @@ static void bnx2x_link_attn(struct bnx2x *bp)
25682583
bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
25692584
}
25702585

2571-
if (bp->link_vars.link_up && bp->link_vars.line_speed) {
2572-
int cmng_fns = bnx2x_get_cmng_fns_mode(bp);
2573-
2574-
if (cmng_fns != CMNG_FNS_NONE) {
2575-
bnx2x_cmng_fns_init(bp, false, cmng_fns);
2576-
storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));
2577-
} else
2578-
/* rate shaping and fairness are disabled */
2579-
DP(NETIF_MSG_IFUP,
2580-
"single function mode without fairness\n");
2581-
}
2586+
if (bp->link_vars.link_up && bp->link_vars.line_speed)
2587+
bnx2x_set_local_cmng(bp);
25822588

25832589
__bnx2x_link_report(bp);
25842590

@@ -10362,6 +10368,10 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp)
1036210368

1036310369
bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ?
1036410370
BC_SUPPORTS_DCBX_MSG_NON_PMF : 0;
10371+
10372+
bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ?
10373+
BC_SUPPORTS_RMMOD_CMD : 0;
10374+
1036510375
boot_mode = SHMEM_RD(bp,
1036610376
dev_info.port_feature_config[BP_PORT(bp)].mba_config) &
1036710377
PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK;
@@ -11524,6 +11534,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
1152411534
mutex_init(&bp->port.phy_mutex);
1152511535
mutex_init(&bp->fw_mb_mutex);
1152611536
spin_lock_init(&bp->stats_lock);
11537+
sema_init(&bp->stats_sema, 1);
1152711538

1152811539
INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
1152911540
INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task);
@@ -12817,13 +12828,17 @@ static void __bnx2x_remove(struct pci_dev *pdev,
1281712828
bnx2x_dcbnl_update_applist(bp, true);
1281812829
#endif
1281912830

12831+
if (IS_PF(bp) &&
12832+
!BP_NOMCP(bp) &&
12833+
(bp->flags & BC_SUPPORTS_RMMOD_CMD))
12834+
bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0);
12835+
1282012836
/* Close the interface - either directly or implicitly */
1282112837
if (remove_netdev) {
1282212838
unregister_netdev(dev);
1282312839
} else {
1282412840
rtnl_lock();
12825-
if (netif_running(dev))
12826-
bnx2x_close(dev);
12841+
dev_close(dev);
1282712842
rtnl_unlock();
1282812843
}
1282912844

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3463,7 +3463,7 @@ int bnx2x_vf_pci_alloc(struct bnx2x *bp)
34633463
alloc_mem_err:
34643464
BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
34653465
sizeof(struct bnx2x_vf_mbx_msg));
3466-
BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
3466+
BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,
34673467
sizeof(union pf_vf_bulletin));
34683468
return -ENOMEM;
34693469
}

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

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ static int bnx2x_stats_comp(struct bnx2x *bp)
221221
* Statistics service functions
222222
*/
223223

224-
static void bnx2x_stats_pmf_update(struct bnx2x *bp)
224+
/* should be called under stats_sema */
225+
static void __bnx2x_stats_pmf_update(struct bnx2x *bp)
225226
{
226227
struct dmae_command *dmae;
227228
u32 opcode;
@@ -518,7 +519,8 @@ static void bnx2x_func_stats_init(struct bnx2x *bp)
518519
*stats_comp = 0;
519520
}
520521

521-
static void bnx2x_stats_start(struct bnx2x *bp)
522+
/* should be called under stats_sema */
523+
static void __bnx2x_stats_start(struct bnx2x *bp)
522524
{
523525
/* vfs travel through here as part of the statistics FSM, but no action
524526
* is required
@@ -534,13 +536,34 @@ static void bnx2x_stats_start(struct bnx2x *bp)
534536

535537
bnx2x_hw_stats_post(bp);
536538
bnx2x_storm_stats_post(bp);
539+
540+
bp->stats_started = true;
541+
}
542+
543+
static void bnx2x_stats_start(struct bnx2x *bp)
544+
{
545+
if (down_timeout(&bp->stats_sema, HZ/10))
546+
BNX2X_ERR("Unable to acquire stats lock\n");
547+
__bnx2x_stats_start(bp);
548+
up(&bp->stats_sema);
537549
}
538550

539551
static void bnx2x_stats_pmf_start(struct bnx2x *bp)
540552
{
553+
if (down_timeout(&bp->stats_sema, HZ/10))
554+
BNX2X_ERR("Unable to acquire stats lock\n");
541555
bnx2x_stats_comp(bp);
542-
bnx2x_stats_pmf_update(bp);
543-
bnx2x_stats_start(bp);
556+
__bnx2x_stats_pmf_update(bp);
557+
__bnx2x_stats_start(bp);
558+
up(&bp->stats_sema);
559+
}
560+
561+
static void bnx2x_stats_pmf_update(struct bnx2x *bp)
562+
{
563+
if (down_timeout(&bp->stats_sema, HZ/10))
564+
BNX2X_ERR("Unable to acquire stats lock\n");
565+
__bnx2x_stats_pmf_update(bp);
566+
up(&bp->stats_sema);
544567
}
545568

546569
static void bnx2x_stats_restart(struct bnx2x *bp)
@@ -550,8 +573,11 @@ static void bnx2x_stats_restart(struct bnx2x *bp)
550573
*/
551574
if (IS_VF(bp))
552575
return;
576+
if (down_timeout(&bp->stats_sema, HZ/10))
577+
BNX2X_ERR("Unable to acquire stats lock\n");
553578
bnx2x_stats_comp(bp);
554-
bnx2x_stats_start(bp);
579+
__bnx2x_stats_start(bp);
580+
up(&bp->stats_sema);
555581
}
556582

557583
static void bnx2x_bmac_stats_update(struct bnx2x *bp)
@@ -888,9 +914,7 @@ static int bnx2x_storm_stats_validate_counters(struct bnx2x *bp)
888914
/* Make sure we use the value of the counter
889915
* used for sending the last stats ramrod.
890916
*/
891-
spin_lock_bh(&bp->stats_lock);
892917
cur_stats_counter = bp->stats_counter - 1;
893-
spin_unlock_bh(&bp->stats_lock);
894918

895919
/* are storm stats valid? */
896920
if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) {
@@ -1227,12 +1251,18 @@ static void bnx2x_stats_update(struct bnx2x *bp)
12271251
{
12281252
u32 *stats_comp = bnx2x_sp(bp, stats_comp);
12291253

1230-
if (bnx2x_edebug_stats_stopped(bp))
1254+
/* we run update from timer context, so give up
1255+
* if somebody is in the middle of transition
1256+
*/
1257+
if (down_trylock(&bp->stats_sema))
12311258
return;
12321259

1260+
if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started)
1261+
goto out;
1262+
12331263
if (IS_PF(bp)) {
12341264
if (*stats_comp != DMAE_COMP_VAL)
1235-
return;
1265+
goto out;
12361266

12371267
if (bp->port.pmf)
12381268
bnx2x_hw_stats_update(bp);
@@ -1242,7 +1272,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
12421272
BNX2X_ERR("storm stats were not updated for 3 times\n");
12431273
bnx2x_panic();
12441274
}
1245-
return;
1275+
goto out;
12461276
}
12471277
} else {
12481278
/* vf doesn't collect HW statistics, and doesn't get completions
@@ -1256,7 +1286,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
12561286

12571287
/* vf is done */
12581288
if (IS_VF(bp))
1259-
return;
1289+
goto out;
12601290

12611291
if (netif_msg_timer(bp)) {
12621292
struct bnx2x_eth_stats *estats = &bp->eth_stats;
@@ -1267,6 +1297,9 @@ static void bnx2x_stats_update(struct bnx2x *bp)
12671297

12681298
bnx2x_hw_stats_post(bp);
12691299
bnx2x_storm_stats_post(bp);
1300+
1301+
out:
1302+
up(&bp->stats_sema);
12701303
}
12711304

12721305
static void bnx2x_port_stats_stop(struct bnx2x *bp)
@@ -1332,6 +1365,11 @@ static void bnx2x_stats_stop(struct bnx2x *bp)
13321365
{
13331366
int update = 0;
13341367

1368+
if (down_timeout(&bp->stats_sema, HZ/10))
1369+
BNX2X_ERR("Unable to acquire stats lock\n");
1370+
1371+
bp->stats_started = false;
1372+
13351373
bnx2x_stats_comp(bp);
13361374

13371375
if (bp->port.pmf)
@@ -1348,6 +1386,8 @@ static void bnx2x_stats_stop(struct bnx2x *bp)
13481386
bnx2x_hw_stats_post(bp);
13491387
bnx2x_stats_comp(bp);
13501388
}
1389+
1390+
up(&bp->stats_sema);
13511391
}
13521392

13531393
static void bnx2x_stats_do_nothing(struct bnx2x *bp)
@@ -1376,15 +1416,17 @@ static const struct {
13761416
void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
13771417
{
13781418
enum bnx2x_stats_state state;
1419+
void (*action)(struct bnx2x *bp);
13791420
if (unlikely(bp->panic))
13801421
return;
13811422

13821423
spin_lock_bh(&bp->stats_lock);
13831424
state = bp->stats_state;
13841425
bp->stats_state = bnx2x_stats_stm[state][event].next_state;
1426+
action = bnx2x_stats_stm[state][event].action;
13851427
spin_unlock_bh(&bp->stats_lock);
13861428

1387-
bnx2x_stats_stm[state][event].action(bp);
1429+
action(bp);
13881430

13891431
if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
13901432
DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",

0 commit comments

Comments
 (0)