Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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
...

+654 -380
+2 -2
MAINTAINERS
··· 5581 5581 F: drivers/media/tuners/mxl5007t.* 5582 5582 5583 5583 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) 5584 - M: Andrew Gallatin <gallatin@myri.com> 5584 + M: Hyong-Youb Kim <hykim@myri.com> 5585 5585 L: netdev@vger.kernel.org 5586 - W: http://www.myri.com/scs/download-Myri10GE.html 5586 + W: https://www.myricom.com/support/downloads/myri10ge.html 5587 5587 S: Supported 5588 5588 F: drivers/net/ethernet/myricom/myri10ge/ 5589 5589
+7 -1
drivers/net/bonding/bond_main.c
··· 3714 3714 * The bonding ndo_neigh_setup is called at init time beofre any 3715 3715 * slave exists. So we must declare proxy setup function which will 3716 3716 * 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. 3717 3721 */ 3718 3722 static int bond_neigh_setup(struct net_device *dev, 3719 3723 struct neigh_parms *parms) 3720 3724 { 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; 3722 3728 3723 3729 return 0; 3724 3730 }
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb.c
··· 649 649 if ((mc->ptr + rec_len) > mc->end) 650 650 goto decode_failed; 651 651 652 - memcpy(cf->data, mc->ptr, rec_len); 652 + memcpy(cf->data, mc->ptr, cf->can_dlc); 653 653 mc->ptr += rec_len; 654 654 } 655 655
+1 -1
drivers/net/ethernet/arc/emac_main.c
··· 199 199 struct arc_emac_priv *priv = netdev_priv(ndev); 200 200 unsigned int work_done; 201 201 202 - for (work_done = 0; work_done <= budget; work_done++) { 202 + for (work_done = 0; work_done < budget; work_done++) { 203 203 unsigned int *last_rx_bd = &priv->last_rx_bd; 204 204 struct net_device_stats *stats = &priv->stats; 205 205 struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
+5
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1502 1502 #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) 1503 1503 #define IS_VF_FLAG (1 << 22) 1504 1504 #define INTERRUPTS_ENABLED_FLAG (1 << 23) 1505 + #define BC_SUPPORTS_RMMOD_CMD (1 << 24) 1505 1506 1506 1507 #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) 1507 1508 ··· 1831 1830 1832 1831 int fp_array_size; 1833 1832 u32 dump_preset_idx; 1833 + bool stats_started; 1834 + struct semaphore stats_sema; 1834 1835 }; 1835 1836 1836 1837 /* Tx queues may be less or equal to Rx queues */ ··· 2454 2451 BNX2X_PCI_LINK_SPEED_5000 = 5000, 2455 2452 BNX2X_PCI_LINK_SPEED_8000 = 8000 2456 2453 }; 2454 + 2455 + void bnx2x_set_local_cmng(struct bnx2x *bp); 2457 2456 #endif /* bnx2x.h */
+4
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
··· 753 753 bnx2x_pfc_set_pfc(bp); 754 754 755 755 bnx2x_dcbx_update_ets_params(bp); 756 + 757 + /* ets may affect cmng configuration: reinit it in hw */ 758 + bnx2x_set_local_cmng(bp); 759 + 756 760 bnx2x_dcbx_resume_hw_tx(bp); 757 761 758 762 return;
+5
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
··· 1300 1300 1301 1301 #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 1302 1302 1303 + #define DRV_MSG_CODE_RMMOD 0xdb000000 1304 + #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f 1305 + 1303 1306 #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 1304 1307 #define REQ_BC_VER_4_SET_MF_BW 0x00060202 1305 1308 #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 ··· 1374 1371 #define FW_MSG_CODE_DRV_INFO_NACK 0xd9100000 1375 1372 1376 1373 #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 1374 + 1375 + #define FW_MSG_CODE_RMMOD_ACK 0xdb100000 1377 1376 1378 1377 #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 1379 1378 #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
+29 -14
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 2476 2476 2477 2477 input.port_rate = bp->link_vars.line_speed; 2478 2478 2479 - if (cmng_type == CMNG_FNS_MINMAX) { 2479 + if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) { 2480 2480 int vn; 2481 2481 2482 2482 /* read mf conf from shmem */ ··· 2533 2533 } 2534 2534 } 2535 2535 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 + 2536 2551 /* This function is called upon link interrupt */ 2537 2552 static void bnx2x_link_attn(struct bnx2x *bp) 2538 2553 { ··· 2583 2568 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); 2584 2569 } 2585 2570 2586 - if (bp->link_vars.link_up && bp->link_vars.line_speed) { 2587 - int cmng_fns = bnx2x_get_cmng_fns_mode(bp); 2588 - 2589 - if (cmng_fns != CMNG_FNS_NONE) { 2590 - bnx2x_cmng_fns_init(bp, false, cmng_fns); 2591 - storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); 2592 - } else 2593 - /* rate shaping and fairness are disabled */ 2594 - DP(NETIF_MSG_IFUP, 2595 - "single function mode without fairness\n"); 2596 - } 2571 + if (bp->link_vars.link_up && bp->link_vars.line_speed) 2572 + bnx2x_set_local_cmng(bp); 2597 2573 2598 2574 __bnx2x_link_report(bp); 2599 2575 ··· 10368 10362 10369 10363 bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? 10370 10364 BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; 10365 + 10366 + bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ? 10367 + BC_SUPPORTS_RMMOD_CMD : 0; 10368 + 10371 10369 boot_mode = SHMEM_RD(bp, 10372 10370 dev_info.port_feature_config[BP_PORT(bp)].mba_config) & 10373 10371 PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; ··· 11534 11524 mutex_init(&bp->port.phy_mutex); 11535 11525 mutex_init(&bp->fw_mb_mutex); 11536 11526 spin_lock_init(&bp->stats_lock); 11527 + sema_init(&bp->stats_sema, 1); 11537 11528 11538 11529 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); 11539 11530 INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); ··· 12828 12817 bnx2x_dcbnl_update_applist(bp, true); 12829 12818 #endif 12830 12819 12820 + if (IS_PF(bp) && 12821 + !BP_NOMCP(bp) && 12822 + (bp->flags & BC_SUPPORTS_RMMOD_CMD)) 12823 + bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0); 12824 + 12831 12825 /* Close the interface - either directly or implicitly */ 12832 12826 if (remove_netdev) { 12833 12827 unregister_netdev(dev); 12834 12828 } else { 12835 12829 rtnl_lock(); 12836 - if (netif_running(dev)) 12837 - bnx2x_close(dev); 12830 + dev_close(dev); 12838 12831 rtnl_unlock(); 12839 12832 } 12840 12833
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
··· 3463 3463 alloc_mem_err: 3464 3464 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, 3465 3465 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, 3467 3467 sizeof(union pf_vf_bulletin)); 3468 3468 return -ENOMEM; 3469 3469 }
+54 -12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
··· 221 221 * Statistics service functions 222 222 */ 223 223 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) 225 226 { 226 227 struct dmae_command *dmae; 227 228 u32 opcode; ··· 519 518 *stats_comp = 0; 520 519 } 521 520 522 - static void bnx2x_stats_start(struct bnx2x *bp) 521 + /* should be called under stats_sema */ 522 + static void __bnx2x_stats_start(struct bnx2x *bp) 523 523 { 524 524 /* vfs travel through here as part of the statistics FSM, but no action 525 525 * is required ··· 536 534 537 535 bnx2x_hw_stats_post(bp); 538 536 bnx2x_storm_stats_post(bp); 537 + 538 + bp->stats_started = true; 539 + } 540 + 541 + static void bnx2x_stats_start(struct bnx2x *bp) 542 + { 543 + if (down_timeout(&bp->stats_sema, HZ/10)) 544 + BNX2X_ERR("Unable to acquire stats lock\n"); 545 + __bnx2x_stats_start(bp); 546 + up(&bp->stats_sema); 539 547 } 540 548 541 549 static void bnx2x_stats_pmf_start(struct bnx2x *bp) 542 550 { 551 + if (down_timeout(&bp->stats_sema, HZ/10)) 552 + BNX2X_ERR("Unable to acquire stats lock\n"); 543 553 bnx2x_stats_comp(bp); 544 - bnx2x_stats_pmf_update(bp); 545 - bnx2x_stats_start(bp); 554 + __bnx2x_stats_pmf_update(bp); 555 + __bnx2x_stats_start(bp); 556 + up(&bp->stats_sema); 557 + } 558 + 559 + static void bnx2x_stats_pmf_update(struct bnx2x *bp) 560 + { 561 + if (down_timeout(&bp->stats_sema, HZ/10)) 562 + BNX2X_ERR("Unable to acquire stats lock\n"); 563 + __bnx2x_stats_pmf_update(bp); 564 + up(&bp->stats_sema); 546 565 } 547 566 548 567 static void bnx2x_stats_restart(struct bnx2x *bp) ··· 573 550 */ 574 551 if (IS_VF(bp)) 575 552 return; 553 + if (down_timeout(&bp->stats_sema, HZ/10)) 554 + BNX2X_ERR("Unable to acquire stats lock\n"); 576 555 bnx2x_stats_comp(bp); 577 - bnx2x_stats_start(bp); 556 + __bnx2x_stats_start(bp); 557 + up(&bp->stats_sema); 578 558 } 579 559 580 560 static void bnx2x_bmac_stats_update(struct bnx2x *bp) ··· 914 888 /* Make sure we use the value of the counter 915 889 * used for sending the last stats ramrod. 916 890 */ 917 - spin_lock_bh(&bp->stats_lock); 918 891 cur_stats_counter = bp->stats_counter - 1; 919 - spin_unlock_bh(&bp->stats_lock); 920 892 921 893 /* are storm stats valid? */ 922 894 if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { ··· 1251 1227 { 1252 1228 u32 *stats_comp = bnx2x_sp(bp, stats_comp); 1253 1229 1254 - if (bnx2x_edebug_stats_stopped(bp)) 1230 + /* we run update from timer context, so give up 1231 + * if somebody is in the middle of transition 1232 + */ 1233 + if (down_trylock(&bp->stats_sema)) 1255 1234 return; 1235 + 1236 + if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started) 1237 + goto out; 1256 1238 1257 1239 if (IS_PF(bp)) { 1258 1240 if (*stats_comp != DMAE_COMP_VAL) 1259 - return; 1241 + goto out; 1260 1242 1261 1243 if (bp->port.pmf) 1262 1244 bnx2x_hw_stats_update(bp); ··· 1272 1242 BNX2X_ERR("storm stats were not updated for 3 times\n"); 1273 1243 bnx2x_panic(); 1274 1244 } 1275 - return; 1245 + goto out; 1276 1246 } 1277 1247 } else { 1278 1248 /* vf doesn't collect HW statistics, and doesn't get completions ··· 1286 1256 1287 1257 /* vf is done */ 1288 1258 if (IS_VF(bp)) 1289 - return; 1259 + goto out; 1290 1260 1291 1261 if (netif_msg_timer(bp)) { 1292 1262 struct bnx2x_eth_stats *estats = &bp->eth_stats; ··· 1297 1267 1298 1268 bnx2x_hw_stats_post(bp); 1299 1269 bnx2x_storm_stats_post(bp); 1270 + 1271 + out: 1272 + up(&bp->stats_sema); 1300 1273 } 1301 1274 1302 1275 static void bnx2x_port_stats_stop(struct bnx2x *bp) ··· 1365 1332 { 1366 1333 int update = 0; 1367 1334 1335 + if (down_timeout(&bp->stats_sema, HZ/10)) 1336 + BNX2X_ERR("Unable to acquire stats lock\n"); 1337 + 1338 + bp->stats_started = false; 1339 + 1368 1340 bnx2x_stats_comp(bp); 1369 1341 1370 1342 if (bp->port.pmf) ··· 1386 1348 bnx2x_hw_stats_post(bp); 1387 1349 bnx2x_stats_comp(bp); 1388 1350 } 1351 + 1352 + up(&bp->stats_sema); 1389 1353 } 1390 1354 1391 1355 static void bnx2x_stats_do_nothing(struct bnx2x *bp) ··· 1416 1376 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) 1417 1377 { 1418 1378 enum bnx2x_stats_state state; 1379 + void (*action)(struct bnx2x *bp); 1419 1380 if (unlikely(bp->panic)) 1420 1381 return; 1421 1382 1422 1383 spin_lock_bh(&bp->stats_lock); 1423 1384 state = bp->stats_state; 1424 1385 bp->stats_state = bnx2x_stats_stm[state][event].next_state; 1386 + action = bnx2x_stats_stm[state][event].action; 1425 1387 spin_unlock_bh(&bp->stats_lock); 1426 1388 1427 - bnx2x_stats_stm[state][event].action(bp); 1389 + action(bp); 1428 1390 1429 1391 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) 1430 1392 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
+8 -5
drivers/net/ethernet/broadcom/tg3.c
··· 17796 17796 17797 17797 done: 17798 17798 if (state == pci_channel_io_perm_failure) { 17799 - tg3_napi_enable(tp); 17800 - dev_close(netdev); 17799 + if (netdev) { 17800 + tg3_napi_enable(tp); 17801 + dev_close(netdev); 17802 + } 17801 17803 err = PCI_ERS_RESULT_DISCONNECT; 17802 17804 } else { 17803 17805 pci_disable_device(pdev); ··· 17829 17827 rtnl_lock(); 17830 17828 17831 17829 if (pci_enable_device(pdev)) { 17832 - netdev_err(netdev, "Cannot re-enable PCI device after reset.\n"); 17830 + dev_err(&pdev->dev, 17831 + "Cannot re-enable PCI device after reset.\n"); 17833 17832 goto done; 17834 17833 } 17835 17834 ··· 17838 17835 pci_restore_state(pdev); 17839 17836 pci_save_state(pdev); 17840 17837 17841 - if (!netif_running(netdev)) { 17838 + if (!netdev || !netif_running(netdev)) { 17842 17839 rc = PCI_ERS_RESULT_RECOVERED; 17843 17840 goto done; 17844 17841 } ··· 17850 17847 rc = PCI_ERS_RESULT_RECOVERED; 17851 17848 17852 17849 done: 17853 - if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) { 17850 + if (rc != PCI_ERS_RESULT_RECOVERED && netdev && netif_running(netdev)) { 17854 17851 tg3_napi_enable(tp); 17855 17852 dev_close(netdev); 17856 17853 }
+24 -83
drivers/net/ethernet/chelsio/cxgb3/sge.c
··· 455 455 q->pg_chunk.offset = 0; 456 456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, 457 457 0, q->alloc_size, PCI_DMA_FROMDEVICE); 458 - if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) { 459 - __free_pages(q->pg_chunk.page, order); 460 - q->pg_chunk.page = NULL; 461 - return -EIO; 462 - } 463 458 q->pg_chunk.mapping = mapping; 464 459 } 465 460 sd->pg_chunk = q->pg_chunk; ··· 949 954 return flits_to_desc(flits); 950 955 } 951 956 952 - 953 - /* map_skb - map a packet main body and its page fragments 954 - * @pdev: the PCI device 955 - * @skb: the packet 956 - * @addr: placeholder to save the mapped addresses 957 - * 958 - * map the main body of an sk_buff and its page fragments, if any. 959 - */ 960 - static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb, 961 - dma_addr_t *addr) 962 - { 963 - const skb_frag_t *fp, *end; 964 - const struct skb_shared_info *si; 965 - 966 - *addr = pci_map_single(pdev, skb->data, skb_headlen(skb), 967 - PCI_DMA_TODEVICE); 968 - if (pci_dma_mapping_error(pdev, *addr)) 969 - goto out_err; 970 - 971 - si = skb_shinfo(skb); 972 - end = &si->frags[si->nr_frags]; 973 - 974 - for (fp = si->frags; fp < end; fp++) { 975 - *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp), 976 - DMA_TO_DEVICE); 977 - if (pci_dma_mapping_error(pdev, *addr)) 978 - goto unwind; 979 - } 980 - return 0; 981 - 982 - unwind: 983 - while (fp-- > si->frags) 984 - dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp), 985 - DMA_TO_DEVICE); 986 - 987 - pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE); 988 - out_err: 989 - return -ENOMEM; 990 - } 991 - 992 957 /** 993 - * write_sgl - populate a scatter/gather list for a packet 958 + * make_sgl - populate a scatter/gather list for a packet 994 959 * @skb: the packet 995 960 * @sgp: the SGL to populate 996 961 * @start: start address of skb main body data to include in the SGL 997 962 * @len: length of skb main body data to include in the SGL 998 - * @addr: the list of the mapped addresses 963 + * @pdev: the PCI device 999 964 * 1000 - * Copies the scatter/gather list for the buffers that make up a packet 965 + * Generates a scatter/gather list for the buffers that make up a packet 1001 966 * and returns the SGL size in 8-byte words. The caller must size the SGL 1002 967 * appropriately. 1003 968 */ 1004 - static inline unsigned int write_sgl(const struct sk_buff *skb, 969 + static inline unsigned int make_sgl(const struct sk_buff *skb, 1005 970 struct sg_ent *sgp, unsigned char *start, 1006 - unsigned int len, const dma_addr_t *addr) 971 + unsigned int len, struct pci_dev *pdev) 1007 972 { 1008 - unsigned int i, j = 0, k = 0, nfrags; 973 + dma_addr_t mapping; 974 + unsigned int i, j = 0, nfrags; 1009 975 1010 976 if (len) { 977 + mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE); 1011 978 sgp->len[0] = cpu_to_be32(len); 1012 - sgp->addr[j++] = cpu_to_be64(addr[k++]); 979 + sgp->addr[0] = cpu_to_be64(mapping); 980 + j = 1; 1013 981 } 1014 982 1015 983 nfrags = skb_shinfo(skb)->nr_frags; 1016 984 for (i = 0; i < nfrags; i++) { 1017 985 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 1018 986 987 + mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag), 988 + DMA_TO_DEVICE); 1019 989 sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); 1020 - sgp->addr[j] = cpu_to_be64(addr[k++]); 990 + sgp->addr[j] = cpu_to_be64(mapping); 1021 991 j ^= 1; 1022 992 if (j == 0) 1023 993 ++sgp; ··· 1138 1178 const struct port_info *pi, 1139 1179 unsigned int pidx, unsigned int gen, 1140 1180 struct sge_txq *q, unsigned int ndesc, 1141 - unsigned int compl, const dma_addr_t *addr) 1181 + unsigned int compl) 1142 1182 { 1143 1183 unsigned int flits, sgl_flits, cntrl, tso_info; 1144 1184 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; ··· 1196 1236 } 1197 1237 1198 1238 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1199 - sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr); 1239 + sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev); 1200 1240 1201 1241 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, 1202 1242 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), ··· 1227 1267 struct netdev_queue *txq; 1228 1268 struct sge_qset *qs; 1229 1269 struct sge_txq *q; 1230 - dma_addr_t addr[MAX_SKB_FRAGS + 1]; 1231 1270 1232 1271 /* 1233 1272 * The chip min packet length is 9 octets but play safe and reject ··· 1253 1294 "%s: Tx ring %u full while queue awake!\n", 1254 1295 dev->name, q->cntxt_id & 7); 1255 1296 return NETDEV_TX_BUSY; 1256 - } 1257 - 1258 - if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) { 1259 - dev_kfree_skb(skb); 1260 - return NETDEV_TX_OK; 1261 1297 } 1262 1298 1263 1299 q->in_use += ndesc; ··· 1312 1358 if (likely(!skb_shared(skb))) 1313 1359 skb_orphan(skb); 1314 1360 1315 - write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr); 1361 + write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); 1316 1362 check_ring_tx_db(adap, q); 1317 1363 return NETDEV_TX_OK; 1318 1364 } ··· 1577 1623 */ 1578 1624 static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, 1579 1625 struct sge_txq *q, unsigned int pidx, 1580 - unsigned int gen, unsigned int ndesc, 1581 - const dma_addr_t *addr) 1626 + unsigned int gen, unsigned int ndesc) 1582 1627 { 1583 1628 unsigned int sgl_flits, flits; 1584 1629 struct work_request_hdr *from; ··· 1598 1645 1599 1646 flits = skb_transport_offset(skb) / 8; 1600 1647 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1601 - sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb), 1602 - skb_tail_pointer(skb) - 1603 - skb_transport_header(skb), addr); 1648 + sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), 1649 + skb->tail - skb->transport_header, 1650 + adap->pdev); 1604 1651 if (need_skb_unmap()) { 1605 1652 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); 1606 1653 skb->destructor = deferred_unmap_destructor; ··· 1658 1705 goto again; 1659 1706 } 1660 1707 1661 - if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) { 1662 - spin_unlock(&q->lock); 1663 - return NET_XMIT_SUCCESS; 1664 - } 1665 - 1666 1708 gen = q->gen; 1667 1709 q->in_use += ndesc; 1668 1710 pidx = q->pidx; ··· 1668 1720 } 1669 1721 spin_unlock(&q->lock); 1670 1722 1671 - write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head); 1723 + write_ofld_wr(adap, skb, q, pidx, gen, ndesc); 1672 1724 check_ring_tx_db(adap, q); 1673 1725 return NET_XMIT_SUCCESS; 1674 1726 } ··· 1686 1738 struct sge_txq *q = &qs->txq[TXQ_OFLD]; 1687 1739 const struct port_info *pi = netdev_priv(qs->netdev); 1688 1740 struct adapter *adap = pi->adapter; 1689 - unsigned int written = 0; 1690 1741 1691 1742 spin_lock(&q->lock); 1692 1743 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); ··· 1705 1758 break; 1706 1759 } 1707 1760 1708 - if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) 1709 - break; 1710 - 1711 1761 gen = q->gen; 1712 1762 q->in_use += ndesc; 1713 1763 pidx = q->pidx; 1714 1764 q->pidx += ndesc; 1715 - written += ndesc; 1716 1765 if (q->pidx >= q->size) { 1717 1766 q->pidx -= q->size; 1718 1767 q->gen ^= 1; ··· 1716 1773 __skb_unlink(skb, &q->sendq); 1717 1774 spin_unlock(&q->lock); 1718 1775 1719 - write_ofld_wr(adap, skb, q, pidx, gen, ndesc, 1720 - (dma_addr_t *)skb->head); 1776 + write_ofld_wr(adap, skb, q, pidx, gen, ndesc); 1721 1777 spin_lock(&q->lock); 1722 1778 } 1723 1779 spin_unlock(&q->lock); ··· 1726 1784 set_bit(TXQ_LAST_PKT_DB, &q->flags); 1727 1785 #endif 1728 1786 wmb(); 1729 - if (likely(written)) 1730 - t3_write_reg(adap, A_SG_KDOORBELL, 1731 - F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); 1787 + t3_write_reg(adap, A_SG_KDOORBELL, 1788 + F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); 1732 1789 } 1733 1790 1734 1791 /**
+3
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 3048 3048 3049 3049 adapter->max_event_queues = le16_to_cpu(desc->eq_count); 3050 3050 adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); 3051 + 3052 + /* Clear flags that driver is not interested in */ 3053 + adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT; 3051 3054 } 3052 3055 err: 3053 3056 mutex_unlock(&adapter->mbox_lock);
+6
drivers/net/ethernet/emulex/benet/be_cmds.h
··· 563 563 BE_IF_FLAGS_MULTICAST = 0x1000 564 564 }; 565 565 566 + #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\ 567 + BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ 568 + BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\ 569 + BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\ 570 + BE_IF_FLAGS_UNTAGGED) 571 + 566 572 /* An RX interface is an object with one or more MAC addresses and 567 573 * filtering capabilities. */ 568 574 struct be_cmd_req_if_create {
+53 -15
drivers/net/ethernet/marvell/skge.c
··· 931 931 } 932 932 933 933 /* Allocate and setup a new buffer for receiving */ 934 - static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, 935 - struct sk_buff *skb, unsigned int bufsize) 934 + static int skge_rx_setup(struct skge_port *skge, struct skge_element *e, 935 + struct sk_buff *skb, unsigned int bufsize) 936 936 { 937 937 struct skge_rx_desc *rd = e->desc; 938 - u64 map; 938 + dma_addr_t map; 939 939 940 940 map = pci_map_single(skge->hw->pdev, skb->data, bufsize, 941 941 PCI_DMA_FROMDEVICE); 942 942 943 - rd->dma_lo = map; 944 - rd->dma_hi = map >> 32; 943 + if (pci_dma_mapping_error(skge->hw->pdev, map)) 944 + return -1; 945 + 946 + rd->dma_lo = lower_32_bits(map); 947 + rd->dma_hi = upper_32_bits(map); 945 948 e->skb = skb; 946 949 rd->csum1_start = ETH_HLEN; 947 950 rd->csum2_start = ETH_HLEN; ··· 956 953 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; 957 954 dma_unmap_addr_set(e, mapaddr, map); 958 955 dma_unmap_len_set(e, maplen, bufsize); 956 + return 0; 959 957 } 960 958 961 959 /* Resume receiving using existing skb, ··· 1018 1014 return -ENOMEM; 1019 1015 1020 1016 skb_reserve(skb, NET_IP_ALIGN); 1021 - skge_rx_setup(skge, e, skb, skge->rx_buf_size); 1017 + if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) { 1018 + dev_kfree_skb(skb); 1019 + return -EIO; 1020 + } 1022 1021 } while ((e = e->next) != ring->start); 1023 1022 1024 1023 ring->to_clean = ring->start; ··· 2551 2544 2552 2545 BUG_ON(skge->dma & 7); 2553 2546 2554 - if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) { 2547 + if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) { 2555 2548 dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); 2556 2549 err = -EINVAL; 2557 2550 goto free_pci_mem; ··· 2736 2729 struct skge_tx_desc *td; 2737 2730 int i; 2738 2731 u32 control, len; 2739 - u64 map; 2732 + dma_addr_t map; 2740 2733 2741 2734 if (skb_padto(skb, ETH_ZLEN)) 2742 2735 return NETDEV_TX_OK; ··· 2750 2743 e->skb = skb; 2751 2744 len = skb_headlen(skb); 2752 2745 map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 2746 + if (pci_dma_mapping_error(hw->pdev, map)) 2747 + goto mapping_error; 2748 + 2753 2749 dma_unmap_addr_set(e, mapaddr, map); 2754 2750 dma_unmap_len_set(e, maplen, len); 2755 2751 2756 - td->dma_lo = map; 2757 - td->dma_hi = map >> 32; 2752 + td->dma_lo = lower_32_bits(map); 2753 + td->dma_hi = upper_32_bits(map); 2758 2754 2759 2755 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2760 2756 const int offset = skb_checksum_start_offset(skb); ··· 2788 2778 2789 2779 map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, 2790 2780 skb_frag_size(frag), DMA_TO_DEVICE); 2781 + if (dma_mapping_error(&hw->pdev->dev, map)) 2782 + goto mapping_unwind; 2791 2783 2792 2784 e = e->next; 2793 2785 e->skb = skb; 2794 2786 tf = e->desc; 2795 2787 BUG_ON(tf->control & BMU_OWN); 2796 2788 2797 - tf->dma_lo = map; 2798 - tf->dma_hi = (u64) map >> 32; 2789 + tf->dma_lo = lower_32_bits(map); 2790 + tf->dma_hi = upper_32_bits(map); 2799 2791 dma_unmap_addr_set(e, mapaddr, map); 2800 2792 dma_unmap_len_set(e, maplen, skb_frag_size(frag)); 2801 2793 ··· 2826 2814 netif_stop_queue(dev); 2827 2815 } 2828 2816 2817 + return NETDEV_TX_OK; 2818 + 2819 + mapping_unwind: 2820 + e = skge->tx_ring.to_use; 2821 + pci_unmap_single(hw->pdev, 2822 + dma_unmap_addr(e, mapaddr), 2823 + dma_unmap_len(e, maplen), 2824 + PCI_DMA_TODEVICE); 2825 + while (i-- > 0) { 2826 + e = e->next; 2827 + pci_unmap_page(hw->pdev, 2828 + dma_unmap_addr(e, mapaddr), 2829 + dma_unmap_len(e, maplen), 2830 + PCI_DMA_TODEVICE); 2831 + } 2832 + 2833 + mapping_error: 2834 + if (net_ratelimit()) 2835 + dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); 2836 + dev_kfree_skb(skb); 2829 2837 return NETDEV_TX_OK; 2830 2838 } 2831 2839 ··· 3077 3045 3078 3046 pci_dma_sync_single_for_cpu(skge->hw->pdev, 3079 3047 dma_unmap_addr(e, mapaddr), 3080 - len, PCI_DMA_FROMDEVICE); 3048 + dma_unmap_len(e, maplen), 3049 + PCI_DMA_FROMDEVICE); 3081 3050 skb_copy_from_linear_data(e->skb, skb->data, len); 3082 3051 pci_dma_sync_single_for_device(skge->hw->pdev, 3083 3052 dma_unmap_addr(e, mapaddr), 3084 - len, PCI_DMA_FROMDEVICE); 3053 + dma_unmap_len(e, maplen), 3054 + PCI_DMA_FROMDEVICE); 3085 3055 skge_rx_reuse(e, skge->rx_buf_size); 3086 3056 } else { 3087 3057 struct sk_buff *nskb; ··· 3092 3058 if (!nskb) 3093 3059 goto resubmit; 3094 3060 3061 + if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { 3062 + dev_kfree_skb(nskb); 3063 + goto resubmit; 3064 + } 3065 + 3095 3066 pci_unmap_single(skge->hw->pdev, 3096 3067 dma_unmap_addr(e, mapaddr), 3097 3068 dma_unmap_len(e, maplen), 3098 3069 PCI_DMA_FROMDEVICE); 3099 3070 skb = e->skb; 3100 3071 prefetch(skb->data); 3101 - skge_rx_setup(skge, e, nskb, skge->rx_buf_size); 3102 3072 } 3103 3073 3104 3074 skb_put(skb, len);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 46 46 #include "mlx5_core.h" 47 47 48 48 enum { 49 - CMD_IF_REV = 4, 49 + CMD_IF_REV = 5, 50 50 }; 51 51 52 52 enum {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 268 268 case MLX5_EVENT_TYPE_PAGE_REQUEST: 269 269 { 270 270 u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); 271 - s16 npages = be16_to_cpu(eqe->data.req_pages.num_pages); 271 + s32 npages = be32_to_cpu(eqe->data.req_pages.num_pages); 272 272 273 273 mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); 274 274 mlx5_core_req_pages_handler(dev, func_id, npages);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/fw.c
··· 113 113 caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; 114 114 caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; 115 115 caps->log_max_mcg = out->hca_cap.log_max_mcg; 116 - caps->max_qp_mcg = be16_to_cpu(out->hca_cap.max_qp_mcg); 116 + caps->max_qp_mcg = be32_to_cpu(out->hca_cap.max_qp_mcg) & 0xffffff; 117 117 caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); 118 118 caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); 119 119 caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz;
+1 -28
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 55 55 }; 56 56 57 57 static DEFINE_SPINLOCK(health_lock); 58 - 59 58 static LIST_HEAD(health_list); 60 59 static struct work_struct health_work; 61 - 62 - static health_handler_t reg_handler; 63 - int mlx5_register_health_report_handler(health_handler_t handler) 64 - { 65 - spin_lock_irq(&health_lock); 66 - if (reg_handler) { 67 - spin_unlock_irq(&health_lock); 68 - return -EEXIST; 69 - } 70 - reg_handler = handler; 71 - spin_unlock_irq(&health_lock); 72 - 73 - return 0; 74 - } 75 - EXPORT_SYMBOL(mlx5_register_health_report_handler); 76 - 77 - void mlx5_unregister_health_report_handler(void) 78 - { 79 - spin_lock_irq(&health_lock); 80 - reg_handler = NULL; 81 - spin_unlock_irq(&health_lock); 82 - } 83 - EXPORT_SYMBOL(mlx5_unregister_health_report_handler); 84 60 85 61 static void health_care(struct work_struct *work) 86 62 { ··· 74 98 priv = container_of(health, struct mlx5_priv, health); 75 99 dev = container_of(priv, struct mlx5_core_dev, priv); 76 100 mlx5_core_warn(dev, "handling bad device here\n"); 101 + /* nothing yet */ 77 102 spin_lock_irq(&health_lock); 78 - if (reg_handler) 79 - reg_handler(dev->pdev, health->health, 80 - sizeof(health->health)); 81 - 82 103 list_del_init(&health->list); 83 104 spin_unlock_irq(&health_lock); 84 105 }
+26 -32
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
··· 43 43 MLX5_PAGES_TAKE = 2 44 44 }; 45 45 46 + enum { 47 + MLX5_BOOT_PAGES = 1, 48 + MLX5_INIT_PAGES = 2, 49 + MLX5_POST_INIT_PAGES = 3 50 + }; 51 + 46 52 struct mlx5_pages_req { 47 53 struct mlx5_core_dev *dev; 48 54 u32 func_id; 49 - s16 npages; 55 + s32 npages; 50 56 struct work_struct work; 51 57 }; 52 58 ··· 70 64 71 65 struct mlx5_query_pages_outbox { 72 66 struct mlx5_outbox_hdr hdr; 73 - __be16 num_boot_pages; 67 + __be16 rsvd; 74 68 __be16 func_id; 75 - __be16 init_pages; 76 - __be16 num_pages; 69 + __be32 num_pages; 77 70 }; 78 71 79 72 struct mlx5_manage_pages_inbox { 80 73 struct mlx5_inbox_hdr hdr; 81 - __be16 rsvd0; 74 + __be16 rsvd; 82 75 __be16 func_id; 83 - __be16 rsvd1; 84 - __be16 num_entries; 85 - u8 rsvd2[16]; 76 + __be32 num_entries; 86 77 __be64 pas[0]; 87 78 }; 88 79 89 80 struct mlx5_manage_pages_outbox { 90 81 struct mlx5_outbox_hdr hdr; 91 - u8 rsvd0[2]; 92 - __be16 num_entries; 93 - u8 rsvd1[20]; 82 + __be32 num_entries; 83 + u8 rsvd[4]; 94 84 __be64 pas[0]; 95 85 }; 96 86 ··· 148 146 } 149 147 150 148 static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, 151 - s16 *pages, s16 *init_pages, u16 *boot_pages) 149 + s32 *npages, int boot) 152 150 { 153 151 struct mlx5_query_pages_inbox in; 154 152 struct mlx5_query_pages_outbox out; ··· 157 155 memset(&in, 0, sizeof(in)); 158 156 memset(&out, 0, sizeof(out)); 159 157 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); 158 + in.hdr.opmod = boot ? cpu_to_be16(MLX5_BOOT_PAGES) : cpu_to_be16(MLX5_INIT_PAGES); 159 + 160 160 err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); 161 161 if (err) 162 162 return err; ··· 166 162 if (out.hdr.status) 167 163 return mlx5_cmd_status_to_err(&out.hdr); 168 164 169 - if (pages) 170 - *pages = be16_to_cpu(out.num_pages); 171 - 172 - if (init_pages) 173 - *init_pages = be16_to_cpu(out.init_pages); 174 - 175 - if (boot_pages) 176 - *boot_pages = be16_to_cpu(out.num_boot_pages); 177 - 165 + *npages = be32_to_cpu(out.num_pages); 178 166 *func_id = be16_to_cpu(out.func_id); 179 167 180 168 return err; ··· 220 224 in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); 221 225 in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); 222 226 in->func_id = cpu_to_be16(func_id); 223 - in->num_entries = cpu_to_be16(npages); 227 + in->num_entries = cpu_to_be32(npages); 224 228 err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); 225 229 mlx5_core_dbg(dev, "err %d\n", err); 226 230 if (err) { ··· 288 292 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); 289 293 in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); 290 294 in.func_id = cpu_to_be16(func_id); 291 - in.num_entries = cpu_to_be16(npages); 295 + in.num_entries = cpu_to_be32(npages); 292 296 mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); 293 297 err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); 294 298 if (err) { ··· 302 306 goto out_free; 303 307 } 304 308 305 - num_claimed = be16_to_cpu(out->num_entries); 309 + num_claimed = be32_to_cpu(out->num_entries); 306 310 if (nclaimed) 307 311 *nclaimed = num_claimed; 308 312 ··· 341 345 } 342 346 343 347 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 344 - s16 npages) 348 + s32 npages) 345 349 { 346 350 struct mlx5_pages_req *req; 347 351 ··· 360 364 361 365 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) 362 366 { 363 - u16 uninitialized_var(boot_pages); 364 - s16 uninitialized_var(init_pages); 365 367 u16 uninitialized_var(func_id); 368 + s32 uninitialized_var(npages); 366 369 int err; 367 370 368 - err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, 369 - &boot_pages); 371 + err = mlx5_cmd_query_pages(dev, &func_id, &npages, boot); 370 372 if (err) 371 373 return err; 372 374 375 + mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n", 376 + npages, boot ? "boot" : "init", func_id); 373 377 374 - mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", 375 - init_pages, boot_pages, func_id); 376 - return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); 378 + return give_pages(dev, func_id, npages, 0); 377 379 } 378 380 379 381 static int optimal_reclaimed_pages(void)
+5
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
··· 3266 3266 u8 val; 3267 3267 int ret, max_sds_rings = adapter->max_sds_rings; 3268 3268 3269 + if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { 3270 + netdev_info(netdev, "Device is resetting\n"); 3271 + return -EBUSY; 3272 + } 3273 + 3269 3274 if (qlcnic_get_diag_lock(adapter)) { 3270 3275 netdev_info(netdev, "Device in diagnostics mode\n"); 3271 3276 return -EBUSY;
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
··· 629 629 return -EIO; 630 630 } 631 631 632 - qlcnic_set_drv_version(adapter); 632 + if (adapter->portnum == 0) 633 + qlcnic_set_drv_version(adapter); 633 634 qlcnic_83xx_idc_attach_driver(adapter); 634 635 635 636 return 0;
+4 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 2165 2165 if (err) 2166 2166 goto err_out_disable_mbx_intr; 2167 2167 2168 - qlcnic_set_drv_version(adapter); 2168 + if (adapter->portnum == 0) 2169 + qlcnic_set_drv_version(adapter); 2169 2170 2170 2171 pci_set_drvdata(pdev, adapter); 2171 2172 ··· 3086 3085 adapter->fw_fail_cnt = 0; 3087 3086 adapter->flags &= ~QLCNIC_FW_HANG; 3088 3087 clear_bit(__QLCNIC_RESETTING, &adapter->state); 3089 - qlcnic_set_drv_version(adapter); 3088 + if (adapter->portnum == 0) 3089 + qlcnic_set_drv_version(adapter); 3090 3090 3091 3091 if (!qlcnic_clr_drv_state(adapter)) 3092 3092 qlcnic_schedule_work(adapter, qlcnic_fw_poll_work,
+3 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
··· 170 170 171 171 if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { 172 172 err = qlcnic_get_beacon_state(adapter, &h_beacon_state); 173 - if (!err) { 174 - dev_info(&adapter->pdev->dev, 175 - "Failed to get current beacon state\n"); 173 + if (err) { 174 + netdev_err(adapter->netdev, 175 + "Failed to get current beacon state\n"); 176 176 } else { 177 177 if (h_beacon_state == QLCNIC_BEACON_DISABLE) 178 178 ahw->beacon_state = 0;
+1
drivers/net/ethernet/realtek/8139cp.c
··· 524 524 PCI_DMA_FROMDEVICE); 525 525 if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { 526 526 dev->stats.rx_dropped++; 527 + kfree_skb(new_skb); 527 528 goto rx_next; 528 529 } 529 530
+11 -2
drivers/net/ethernet/stmicro/stmmac/ring_mode.c
··· 33 33 struct stmmac_priv *priv = (struct stmmac_priv *)p; 34 34 unsigned int txsize = priv->dma_tx_size; 35 35 unsigned int entry = priv->cur_tx % txsize; 36 - struct dma_desc *desc = priv->dma_tx + entry; 36 + struct dma_desc *desc; 37 37 unsigned int nopaged_len = skb_headlen(skb); 38 38 unsigned int bmax, len; 39 + 40 + if (priv->extend_desc) 41 + desc = (struct dma_desc *)(priv->dma_etx + entry); 42 + else 43 + desc = priv->dma_tx + entry; 39 44 40 45 if (priv->plat->enh_desc) 41 46 bmax = BUF_SIZE_8KiB; ··· 59 54 STMMAC_RING_MODE); 60 55 wmb(); 61 56 entry = (++priv->cur_tx) % txsize; 62 - desc = priv->dma_tx + entry; 57 + 58 + if (priv->extend_desc) 59 + desc = (struct dma_desc *)(priv->dma_etx + entry); 60 + else 61 + desc = priv->dma_tx + entry; 63 62 64 63 desc->des2 = dma_map_single(priv->device, skb->data + bmax, 65 64 len, DMA_TO_DEVICE);
+92 -19
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 939 939 940 940 skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, 941 941 GFP_KERNEL); 942 - if (unlikely(skb == NULL)) { 942 + if (!skb) { 943 943 pr_err("%s: Rx init fails; skb is NULL\n", __func__); 944 - return 1; 944 + return -ENOMEM; 945 945 } 946 946 skb_reserve(skb, NET_IP_ALIGN); 947 947 priv->rx_skbuff[i] = skb; 948 948 priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, 949 949 priv->dma_buf_sz, 950 950 DMA_FROM_DEVICE); 951 + if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) { 952 + pr_err("%s: DMA mapping error\n", __func__); 953 + dev_kfree_skb_any(skb); 954 + return -EINVAL; 955 + } 951 956 952 957 p->des2 = priv->rx_skbuff_dma[i]; 953 958 ··· 963 958 return 0; 964 959 } 965 960 961 + static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) 962 + { 963 + if (priv->rx_skbuff[i]) { 964 + dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], 965 + priv->dma_buf_sz, DMA_FROM_DEVICE); 966 + dev_kfree_skb_any(priv->rx_skbuff[i]); 967 + } 968 + priv->rx_skbuff[i] = NULL; 969 + } 970 + 966 971 /** 967 972 * init_dma_desc_rings - init the RX/TX descriptor rings 968 973 * @dev: net device structure ··· 980 965 * and allocates the socket buffers. It suppors the chained and ring 981 966 * modes. 982 967 */ 983 - static void init_dma_desc_rings(struct net_device *dev) 968 + static int init_dma_desc_rings(struct net_device *dev) 984 969 { 985 970 int i; 986 971 struct stmmac_priv *priv = netdev_priv(dev); 987 972 unsigned int txsize = priv->dma_tx_size; 988 973 unsigned int rxsize = priv->dma_rx_size; 989 974 unsigned int bfsize = 0; 975 + int ret = -ENOMEM; 990 976 991 977 /* Set the max buffer size according to the DESC mode 992 978 * and the MTU. Note that RING mode allows 16KiB bsize. ··· 1008 992 dma_extended_desc), 1009 993 &priv->dma_rx_phy, 1010 994 GFP_KERNEL); 995 + if (!priv->dma_erx) 996 + goto err_dma; 997 + 1011 998 priv->dma_etx = dma_alloc_coherent(priv->device, txsize * 1012 999 sizeof(struct 1013 1000 dma_extended_desc), 1014 1001 &priv->dma_tx_phy, 1015 1002 GFP_KERNEL); 1016 - if ((!priv->dma_erx) || (!priv->dma_etx)) 1017 - return; 1003 + if (!priv->dma_etx) { 1004 + dma_free_coherent(priv->device, priv->dma_rx_size * 1005 + sizeof(struct dma_extended_desc), 1006 + priv->dma_erx, priv->dma_rx_phy); 1007 + goto err_dma; 1008 + } 1018 1009 } else { 1019 1010 priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * 1020 1011 sizeof(struct dma_desc), 1021 1012 &priv->dma_rx_phy, 1022 1013 GFP_KERNEL); 1014 + if (!priv->dma_rx) 1015 + goto err_dma; 1016 + 1023 1017 priv->dma_tx = dma_alloc_coherent(priv->device, txsize * 1024 1018 sizeof(struct dma_desc), 1025 1019 &priv->dma_tx_phy, 1026 1020 GFP_KERNEL); 1027 - if ((!priv->dma_rx) || (!priv->dma_tx)) 1028 - return; 1021 + if (!priv->dma_tx) { 1022 + dma_free_coherent(priv->device, priv->dma_rx_size * 1023 + sizeof(struct dma_desc), 1024 + priv->dma_rx, priv->dma_rx_phy); 1025 + goto err_dma; 1026 + } 1029 1027 } 1030 1028 1031 1029 priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), 1032 1030 GFP_KERNEL); 1031 + if (!priv->rx_skbuff_dma) 1032 + goto err_rx_skbuff_dma; 1033 + 1033 1034 priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), 1034 1035 GFP_KERNEL); 1036 + if (!priv->rx_skbuff) 1037 + goto err_rx_skbuff; 1038 + 1035 1039 priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), 1036 1040 GFP_KERNEL); 1041 + if (!priv->tx_skbuff_dma) 1042 + goto err_tx_skbuff_dma; 1043 + 1037 1044 priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), 1038 1045 GFP_KERNEL); 1046 + if (!priv->tx_skbuff) 1047 + goto err_tx_skbuff; 1048 + 1039 1049 if (netif_msg_probe(priv)) { 1040 1050 pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, 1041 1051 (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); ··· 1076 1034 else 1077 1035 p = priv->dma_rx + i; 1078 1036 1079 - if (stmmac_init_rx_buffers(priv, p, i)) 1080 - break; 1037 + ret = stmmac_init_rx_buffers(priv, p, i); 1038 + if (ret) 1039 + goto err_init_rx_buffers; 1081 1040 1082 1041 if (netif_msg_probe(priv)) 1083 1042 pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], ··· 1124 1081 1125 1082 if (netif_msg_hw(priv)) 1126 1083 stmmac_display_rings(priv); 1084 + 1085 + return 0; 1086 + err_init_rx_buffers: 1087 + while (--i >= 0) 1088 + stmmac_free_rx_buffers(priv, i); 1089 + kfree(priv->tx_skbuff); 1090 + err_tx_skbuff: 1091 + kfree(priv->tx_skbuff_dma); 1092 + err_tx_skbuff_dma: 1093 + kfree(priv->rx_skbuff); 1094 + err_rx_skbuff: 1095 + kfree(priv->rx_skbuff_dma); 1096 + err_rx_skbuff_dma: 1097 + if (priv->extend_desc) { 1098 + dma_free_coherent(priv->device, priv->dma_tx_size * 1099 + sizeof(struct dma_extended_desc), 1100 + priv->dma_etx, priv->dma_tx_phy); 1101 + dma_free_coherent(priv->device, priv->dma_rx_size * 1102 + sizeof(struct dma_extended_desc), 1103 + priv->dma_erx, priv->dma_rx_phy); 1104 + } else { 1105 + dma_free_coherent(priv->device, 1106 + priv->dma_tx_size * sizeof(struct dma_desc), 1107 + priv->dma_tx, priv->dma_tx_phy); 1108 + dma_free_coherent(priv->device, 1109 + priv->dma_rx_size * sizeof(struct dma_desc), 1110 + priv->dma_rx, priv->dma_rx_phy); 1111 + } 1112 + err_dma: 1113 + return ret; 1127 1114 } 1128 1115 1129 1116 static void dma_free_rx_skbufs(struct stmmac_priv *priv) 1130 1117 { 1131 1118 int i; 1132 1119 1133 - for (i = 0; i < priv->dma_rx_size; i++) { 1134 - if (priv->rx_skbuff[i]) { 1135 - dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], 1136 - priv->dma_buf_sz, DMA_FROM_DEVICE); 1137 - dev_kfree_skb_any(priv->rx_skbuff[i]); 1138 - } 1139 - priv->rx_skbuff[i] = NULL; 1140 - } 1120 + for (i = 0; i < priv->dma_rx_size; i++) 1121 + stmmac_free_rx_buffers(priv, i); 1141 1122 } 1142 1123 1143 1124 static void dma_free_tx_skbufs(struct stmmac_priv *priv) ··· 1627 1560 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 1628 1561 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 1629 1562 priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); 1630 - init_dma_desc_rings(dev); 1563 + 1564 + ret = init_dma_desc_rings(dev); 1565 + if (ret < 0) { 1566 + pr_err("%s: DMA descriptors initialization failed\n", __func__); 1567 + goto dma_desc_error; 1568 + } 1631 1569 1632 1570 /* DMA initialization and SW reset */ 1633 1571 ret = stmmac_init_dma_engine(priv); 1634 1572 if (ret < 0) { 1635 - pr_err("%s: DMA initialization failed\n", __func__); 1573 + pr_err("%s: DMA engine initialization failed\n", __func__); 1636 1574 goto init_error; 1637 1575 } 1638 1576 ··· 1744 1672 1745 1673 init_error: 1746 1674 free_dma_desc_resources(priv); 1675 + dma_desc_error: 1747 1676 if (priv->phydev) 1748 1677 phy_disconnect(priv->phydev); 1749 1678 phy_error:
+3 -1
drivers/net/ethernet/via/via-velocity.c
··· 2100 2100 2101 2101 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); 2102 2102 } 2103 - netif_rx(skb); 2103 + netif_receive_skb(skb); 2104 2104 2105 2105 stats->rx_bytes += pkt_len; 2106 2106 stats->rx_packets++; ··· 2884 2884 return ret; 2885 2885 2886 2886 err_iounmap: 2887 + netif_napi_del(&vptr->napi); 2887 2888 iounmap(regs); 2888 2889 err_free_dev: 2889 2890 free_netdev(netdev); ··· 2905 2904 struct velocity_info *vptr = netdev_priv(netdev); 2906 2905 2907 2906 unregister_netdev(netdev); 2907 + netif_napi_del(&vptr->napi); 2908 2908 iounmap(vptr->mac_regs); 2909 2909 free_netdev(netdev); 2910 2910 velocity_nics--;
+4
drivers/net/macvlan.c
··· 739 739 return -EADDRNOTAVAIL; 740 740 } 741 741 742 + if (data && data[IFLA_MACVLAN_FLAGS] && 743 + nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC) 744 + return -EINVAL; 745 + 742 746 if (data && data[IFLA_MACVLAN_MODE]) { 743 747 switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { 744 748 case MACVLAN_MODE_PRIVATE:
+9 -3
drivers/net/macvtap.c
··· 818 818 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; 819 819 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; 820 820 } 821 - if (vlan) 821 + if (vlan) { 822 + local_bh_disable(); 822 823 macvlan_start_xmit(skb, vlan->dev); 823 - else 824 + local_bh_enable(); 825 + } else { 824 826 kfree_skb(skb); 827 + } 825 828 rcu_read_unlock(); 826 829 827 830 return total_len; ··· 915 912 done: 916 913 rcu_read_lock(); 917 914 vlan = rcu_dereference(q->vlan); 918 - if (vlan) 915 + if (vlan) { 916 + preempt_disable(); 919 917 macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); 918 + preempt_enable(); 919 + } 920 920 rcu_read_unlock(); 921 921 922 922 return ret ? ret : copied;
+4 -2
drivers/net/tun.c
··· 1074 1074 u32 rxhash; 1075 1075 1076 1076 if (!(tun->flags & TUN_NO_PI)) { 1077 - if ((len -= sizeof(pi)) > total_len) 1077 + if (len < sizeof(pi)) 1078 1078 return -EINVAL; 1079 + len -= sizeof(pi); 1079 1080 1080 1081 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) 1081 1082 return -EFAULT; ··· 1084 1083 } 1085 1084 1086 1085 if (tun->flags & TUN_VNET_HDR) { 1087 - if ((len -= tun->vnet_hdr_sz) > total_len) 1086 + if (len < tun->vnet_hdr_sz) 1088 1087 return -EINVAL; 1088 + len -= tun->vnet_hdr_sz; 1089 1089 1090 1090 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) 1091 1091 return -EFAULT;
+1 -3
drivers/net/vxlan.c
··· 1386 1386 return -ENOTCONN; 1387 1387 1388 1388 if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && 1389 - ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { 1389 + vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { 1390 1390 vxlan_sock_hold(vs); 1391 1391 dev_hold(dev); 1392 1392 queue_work(vxlan_wq, &vxlan->igmp_join); ··· 1792 1792 { 1793 1793 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 1794 1794 struct vxlan_dev *vxlan = netdev_priv(dev); 1795 - 1796 - flush_workqueue(vxlan_wq); 1797 1795 1798 1796 spin_lock(&vn->sock_lock); 1799 1797 hlist_del_rcu(&vxlan->hlist);
+2 -5
drivers/net/wireless/cw1200/sta.c
··· 1406 1406 if (!priv->join_status) 1407 1407 goto done; 1408 1408 1409 - if (priv->join_status > CW1200_JOIN_STATUS_IBSS) { 1410 - wiphy_err(priv->hw->wiphy, "Unexpected: join status: %d\n", 1411 - priv->join_status); 1412 - BUG_ON(1); 1413 - } 1409 + if (priv->join_status == CW1200_JOIN_STATUS_AP) 1410 + goto done; 1414 1411 1415 1412 cancel_work_sync(&priv->update_filtering_work); 1416 1413 cancel_work_sync(&priv->set_beacon_wakeup_period_work);
+8 -8
drivers/net/wireless/iwlegacy/4965-mac.c
··· 4460 4460 * is killed. Hence update the killswitch state here. The 4461 4461 * rfkill handler will care about restarting if needed. 4462 4462 */ 4463 - if (!test_bit(S_ALIVE, &il->status)) { 4464 - if (hw_rf_kill) 4465 - set_bit(S_RFKILL, &il->status); 4466 - else 4467 - clear_bit(S_RFKILL, &il->status); 4463 + if (hw_rf_kill) { 4464 + set_bit(S_RFKILL, &il->status); 4465 + } else { 4466 + clear_bit(S_RFKILL, &il->status); 4468 4467 wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); 4468 + il_force_reset(il, true); 4469 4469 } 4470 4470 4471 4471 handled |= CSR_INT_BIT_RF_KILL; ··· 5334 5334 5335 5335 il->active_rate = RATES_MASK; 5336 5336 5337 + il_power_update_mode(il, true); 5338 + D_INFO("Updated power mode\n"); 5339 + 5337 5340 if (il_is_associated(il)) { 5338 5341 struct il_rxon_cmd *active_rxon = 5339 5342 (struct il_rxon_cmd *)&il->active; ··· 5366 5363 5367 5364 D_INFO("ALIVE processing complete.\n"); 5368 5365 wake_up(&il->wait_command_queue); 5369 - 5370 - il_power_update_mode(il, true); 5371 - D_INFO("Updated power mode\n"); 5372 5366 5373 5367 return; 5374 5368
+1
drivers/net/wireless/iwlegacy/common.c
··· 4660 4660 4661 4661 return 0; 4662 4662 } 4663 + EXPORT_SYMBOL(il_force_reset); 4663 4664 4664 4665 int 4665 4666 il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+10 -12
include/linux/mlx5/device.h
··· 309 309 __be16 max_desc_sz_rq; 310 310 u8 rsvd21[2]; 311 311 __be16 max_desc_sz_sq_dc; 312 - u8 rsvd22[4]; 313 - __be16 max_qp_mcg; 314 - u8 rsvd23; 312 + __be32 max_qp_mcg; 313 + u8 rsvd22[3]; 315 314 u8 log_max_mcg; 316 - u8 rsvd24; 315 + u8 rsvd23; 317 316 u8 log_max_pd; 318 - u8 rsvd25; 317 + u8 rsvd24; 319 318 u8 log_max_xrcd; 320 - u8 rsvd26[42]; 319 + u8 rsvd25[42]; 321 320 __be16 log_uar_page_sz; 322 - u8 rsvd27[28]; 321 + u8 rsvd26[28]; 323 322 u8 log_msx_atomic_size_qp; 324 - u8 rsvd28[2]; 323 + u8 rsvd27[2]; 325 324 u8 log_msx_atomic_size_dc; 326 - u8 rsvd29[76]; 325 + u8 rsvd28[76]; 327 326 }; 328 327 329 328 ··· 471 472 struct mlx5_eqe_page_req { 472 473 u8 rsvd0[2]; 473 474 __be16 func_id; 474 - u8 rsvd1[2]; 475 - __be16 num_pages; 476 - __be32 rsvd2[5]; 475 + __be32 num_pages; 476 + __be32 rsvd1[5]; 477 477 }; 478 478 479 479 union ev_data {
+2 -5
include/linux/mlx5/driver.h
··· 358 358 u32 reserved_lkey; 359 359 u8 local_ca_ack_delay; 360 360 u8 log_max_mcg; 361 - u16 max_qp_mcg; 361 + u32 max_qp_mcg; 362 362 int min_page_sz; 363 363 }; 364 364 ··· 691 691 int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 692 692 void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); 693 693 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 694 - s16 npages); 694 + s32 npages); 695 695 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); 696 696 int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); 697 697 void mlx5_register_debugfs(void); ··· 731 731 int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); 732 732 void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); 733 733 734 - typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size); 735 - int mlx5_register_health_report_handler(health_handler_t handler); 736 - void mlx5_unregister_health_report_handler(void); 737 734 const char *mlx5_command_str(int command); 738 735 int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); 739 736 void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
+1 -6
include/net/busy_poll.h
··· 122 122 if (rc > 0) 123 123 /* local bh are disabled so it is ok to use _BH */ 124 124 NET_ADD_STATS_BH(sock_net(sk), 125 - LINUX_MIB_LOWLATENCYRXPACKETS, rc); 125 + LINUX_MIB_BUSYPOLLRXPACKETS, rc); 126 126 127 127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) && 128 128 !need_resched() && !busy_loop_timeout(end_time)); ··· 158 158 } 159 159 160 160 static inline bool sk_can_busy_loop(struct sock *sk) 161 - { 162 - return false; 163 - } 164 - 165 - static inline bool sk_busy_poll(struct sock *sk, int nonblock) 166 161 { 167 162 return false; 168 163 }
-14
include/net/ip_tunnels.h
··· 145 145 return INET_ECN_encapsulate(tos, inner); 146 146 } 147 147 148 - static inline void tunnel_ip_select_ident(struct sk_buff *skb, 149 - const struct iphdr *old_iph, 150 - struct dst_entry *dst) 151 - { 152 - struct iphdr *iph = ip_hdr(skb); 153 - 154 - /* Use inner packet iph-id if possible. */ 155 - if (skb->protocol == htons(ETH_P_IP) && old_iph->id) 156 - iph->id = old_iph->id; 157 - else 158 - __ip_select_ident(iph, dst, 159 - (skb_shinfo(skb)->gso_segs ?: 1) - 1); 160 - } 161 - 162 148 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 163 149 int iptunnel_xmit(struct net *net, struct rtable *rt, 164 150 struct sk_buff *skb,
+8 -1
include/net/sch_generic.h
··· 683 683 u64 rate_bytes_ps; /* bytes per second */ 684 684 u32 mult; 685 685 u16 overhead; 686 + u8 linklayer; 686 687 u8 shift; 687 688 }; 688 689 689 690 static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, 690 691 unsigned int len) 691 692 { 692 - return ((u64)(len + r->overhead) * r->mult) >> r->shift; 693 + len += r->overhead; 694 + 695 + if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) 696 + return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; 697 + 698 + return ((u64)len * r->mult) >> r->shift; 693 699 } 694 700 695 701 extern void psched_ratecfg_precompute(struct psched_ratecfg *r, const struct tc_ratespec *conf); ··· 706 700 memset(res, 0, sizeof(*res)); 707 701 res->rate = r->rate_bytes_ps; 708 702 res->overhead = r->overhead; 703 + res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); 709 704 } 710 705 711 706 #endif
+9 -1
include/uapi/linux/pkt_sched.h
··· 73 73 #define TC_H_ROOT (0xFFFFFFFFU) 74 74 #define TC_H_INGRESS (0xFFFFFFF1U) 75 75 76 + /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ 77 + enum tc_link_layer { 78 + TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ 79 + TC_LINKLAYER_ETHERNET, 80 + TC_LINKLAYER_ATM, 81 + }; 82 + #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ 83 + 76 84 struct tc_ratespec { 77 85 unsigned char cell_log; 78 - unsigned char __reserved; 86 + __u8 linklayer; /* lower 4 bits */ 79 87 unsigned short overhead; 80 88 short cell_align; 81 89 unsigned short mpu;
+1 -1
include/uapi/linux/snmp.h
··· 253 253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 254 254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 255 255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 256 - LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */ 256 + LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ 257 257 __LINUX_MIB_MAX 258 258 }; 259 259
+6 -1
net/8021q/vlan_core.c
··· 91 91 92 92 struct net_device *vlan_dev_real_dev(const struct net_device *dev) 93 93 { 94 - return vlan_dev_priv(dev)->real_dev; 94 + struct net_device *ret = vlan_dev_priv(dev)->real_dev; 95 + 96 + while (is_vlan_dev(ret)) 97 + ret = vlan_dev_priv(ret)->real_dev; 98 + 99 + return ret; 95 100 } 96 101 EXPORT_SYMBOL(vlan_dev_real_dev); 97 102
+2
net/batman-adv/bridge_loop_avoidance.c
··· 1529 1529 * in these cases, the skb is further handled by this function and 1530 1530 * returns 1, otherwise it returns 0 and the caller shall further 1531 1531 * process the skb. 1532 + * 1533 + * This call might reallocate skb data. 1532 1534 */ 1533 1535 int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, 1534 1536 unsigned short vid)
+12 -1
net/batman-adv/gateway_client.c
··· 508 508 return 0; 509 509 } 510 510 511 + /* this call might reallocate skb data */ 511 512 static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) 512 513 { 513 514 int ret = false; ··· 569 568 return ret; 570 569 } 571 570 571 + /* this call might reallocate skb data */ 572 572 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) 573 573 { 574 574 struct ethhdr *ethhdr; ··· 621 619 622 620 if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) 623 621 return false; 622 + 623 + /* skb->data might have been reallocated by pskb_may_pull() */ 624 + ethhdr = (struct ethhdr *)skb->data; 625 + if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) 626 + ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN); 627 + 624 628 udphdr = (struct udphdr *)(skb->data + *header_len); 625 629 *header_len += sizeof(*udphdr); 626 630 ··· 642 634 return true; 643 635 } 644 636 637 + /* this call might reallocate skb data */ 645 638 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, 646 - struct sk_buff *skb, struct ethhdr *ethhdr) 639 + struct sk_buff *skb) 647 640 { 648 641 struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; 649 642 struct batadv_orig_node *orig_dst_node = NULL; 650 643 struct batadv_gw_node *curr_gw = NULL; 644 + struct ethhdr *ethhdr; 651 645 bool ret, out_of_range = false; 652 646 unsigned int header_len = 0; 653 647 uint8_t curr_tq_avg; ··· 658 648 if (!ret) 659 649 goto out; 660 650 651 + ethhdr = (struct ethhdr *)skb->data; 661 652 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, 662 653 ethhdr->h_dest); 663 654 if (!orig_dst_node)
+1 -2
net/batman-adv/gateway_client.h
··· 34 34 void batadv_gw_node_purge(struct batadv_priv *bat_priv); 35 35 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); 36 36 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); 37 - bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, 38 - struct sk_buff *skb, struct ethhdr *ethhdr); 37 + bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb); 39 38 40 39 #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
+8 -1
net/batman-adv/soft-interface.c
··· 180 180 if (batadv_bla_tx(bat_priv, skb, vid)) 181 181 goto dropped; 182 182 183 + /* skb->data might have been reallocated by batadv_bla_tx() */ 184 + ethhdr = (struct ethhdr *)skb->data; 185 + 183 186 /* Register the client MAC in the transtable */ 184 187 if (!is_multicast_ether_addr(ethhdr->h_source)) 185 188 batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); ··· 223 220 default: 224 221 break; 225 222 } 223 + 224 + /* reminder: ethhdr might have become unusable from here on 225 + * (batadv_gw_is_dhcp_target() might have reallocated skb data) 226 + */ 226 227 } 227 228 228 229 /* ethernet packet should be broadcasted */ ··· 273 266 /* unicast packet */ 274 267 } else { 275 268 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) { 276 - ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr); 269 + ret = batadv_gw_out_of_range(bat_priv, skb); 277 270 if (ret) 278 271 goto dropped; 279 272 }
+10 -3
net/batman-adv/unicast.c
··· 326 326 * @skb: the skb containing the payload to encapsulate 327 327 * @orig_node: the destination node 328 328 * 329 - * Returns false if the payload could not be encapsulated or true otherwise 329 + * Returns false if the payload could not be encapsulated or true otherwise. 330 + * 331 + * This call might reallocate skb data. 330 332 */ 331 333 static bool batadv_unicast_prepare_skb(struct sk_buff *skb, 332 334 struct batadv_orig_node *orig_node) ··· 345 343 * @orig_node: the destination node 346 344 * @packet_subtype: the batman 4addr packet subtype to use 347 345 * 348 - * Returns false if the payload could not be encapsulated or true otherwise 346 + * Returns false if the payload could not be encapsulated or true otherwise. 347 + * 348 + * This call might reallocate skb data. 349 349 */ 350 350 bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv, 351 351 struct sk_buff *skb, ··· 405 401 struct batadv_neigh_node *neigh_node; 406 402 int data_len = skb->len; 407 403 int ret = NET_RX_DROP; 408 - unsigned int dev_mtu; 404 + unsigned int dev_mtu, header_len; 409 405 410 406 /* get routing information */ 411 407 if (is_multicast_ether_addr(ethhdr->h_dest)) { ··· 433 429 switch (packet_type) { 434 430 case BATADV_UNICAST: 435 431 batadv_unicast_prepare_skb(skb, orig_node); 432 + header_len = sizeof(struct batadv_unicast_packet); 436 433 break; 437 434 case BATADV_UNICAST_4ADDR: 438 435 batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, 439 436 packet_subtype); 437 + header_len = sizeof(struct batadv_unicast_4addr_packet); 440 438 break; 441 439 default: 442 440 /* this function supports UNICAST and UNICAST_4ADDR only. It ··· 447 441 goto out; 448 442 } 449 443 444 + ethhdr = (struct ethhdr *)(skb->data + header_len); 450 445 unicast_packet = (struct batadv_unicast_packet *)skb->data; 451 446 452 447 /* inform the destination node that we are still missing a correct route
+1 -1
net/bridge/br_multicast.c
··· 1195 1195 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay)); 1196 1196 if (max_delay) 1197 1197 group = &mld->mld_mca; 1198 - } else if (skb->len >= sizeof(*mld2q)) { 1198 + } else { 1199 1199 if (!pskb_may_pull(skb, sizeof(*mld2q))) { 1200 1200 err = -EINVAL; 1201 1201 goto out;
+1 -1
net/bridge/br_sysfs_br.c
··· 1 1 /* 2 - * Sysfs attributes of bridge ports 2 + * Sysfs attributes of bridge 3 3 * Linux ethernet bridge 4 4 * 5 5 * Authors:
+1
net/core/flow_dissector.c
··· 65 65 nhoff += sizeof(struct ipv6hdr); 66 66 break; 67 67 } 68 + case __constant_htons(ETH_P_8021AD): 68 69 case __constant_htons(ETH_P_8021Q): { 69 70 const struct vlan_hdr *vlan; 70 71 struct vlan_hdr _vlan;
+8 -6
net/core/neighbour.c
··· 1441 1441 atomic_set(&p->refcnt, 1); 1442 1442 p->reachable_time = 1443 1443 neigh_rand_reach_time(p->base_reachable_time); 1444 - 1445 - if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { 1446 - kfree(p); 1447 - return NULL; 1448 - } 1449 - 1450 1444 dev_hold(dev); 1451 1445 p->dev = dev; 1452 1446 write_pnet(&p->net, hold_net(net)); 1453 1447 p->sysctl_table = NULL; 1448 + 1449 + if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { 1450 + release_net(net); 1451 + dev_put(dev); 1452 + kfree(p); 1453 + return NULL; 1454 + } 1455 + 1454 1456 write_lock_bh(&tbl->lock); 1455 1457 p->next = tbl->parms.next; 1456 1458 tbl->parms.next = p;
+2 -2
net/core/rtnetlink.c
··· 2156 2156 /* If aging addresses are supported device will need to 2157 2157 * implement its own handler for this. 2158 2158 */ 2159 - if (ndm->ndm_state & NUD_PERMANENT) { 2159 + if (!(ndm->ndm_state & NUD_PERMANENT)) { 2160 2160 pr_info("%s: FDB only supports static addresses\n", dev->name); 2161 2161 return -EINVAL; 2162 2162 } ··· 2384 2384 struct nlattr *extfilt; 2385 2385 u32 filter_mask = 0; 2386 2386 2387 - extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg), 2387 + extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 2388 2388 IFLA_EXT_MASK); 2389 2389 if (extfilt) 2390 2390 filter_mask = nla_get_u32(extfilt);
+1 -1
net/ipv4/esp4.c
··· 477 477 } 478 478 479 479 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - 480 - net_adj) & ~(align - 1)) + (net_adj - 2); 480 + net_adj) & ~(align - 1)) + net_adj - 2; 481 481 } 482 482 483 483 static void esp4_err(struct sk_buff *skb, u32 info)
+1 -4
net/ipv4/fib_trie.c
··· 71 71 #include <linux/init.h> 72 72 #include <linux/list.h> 73 73 #include <linux/slab.h> 74 - #include <linux/prefetch.h> 75 74 #include <linux/export.h> 76 75 #include <net/net_namespace.h> 77 76 #include <net/ip.h> ··· 1760 1761 if (!c) 1761 1762 continue; 1762 1763 1763 - if (IS_LEAF(c)) { 1764 - prefetch(rcu_dereference_rtnl(p->child[idx])); 1764 + if (IS_LEAF(c)) 1765 1765 return (struct leaf *) c; 1766 - } 1767 1766 1768 1767 /* Rescan start scanning in new node */ 1769 1768 p = (struct tnode *) c;
+1 -1
net/ipv4/ip_gre.c
··· 383 383 if (daddr) 384 384 memcpy(&iph->daddr, daddr, 4); 385 385 if (iph->daddr) 386 - return t->hlen; 386 + return t->hlen + sizeof(*iph); 387 387 388 388 return -(t->hlen + sizeof(*iph)); 389 389 }
+1 -3
net/ipv4/ip_tunnel_core.c
··· 76 76 iph->daddr = dst; 77 77 iph->saddr = src; 78 78 iph->ttl = ttl; 79 - tunnel_ip_select_ident(skb, 80 - (const struct iphdr *)skb_inner_network_header(skb), 81 - &rt->dst); 79 + __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); 82 80 83 81 err = ip_local_out(skb); 84 82 if (unlikely(net_xmit_eval(err)))
+1 -1
net/ipv4/proc.c
··· 273 273 SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW), 274 274 SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD), 275 275 SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), 276 - SNMP_MIB_ITEM("LowLatencyRxPackets", LINUX_MIB_LOWLATENCYRXPACKETS), 276 + SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), 277 277 SNMP_MIB_SENTINEL 278 278 }; 279 279
+7 -5
net/ipv4/tcp_cubic.c
··· 206 206 */ 207 207 static inline void bictcp_update(struct bictcp *ca, u32 cwnd) 208 208 { 209 - u64 offs; 210 - u32 delta, t, bic_target, max_cnt; 209 + u32 delta, bic_target, max_cnt; 210 + u64 offs, t; 211 211 212 212 ca->ack_cnt++; /* count the number of ACKs */ 213 213 ··· 250 250 * if the cwnd < 1 million packets !!! 251 251 */ 252 252 253 + t = (s32)(tcp_time_stamp - ca->epoch_start); 254 + t += msecs_to_jiffies(ca->delay_min >> 3); 253 255 /* change the unit from HZ to bictcp_HZ */ 254 - t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3) 255 - - ca->epoch_start) << BICTCP_HZ) / HZ; 256 + t <<= BICTCP_HZ; 257 + do_div(t, HZ); 256 258 257 259 if (t < ca->bic_K) /* t - K */ 258 260 offs = ca->bic_K - t; ··· 416 414 return; 417 415 418 416 /* Discard delay samples right after fast recovery */ 419 - if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ) 417 + if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) < HZ) 420 418 return; 421 419 422 420 delay = (rtt_us << 3) / USEC_PER_MSEC;
+1 -1
net/ipv6/esp6.c
··· 425 425 net_adj = 0; 426 426 427 427 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - 428 - net_adj) & ~(align - 1)) + (net_adj - 2); 428 + net_adj) & ~(align - 1)) + net_adj - 2; 429 429 } 430 430 431 431 static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+12 -4
net/ipv6/ip6_fib.c
··· 993 993 994 994 if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) { 995 995 #ifdef CONFIG_IPV6_SUBTREES 996 - if (fn->subtree) 997 - fn = fib6_lookup_1(fn->subtree, args + 1); 996 + if (fn->subtree) { 997 + struct fib6_node *sfn; 998 + sfn = fib6_lookup_1(fn->subtree, 999 + args + 1); 1000 + if (!sfn) 1001 + goto backtrack; 1002 + fn = sfn; 1003 + } 998 1004 #endif 999 - if (!fn || fn->fn_flags & RTN_RTINFO) 1005 + if (fn->fn_flags & RTN_RTINFO) 1000 1006 return fn; 1001 1007 } 1002 1008 } 1003 - 1009 + #ifdef CONFIG_IPV6_SUBTREES 1010 + backtrack: 1011 + #endif 1004 1012 if (fn->fn_flags & RTN_ROOT) 1005 1013 break; 1006 1014
+36 -18
net/mac80211/mlme.c
··· 31 31 #include "led.h" 32 32 33 33 #define IEEE80211_AUTH_TIMEOUT (HZ / 5) 34 + #define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2) 34 35 #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) 35 36 #define IEEE80211_AUTH_MAX_TRIES 3 36 37 #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) 37 38 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) 39 + #define IEEE80211_ASSOC_TIMEOUT_LONG (HZ / 2) 38 40 #define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10) 39 41 #define IEEE80211_ASSOC_MAX_TRIES 3 40 42 ··· 211 209 struct ieee80211_channel *channel, 212 210 const struct ieee80211_ht_operation *ht_oper, 213 211 const struct ieee80211_vht_operation *vht_oper, 214 - struct cfg80211_chan_def *chandef, bool verbose) 212 + struct cfg80211_chan_def *chandef, bool tracking) 215 213 { 214 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 216 215 struct cfg80211_chan_def vht_chandef; 217 216 u32 ht_cfreq, ret; 218 217 ··· 232 229 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, 233 230 channel->band); 234 231 /* check that channel matches the right operating channel */ 235 - if (channel->center_freq != ht_cfreq) { 232 + if (!tracking && channel->center_freq != ht_cfreq) { 236 233 /* 237 234 * It's possible that some APs are confused here; 238 235 * Netgear WNDR3700 sometimes reports 4 higher than ··· 240 237 * since we look at probe response/beacon data here 241 238 * it should be OK. 242 239 */ 243 - if (verbose) 244 - sdata_info(sdata, 245 - "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", 246 - channel->center_freq, ht_cfreq, 247 - ht_oper->primary_chan, channel->band); 240 + sdata_info(sdata, 241 + "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", 242 + channel->center_freq, ht_cfreq, 243 + ht_oper->primary_chan, channel->band); 248 244 ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; 249 245 goto out; 250 246 } ··· 297 295 channel->band); 298 296 break; 299 297 default: 300 - if (verbose) 298 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) 301 299 sdata_info(sdata, 302 300 "AP VHT operation IE has invalid channel width (%d), disable VHT\n", 303 301 vht_oper->chan_width); ··· 306 304 } 307 305 308 306 if (!cfg80211_chandef_valid(&vht_chandef)) { 309 - if (verbose) 307 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) 310 308 sdata_info(sdata, 311 309 "AP VHT information is invalid, disable VHT\n"); 312 310 ret = IEEE80211_STA_DISABLE_VHT; ··· 319 317 } 320 318 321 319 if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) { 322 - if (verbose) 320 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) 323 321 sdata_info(sdata, 324 322 "AP VHT information doesn't match HT, disable VHT\n"); 325 323 ret = IEEE80211_STA_DISABLE_VHT; ··· 335 333 if (ret & IEEE80211_STA_DISABLE_VHT) 336 334 vht_chandef = *chandef; 337 335 336 + /* 337 + * Ignore the DISABLED flag when we're already connected and only 338 + * tracking the APs beacon for bandwidth changes - otherwise we 339 + * might get disconnected here if we connect to an AP, update our 340 + * regulatory information based on the AP's country IE and the 341 + * information we have is wrong/outdated and disables the channel 342 + * that we're actually using for the connection to the AP. 343 + */ 338 344 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, 339 - IEEE80211_CHAN_DISABLED)) { 345 + tracking ? 0 : 346 + IEEE80211_CHAN_DISABLED)) { 340 347 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { 341 348 ret = IEEE80211_STA_DISABLE_HT | 342 349 IEEE80211_STA_DISABLE_VHT; 343 - goto out; 350 + break; 344 351 } 345 352 346 353 ret |= chandef_downgrade(chandef); 347 354 } 348 355 349 - if (chandef->width != vht_chandef.width && verbose) 356 + if (chandef->width != vht_chandef.width && !tracking) 350 357 sdata_info(sdata, 351 358 "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n"); 352 359 ··· 395 384 396 385 /* calculate new channel (type) based on HT/VHT operation IEs */ 397 386 flags = ieee80211_determine_chantype(sdata, sband, chan, ht_oper, 398 - vht_oper, &chandef, false); 387 + vht_oper, &chandef, true); 399 388 400 389 /* 401 390 * Downgrade the new channel if we associated with restricted ··· 3405 3394 3406 3395 if (tx_flags == 0) { 3407 3396 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 3408 - ifmgd->auth_data->timeout_started = true; 3397 + auth_data->timeout_started = true; 3409 3398 run_again(sdata, auth_data->timeout); 3410 3399 } else { 3411 - auth_data->timeout_started = false; 3400 + auth_data->timeout = 3401 + round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG); 3402 + auth_data->timeout_started = true; 3403 + run_again(sdata, auth_data->timeout); 3412 3404 } 3413 3405 3414 3406 return 0; ··· 3448 3434 assoc_data->timeout_started = true; 3449 3435 run_again(sdata, assoc_data->timeout); 3450 3436 } else { 3451 - assoc_data->timeout_started = false; 3437 + assoc_data->timeout = 3438 + round_jiffies_up(jiffies + 3439 + IEEE80211_ASSOC_TIMEOUT_LONG); 3440 + assoc_data->timeout_started = true; 3441 + run_again(sdata, assoc_data->timeout); 3452 3442 } 3453 3443 3454 3444 return 0; ··· 3847 3829 ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, 3848 3830 cbss->channel, 3849 3831 ht_oper, vht_oper, 3850 - &chandef, true); 3832 + &chandef, false); 3851 3833 3852 3834 sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), 3853 3835 local->rx_chains);
+8 -4
net/netfilter/nf_conntrack_proto_tcp.c
··· 526 526 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; 527 527 __u32 seq, ack, sack, end, win, swin; 528 528 s16 receiver_offset; 529 - bool res; 529 + bool res, in_recv_win; 530 530 531 531 /* 532 532 * Get the required data from the packet. ··· 649 649 receiver->td_end, receiver->td_maxend, receiver->td_maxwin, 650 650 receiver->td_scale); 651 651 652 + /* Is the ending sequence in the receive window (if available)? */ 653 + in_recv_win = !receiver->td_maxwin || 654 + after(end, sender->td_end - receiver->td_maxwin - 1); 655 + 652 656 pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n", 653 657 before(seq, sender->td_maxend + 1), 654 - after(end, sender->td_end - receiver->td_maxwin - 1), 658 + (in_recv_win ? 1 : 0), 655 659 before(sack, receiver->td_end + 1), 656 660 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)); 657 661 658 662 if (before(seq, sender->td_maxend + 1) && 659 - after(end, sender->td_end - receiver->td_maxwin - 1) && 663 + in_recv_win && 660 664 before(sack, receiver->td_end + 1) && 661 665 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) { 662 666 /* ··· 729 725 nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, 730 726 "nf_ct_tcp: %s ", 731 727 before(seq, sender->td_maxend + 1) ? 732 - after(end, sender->td_end - receiver->td_maxwin - 1) ? 728 + in_recv_win ? 733 729 before(sack, receiver->td_end + 1) ? 734 730 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG" 735 731 : "ACK is under the lower bound (possible overly delayed ACK)"
+17 -13
net/netfilter/xt_TCPMSS.c
··· 52 52 { 53 53 const struct xt_tcpmss_info *info = par->targinfo; 54 54 struct tcphdr *tcph; 55 - unsigned int tcplen, i; 55 + int len, tcp_hdrlen; 56 + unsigned int i; 56 57 __be16 oldval; 57 58 u16 newmss; 58 59 u8 *opt; ··· 65 64 if (!skb_make_writable(skb, skb->len)) 66 65 return -1; 67 66 68 - tcplen = skb->len - tcphoff; 69 - tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 67 + len = skb->len - tcphoff; 68 + if (len < (int)sizeof(struct tcphdr)) 69 + return -1; 70 70 71 - /* Header cannot be larger than the packet */ 72 - if (tcplen < tcph->doff*4) 71 + tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 72 + tcp_hdrlen = tcph->doff * 4; 73 + 74 + if (len < tcp_hdrlen) 73 75 return -1; 74 76 75 77 if (info->mss == XT_TCPMSS_CLAMP_PMTU) { ··· 91 87 newmss = info->mss; 92 88 93 89 opt = (u_int8_t *)tcph; 94 - for (i = sizeof(struct tcphdr); i < tcph->doff*4; i += optlen(opt, i)) { 95 - if (opt[i] == TCPOPT_MSS && tcph->doff*4 - i >= TCPOLEN_MSS && 96 - opt[i+1] == TCPOLEN_MSS) { 90 + for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) { 91 + if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) { 97 92 u_int16_t oldmss; 98 93 99 94 oldmss = (opt[i+2] << 8) | opt[i+3]; ··· 115 112 } 116 113 117 114 /* There is data after the header so the option can't be added 118 - without moving it, and doing so may make the SYN packet 119 - itself too large. Accept the packet unmodified instead. */ 120 - if (tcplen > tcph->doff*4) 115 + * without moving it, and doing so may make the SYN packet 116 + * itself too large. Accept the packet unmodified instead. 117 + */ 118 + if (len > tcp_hdrlen) 121 119 return 0; 122 120 123 121 /* ··· 147 143 newmss = min(newmss, (u16)1220); 148 144 149 145 opt = (u_int8_t *)tcph + sizeof(struct tcphdr); 150 - memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); 146 + memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr)); 151 147 152 148 inet_proto_csum_replace2(&tcph->check, skb, 153 - htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1); 149 + htons(len), htons(len + TCPOLEN_MSS), 1); 154 150 opt[0] = TCPOPT_MSS; 155 151 opt[1] = TCPOLEN_MSS; 156 152 opt[2] = (newmss & 0xff00) >> 8;
+6 -4
net/netfilter/xt_TCPOPTSTRIP.c
··· 38 38 struct tcphdr *tcph; 39 39 u_int16_t n, o; 40 40 u_int8_t *opt; 41 - int len; 41 + int len, tcp_hdrlen; 42 42 43 43 /* This is a fragment, no TCP header is available */ 44 44 if (par->fragoff != 0) ··· 52 52 return NF_DROP; 53 53 54 54 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 55 - if (tcph->doff * 4 > len) 55 + tcp_hdrlen = tcph->doff * 4; 56 + 57 + if (len < tcp_hdrlen) 56 58 return NF_DROP; 57 59 58 60 opt = (u_int8_t *)tcph; ··· 63 61 * Walk through all TCP options - if we find some option to remove, 64 62 * set all octets to %TCPOPT_NOP and adjust checksum. 65 63 */ 66 - for (i = sizeof(struct tcphdr); i < tcp_hdrlen(skb); i += optl) { 64 + for (i = sizeof(struct tcphdr); i < tcp_hdrlen - 1; i += optl) { 67 65 optl = optlen(opt, i); 68 66 69 - if (i + optl > tcp_hdrlen(skb)) 67 + if (i + optl > tcp_hdrlen) 70 68 break; 71 69 72 70 if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i]))
+7
net/netlink/genetlink.c
··· 789 789 struct net *net = sock_net(skb->sk); 790 790 int chains_to_skip = cb->args[0]; 791 791 int fams_to_skip = cb->args[1]; 792 + bool need_locking = chains_to_skip || fams_to_skip; 793 + 794 + if (need_locking) 795 + genl_lock(); 792 796 793 797 for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) { 794 798 n = 0; ··· 813 809 errout: 814 810 cb->args[0] = i; 815 811 cb->args[1] = n; 812 + 813 + if (need_locking) 814 + genl_unlock(); 816 815 817 816 return skb->len; 818 817 }
+1
net/openvswitch/actions.c
··· 535 535 { 536 536 struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); 537 537 538 + OVS_CB(skb)->tun_key = NULL; 538 539 return do_execute_actions(dp, skb, acts->actions, 539 540 acts->actions_len, false); 540 541 }
-3
net/openvswitch/datapath.c
··· 2076 2076 ovs_notify(reply, info, &ovs_dp_vport_multicast_group); 2077 2077 return 0; 2078 2078 2079 - rtnl_unlock(); 2080 - return 0; 2081 - 2082 2079 exit_free: 2083 2080 kfree_skb(reply); 2084 2081 exit_unlock:
+1 -1
net/openvswitch/flow.c
··· 240 240 struct flex_array *buckets; 241 241 int i, err; 242 242 243 - buckets = flex_array_alloc(sizeof(struct hlist_head *), 243 + buckets = flex_array_alloc(sizeof(struct hlist_head), 244 244 n_buckets, GFP_KERNEL); 245 245 if (!buckets) 246 246 return NULL;
+41
net/sched/sch_api.c
··· 285 285 return q; 286 286 } 287 287 288 + /* The linklayer setting were not transferred from iproute2, in older 289 + * versions, and the rate tables lookup systems have been dropped in 290 + * the kernel. To keep backward compatible with older iproute2 tc 291 + * utils, we detect the linklayer setting by detecting if the rate 292 + * table were modified. 293 + * 294 + * For linklayer ATM table entries, the rate table will be aligned to 295 + * 48 bytes, thus some table entries will contain the same value. The 296 + * mpu (min packet unit) is also encoded into the old rate table, thus 297 + * starting from the mpu, we find low and high table entries for 298 + * mapping this cell. If these entries contain the same value, when 299 + * the rate tables have been modified for linklayer ATM. 300 + * 301 + * This is done by rounding mpu to the nearest 48 bytes cell/entry, 302 + * and then roundup to the next cell, calc the table entry one below, 303 + * and compare. 304 + */ 305 + static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab) 306 + { 307 + int low = roundup(r->mpu, 48); 308 + int high = roundup(low+1, 48); 309 + int cell_low = low >> r->cell_log; 310 + int cell_high = (high >> r->cell_log) - 1; 311 + 312 + /* rtab is too inaccurate at rates > 100Mbit/s */ 313 + if ((r->rate > (100000000/8)) || (rtab[0] == 0)) { 314 + pr_debug("TC linklayer: Giving up ATM detection\n"); 315 + return TC_LINKLAYER_ETHERNET; 316 + } 317 + 318 + if ((cell_high > cell_low) && (cell_high < 256) 319 + && (rtab[cell_low] == rtab[cell_high])) { 320 + pr_debug("TC linklayer: Detected ATM, low(%d)=high(%d)=%u\n", 321 + cell_low, cell_high, rtab[cell_high]); 322 + return TC_LINKLAYER_ATM; 323 + } 324 + return TC_LINKLAYER_ETHERNET; 325 + } 326 + 288 327 static struct qdisc_rate_table *qdisc_rtab_list; 289 328 290 329 struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab) ··· 347 308 rtab->rate = *r; 348 309 rtab->refcnt = 1; 349 310 memcpy(rtab->data, nla_data(tab), 1024); 311 + if (r->linklayer == TC_LINKLAYER_UNAWARE) 312 + r->linklayer = __detect_linklayer(r, rtab->data); 350 313 rtab->next = qdisc_rtab_list; 351 314 qdisc_rtab_list = rtab; 352 315 }
+7 -1
net/sched/sch_generic.c
··· 25 25 #include <linux/rcupdate.h> 26 26 #include <linux/list.h> 27 27 #include <linux/slab.h> 28 + #include <linux/if_vlan.h> 28 29 #include <net/sch_generic.h> 29 30 #include <net/pkt_sched.h> 30 31 #include <net/dst.h> ··· 208 207 209 208 unsigned long dev_trans_start(struct net_device *dev) 210 209 { 211 - unsigned long val, res = dev->trans_start; 210 + unsigned long val, res; 212 211 unsigned int i; 213 212 213 + if (is_vlan_dev(dev)) 214 + dev = vlan_dev_real_dev(dev); 215 + res = dev->trans_start; 214 216 for (i = 0; i < dev->num_tx_queues; i++) { 215 217 val = netdev_get_tx_queue(dev, i)->trans_start; 216 218 if (val && time_after(val, res)) 217 219 res = val; 218 220 } 219 221 dev->trans_start = res; 222 + 220 223 return res; 221 224 } 222 225 EXPORT_SYMBOL(dev_trans_start); ··· 909 904 memset(r, 0, sizeof(*r)); 910 905 r->overhead = conf->overhead; 911 906 r->rate_bytes_ps = conf->rate; 907 + r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); 912 908 r->mult = 1; 913 909 /* 914 910 * The deal here is to replace a divide by a reciprocal one
+13
net/sched/sch_htb.c
··· 1329 1329 struct htb_sched *q = qdisc_priv(sch); 1330 1330 struct htb_class *cl = (struct htb_class *)*arg, *parent; 1331 1331 struct nlattr *opt = tca[TCA_OPTIONS]; 1332 + struct qdisc_rate_table *rtab = NULL, *ctab = NULL; 1332 1333 struct nlattr *tb[TCA_HTB_MAX + 1]; 1333 1334 struct tc_htb_opt *hopt; 1334 1335 ··· 1350 1349 hopt = nla_data(tb[TCA_HTB_PARMS]); 1351 1350 if (!hopt->rate.rate || !hopt->ceil.rate) 1352 1351 goto failure; 1352 + 1353 + /* Keeping backward compatible with rate_table based iproute2 tc */ 1354 + if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) { 1355 + rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]); 1356 + if (rtab) 1357 + qdisc_put_rtab(rtab); 1358 + } 1359 + if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE) { 1360 + ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]); 1361 + if (ctab) 1362 + qdisc_put_rtab(ctab); 1363 + } 1353 1364 1354 1365 if (!cl) { /* new class */ 1355 1366 struct Qdisc *new_q;
+2 -2
net/sctp/associola.c
··· 846 846 else 847 847 spc_state = SCTP_ADDR_AVAILABLE; 848 848 /* Don't inform ULP about transition from PF to 849 - * active state and set cwnd to 1, see SCTP 849 + * active state and set cwnd to 1 MTU, see SCTP 850 850 * Quick failover draft section 5.1, point 5 851 851 */ 852 852 if (transport->state == SCTP_PF) { 853 853 ulp_notify = false; 854 - transport->cwnd = 1; 854 + transport->cwnd = asoc->pathmtu; 855 855 } 856 856 transport->state = SCTP_ACTIVE; 857 857 break;
+2 -2
net/sctp/transport.c
··· 181 181 return; 182 182 } 183 183 184 - call_rcu(&transport->rcu, sctp_transport_destroy_rcu); 185 - 186 184 sctp_packet_free(&transport->packet); 187 185 188 186 if (transport->asoc) 189 187 sctp_association_put(transport->asoc); 188 + 189 + call_rcu(&transport->rcu, sctp_transport_destroy_rcu); 190 190 } 191 191 192 192 /* Start T3_rtx timer if it is not already running and update the heartbeat
+7 -2
net/tipc/bearer.c
··· 460 460 { 461 461 struct tipc_link *l_ptr; 462 462 struct tipc_link *temp_l_ptr; 463 + struct tipc_link_req *temp_req; 463 464 464 465 pr_info("Disabling bearer <%s>\n", b_ptr->name); 465 466 spin_lock_bh(&b_ptr->lock); ··· 469 468 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 470 469 tipc_link_delete(l_ptr); 471 470 } 472 - if (b_ptr->link_req) 473 - tipc_disc_delete(b_ptr->link_req); 471 + temp_req = b_ptr->link_req; 472 + b_ptr->link_req = NULL; 474 473 spin_unlock_bh(&b_ptr->lock); 474 + 475 + if (temp_req) 476 + tipc_disc_delete(temp_req); 477 + 475 478 memset(b_ptr, 0, sizeof(struct tipc_bearer)); 476 479 } 477 480
+1 -1
net/vmw_vsock/af_vsock.c
··· 347 347 for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { 348 348 struct vsock_sock *vsk; 349 349 list_for_each_entry(vsk, &vsock_connected_table[i], 350 - connected_table); 350 + connected_table) 351 351 fn(sk_vsock(vsk)); 352 352 } 353 353
+1
net/wireless/core.c
··· 765 765 cfg80211_leave_mesh(rdev, dev); 766 766 break; 767 767 case NL80211_IFTYPE_AP: 768 + case NL80211_IFTYPE_P2P_GO: 768 769 cfg80211_stop_ap(rdev, dev); 769 770 break; 770 771 default:
+4 -2
net/wireless/nl80211.c
··· 441 441 goto out_unlock; 442 442 } 443 443 *rdev = wiphy_to_dev((*wdev)->wiphy); 444 - cb->args[0] = (*rdev)->wiphy_idx; 444 + /* 0 is the first index - add 1 to parse only once */ 445 + cb->args[0] = (*rdev)->wiphy_idx + 1; 445 446 cb->args[1] = (*wdev)->identifier; 446 447 } else { 447 - struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0]); 448 + /* subtract the 1 again here */ 449 + struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); 448 450 struct wireless_dev *tmp; 449 451 450 452 if (!wiphy) {