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.

MMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) Stretch ACKs can kill performance with Reno and CUBIC congestion
control, largely due to LRO and GRO. Fix from Neal Cardwell.

2) Fix userland breakage because we accidently emit zero length netlink
messages from the bridging code. From Roopa Prabhu.

3) Carry handling in generic csum_tcpudp_nofold is broken, fix from
Karl Beldan.

4) Remove bogus dev_set_net() calls from CAIF driver, from Nicolas
Dichtel.

5) Make sure PPP deflation never returns a length greater then the
output buffer, otherwise we overflow and trigger skb_over_panic().
Fix from Florian Westphal.

6) COSA driver needs VIRT_TO_BUS Kconfig dependencies, from Arnd
Bergmann.

7) Don't increase route cached MTU on datagram too big ICMPs. From Li
Wei.

8) Fix error path leaks in nf_tables, from Pablo Neira Ayuso.

9) Fix bitmask handling regression in netlink that broke things like
acpi userland tools. From Pablo Neira Ayuso.

10) Wrong header pointer passed to param_type2af() in SCTP code, from
Saran Maruti Ramanara.

11) Stacked vlans not handled correctly by vlan_get_protocol(), from
Toshiaki Makita.

12) Add missing DMA memory barrier to xgene driver, from Iyappan
Subramanian.

13) Fix crash in rate estimators, from Eric Dumazet.

14) We've been adding various workarounds, one after another, for the
change which added the per-net tcp_sock. It was meant to reduce
socket contention but added lots of problems.

Reduce this instead to a proper per-cpu socket and that rids us of
all the daemons.

From Eric Dumazet.

15) Fix memory corruption and OOPS in mlx4 driver, from Jack
Morgenstein.

16) When we disabled UFO in the virtio_net device, it introduces some
serious performance regressions. The orignal problem was IPV6
fragment ID generation, so fix that properly instead. From Vlad
Yasevich.

17) sr9700 driver build breaks on xtensa because it defines macros with
the same name as those used by the arch code. Use more unique
names. From Chen Gang.

18) Fix endianness in new virio 1.0 mode of the vhost net driver, from
Michael S Tsirkin.

19) Several sysctls were setting the maxlen attribute incorrectly, from
Sasha Levin.

20) Don't accept an FQ scheduler quantum of zero, that leads to crashes.
From Kenneth Klette Jonassen.

21) Fix dumping of non-existing actions in the packet scheduler
classifier. From Ignacy Gawędzki.

22) Return the write work_done value when doing TX work in the qlcnic
driver.

23) ip6gre_err accesses the info field with the wrong endianness, from
Sabrina Dubroca.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (54 commits)
sit: fix some __be16/u16 mismatches
ipv6: fix sparse errors in ip6_make_flowlabel()
net: remove some sparse warnings
flow_keys: n_proto type should be __be16
ip6_gre: fix endianness errors in ip6gre_err
qlcnic: Fix NAPI poll routine for Tx completion
amd-xgbe: Set RSS enablement based on hardware features
amd-xgbe: Adjust for zero-based traffic class count
cls_api.c: Fix dumping of non-existing actions' stats.
pkt_sched: fq: avoid hang when quantum 0
net: rds: use correct size for max unacked packets and bytes
vhost/net: fix up num_buffers endian-ness
gianfar: correct the bad expression while writing bit-pattern
net: usb: sr9700: Use 'SR_' prefix for the common register macros
Revert "drivers/net: Disable UFO through virtio"
Revert "drivers/net, ipv6: Select IPv6 fragment idents for virtio UFO packets"
ipv6: Select fragment id during UFO segmentation if not set.
xen-netback: stop the guest rx thread after a fatal error
net/mlx4_core: Fix kernel Oops (mem corruption) when working with more than 80 VFs
isdn: off by one in connect_res()
...

+527 -386
+1 -1
drivers/isdn/hardware/eicon/message.c
··· 1474 1474 add_ai(plci, &parms[5]); 1475 1475 sig_req(plci, REJECT, 0); 1476 1476 } 1477 - else if (Reject == 1 || Reject > 9) 1477 + else if (Reject == 1 || Reject >= 9) 1478 1478 { 1479 1479 add_ai(plci, &parms[5]); 1480 1480 sig_req(plci, HANGUP, 0);
-1
drivers/net/caif/caif_hsi.c
··· 1415 1415 1416 1416 cfhsi = netdev_priv(dev); 1417 1417 cfhsi_netlink_parms(data, cfhsi); 1418 - dev_net_set(cfhsi->ndev, src_net); 1419 1418 1420 1419 get_ops = symbol_get(cfhsi_get_ops); 1421 1420 if (!get_ops) {
+2 -2
drivers/net/ethernet/amd/Kconfig
··· 45 45 46 46 config LANCE 47 47 tristate "AMD LANCE and PCnet (AT1500 and NE2100) support" 48 - depends on ISA && ISA_DMA_API 48 + depends on ISA && ISA_DMA_API && !ARM 49 49 ---help--- 50 50 If you have a network (Ethernet) card of this type, say Y and read 51 51 the Ethernet-HOWTO, available from ··· 142 142 143 143 config NI65 144 144 tristate "NI6510 support" 145 - depends on ISA && ISA_DMA_API 145 + depends on ISA && ISA_DMA_API && !ARM 146 146 ---help--- 147 147 If you have a network (Ethernet) card of this type, say Y and read 148 148 the Ethernet-HOWTO, available from
+2
drivers/net/ethernet/amd/nmclan_cs.c
··· 952 952 do { 953 953 /* WARNING: MACE_IR is a READ/CLEAR port! */ 954 954 status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); 955 + if (!(status & ~MACE_IMR_DEFAULT) && IntrCnt == MACE_MAX_IR_ITERATIONS) 956 + return IRQ_NONE; 955 957 956 958 pr_debug("mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); 957 959
+3 -1
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
··· 523 523 hw_feat->sph = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, SPHEN); 524 524 hw_feat->tso = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, TSOEN); 525 525 hw_feat->dma_debug = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, DBGMEMA); 526 + hw_feat->rss = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, RSSEN); 526 527 hw_feat->tc_cnt = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, NUMTC); 527 528 hw_feat->hash_table_size = XGMAC_GET_BITS(mac_hfr1, MAC_HWF1R, 528 529 HASHTBLSZ); ··· 553 552 break; 554 553 } 555 554 556 - /* The Queue and Channel counts are zero based so increment them 555 + /* The Queue, Channel and TC counts are zero based so increment them 557 556 * to get the actual number 558 557 */ 559 558 hw_feat->rx_q_cnt++; 560 559 hw_feat->tx_q_cnt++; 561 560 hw_feat->rx_ch_cnt++; 562 561 hw_feat->tx_ch_cnt++; 562 + hw_feat->tc_cnt++; 563 563 564 564 DBGPR("<--xgbe_get_all_hw_features\n"); 565 565 }
+2
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
··· 369 369 if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc))) 370 370 break; 371 371 372 + /* read fpqnum field after dataaddr field */ 373 + dma_rmb(); 372 374 if (is_rx_desc(raw_desc)) 373 375 ret = xgene_enet_rx_frame(ring, raw_desc); 374 376 else
+2 -1
drivers/net/ethernet/cirrus/Kconfig
··· 32 32 will be called cs89x0. 33 33 34 34 config CS89x0_PLATFORM 35 - bool "CS89x0 platform driver support" 35 + bool "CS89x0 platform driver support" if HAS_IOPORT_MAP 36 + default !HAS_IOPORT_MAP 36 37 depends on CS89x0 37 38 help 38 39 Say Y to compile the cs89x0 driver as a platform driver. This
+1 -1
drivers/net/ethernet/freescale/gianfar_ethtool.c
··· 1586 1586 return -EBUSY; 1587 1587 1588 1588 /* Fill regular entries */ 1589 - for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl); 1589 + for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop); 1590 1590 i++) 1591 1591 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); 1592 1592 /* Fill the rest with fall-troughs */
+11 -8
drivers/net/ethernet/intel/igbvf/netdev.c
··· 1907 1907 1908 1908 static int igbvf_tso(struct igbvf_adapter *adapter, 1909 1909 struct igbvf_ring *tx_ring, 1910 - struct sk_buff *skb, u32 tx_flags, u8 *hdr_len) 1910 + struct sk_buff *skb, u32 tx_flags, u8 *hdr_len, 1911 + __be16 protocol) 1911 1912 { 1912 1913 struct e1000_adv_tx_context_desc *context_desc; 1913 1914 struct igbvf_buffer *buffer_info; ··· 1928 1927 l4len = tcp_hdrlen(skb); 1929 1928 *hdr_len += l4len; 1930 1929 1931 - if (skb->protocol == htons(ETH_P_IP)) { 1930 + if (protocol == htons(ETH_P_IP)) { 1932 1931 struct iphdr *iph = ip_hdr(skb); 1933 1932 iph->tot_len = 0; 1934 1933 iph->check = 0; ··· 1959 1958 /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */ 1960 1959 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); 1961 1960 1962 - if (skb->protocol == htons(ETH_P_IP)) 1961 + if (protocol == htons(ETH_P_IP)) 1963 1962 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; 1964 1963 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; 1965 1964 ··· 1985 1984 1986 1985 static inline bool igbvf_tx_csum(struct igbvf_adapter *adapter, 1987 1986 struct igbvf_ring *tx_ring, 1988 - struct sk_buff *skb, u32 tx_flags) 1987 + struct sk_buff *skb, u32 tx_flags, 1988 + __be16 protocol) 1989 1989 { 1990 1990 struct e1000_adv_tx_context_desc *context_desc; 1991 1991 unsigned int i; ··· 2013 2011 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); 2014 2012 2015 2013 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2016 - switch (skb->protocol) { 2014 + switch (protocol) { 2017 2015 case htons(ETH_P_IP): 2018 2016 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; 2019 2017 if (ip_hdr(skb)->protocol == IPPROTO_TCP) ··· 2213 2211 u8 hdr_len = 0; 2214 2212 int count = 0; 2215 2213 int tso = 0; 2214 + __be16 protocol = vlan_get_protocol(skb); 2216 2215 2217 2216 if (test_bit(__IGBVF_DOWN, &adapter->state)) { 2218 2217 dev_kfree_skb_any(skb); ··· 2242 2239 tx_flags |= (vlan_tx_tag_get(skb) << IGBVF_TX_FLAGS_VLAN_SHIFT); 2243 2240 } 2244 2241 2245 - if (skb->protocol == htons(ETH_P_IP)) 2242 + if (protocol == htons(ETH_P_IP)) 2246 2243 tx_flags |= IGBVF_TX_FLAGS_IPV4; 2247 2244 2248 2245 first = tx_ring->next_to_use; 2249 2246 2250 2247 tso = skb_is_gso(skb) ? 2251 - igbvf_tso(adapter, tx_ring, skb, tx_flags, &hdr_len) : 0; 2248 + igbvf_tso(adapter, tx_ring, skb, tx_flags, &hdr_len, protocol) : 0; 2252 2249 if (unlikely(tso < 0)) { 2253 2250 dev_kfree_skb_any(skb); 2254 2251 return NETDEV_TX_OK; ··· 2256 2253 2257 2254 if (tso) 2258 2255 tx_flags |= IGBVF_TX_FLAGS_TSO; 2259 - else if (igbvf_tx_csum(adapter, tx_ring, skb, tx_flags) && 2256 + else if (igbvf_tx_csum(adapter, tx_ring, skb, tx_flags, protocol) && 2260 2257 (skb->ip_summed == CHECKSUM_PARTIAL)) 2261 2258 tx_flags |= IGBVF_TX_FLAGS_CSUM; 2262 2259
+1 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 7227 7227 if (!vhdr) 7228 7228 goto out_drop; 7229 7229 7230 - protocol = vhdr->h_vlan_encapsulated_proto; 7231 7230 tx_flags |= ntohs(vhdr->h_vlan_TCI) << 7232 7231 IXGBE_TX_FLAGS_VLAN_SHIFT; 7233 7232 tx_flags |= IXGBE_TX_FLAGS_SW_VLAN; 7234 7233 } 7234 + protocol = vlan_get_protocol(skb); 7235 7235 7236 7236 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && 7237 7237 adapter->ptp_clock &&
+2 -2
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
··· 3099 3099 /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */ 3100 3100 type_tucmd = IXGBE_ADVTXD_TUCMD_L4T_TCP; 3101 3101 3102 - if (skb->protocol == htons(ETH_P_IP)) { 3102 + if (first->protocol == htons(ETH_P_IP)) { 3103 3103 struct iphdr *iph = ip_hdr(skb); 3104 3104 iph->tot_len = 0; 3105 3105 iph->check = 0; ··· 3156 3156 3157 3157 if (skb->ip_summed == CHECKSUM_PARTIAL) { 3158 3158 u8 l4_hdr = 0; 3159 - switch (skb->protocol) { 3159 + switch (first->protocol) { 3160 3160 case htons(ETH_P_IP): 3161 3161 vlan_macip_lens |= skb_network_header_len(skb); 3162 3162 type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
+2 -1
drivers/net/ethernet/mellanox/mlx4/mlx4.h
··· 235 235 extern int mlx4_log_num_mgm_entry_size; 236 236 extern int log_mtts_per_seg; 237 237 238 - #define MLX4_MAX_NUM_SLAVES (MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF) 238 + #define MLX4_MAX_NUM_SLAVES (min(MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF, \ 239 + MLX4_MFUNC_MAX)) 239 240 #define ALL_SLAVES 0xff 240 241 241 242 struct mlx4_bitmap {
+24 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
··· 967 967 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring, 968 968 budget); 969 969 work_done = qlcnic_process_rcv_ring(sds_ring, budget); 970 - if ((work_done < budget) && tx_complete) { 970 + 971 + /* Check if we need a repoll */ 972 + if (!tx_complete) 973 + work_done = budget; 974 + 975 + if (work_done < budget) { 971 976 napi_complete(&sds_ring->napi); 972 977 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { 973 978 qlcnic_enable_sds_intr(adapter, sds_ring); ··· 997 992 napi_complete(&tx_ring->napi); 998 993 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) 999 994 qlcnic_enable_tx_intr(adapter, tx_ring); 995 + } else { 996 + /* As qlcnic_process_cmd_ring() returned 0, we need a repoll*/ 997 + work_done = budget; 1000 998 } 1001 999 1002 1000 return work_done; ··· 1958 1950 1959 1951 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring, budget); 1960 1952 work_done = qlcnic_83xx_process_rcv_ring(sds_ring, budget); 1961 - if ((work_done < budget) && tx_complete) { 1953 + 1954 + /* Check if we need a repoll */ 1955 + if (!tx_complete) 1956 + work_done = budget; 1957 + 1958 + if (work_done < budget) { 1962 1959 napi_complete(&sds_ring->napi); 1963 1960 qlcnic_enable_sds_intr(adapter, sds_ring); 1964 1961 } ··· 1986 1973 1987 1974 tx_complete = qlcnic_process_cmd_ring(adapter, tx_ring, budget); 1988 1975 work_done = qlcnic_83xx_process_rcv_ring(sds_ring, budget); 1989 - if ((work_done < budget) && tx_complete) { 1976 + 1977 + /* Check if we need a repoll */ 1978 + if (!tx_complete) 1979 + work_done = budget; 1980 + 1981 + if (work_done < budget) { 1990 1982 napi_complete(&sds_ring->napi); 1991 1983 qlcnic_enable_sds_intr(adapter, sds_ring); 1992 1984 } ··· 2013 1995 napi_complete(&tx_ring->napi); 2014 1996 if (test_bit(__QLCNIC_DEV_UP , &adapter->state)) 2015 1997 qlcnic_enable_tx_intr(adapter, tx_ring); 1998 + } else { 1999 + /* need a repoll */ 2000 + work_done = budget; 2016 2001 } 2017 2002 2018 2003 return work_done;
+16 -10
drivers/net/ethernet/qlogic/qlge/qlge_main.c
··· 2351 2351 { 2352 2352 struct ql_adapter *qdev = netdev_priv(ndev); 2353 2353 int status = 0; 2354 + bool need_restart = netif_running(ndev); 2354 2355 2355 - status = ql_adapter_down(qdev); 2356 - if (status) { 2357 - netif_err(qdev, link, qdev->ndev, 2358 - "Failed to bring down the adapter\n"); 2359 - return status; 2356 + if (need_restart) { 2357 + status = ql_adapter_down(qdev); 2358 + if (status) { 2359 + netif_err(qdev, link, qdev->ndev, 2360 + "Failed to bring down the adapter\n"); 2361 + return status; 2362 + } 2360 2363 } 2361 2364 2362 2365 /* update the features with resent change */ 2363 2366 ndev->features = features; 2364 2367 2365 - status = ql_adapter_up(qdev); 2366 - if (status) { 2367 - netif_err(qdev, link, qdev->ndev, 2368 - "Failed to bring up the adapter\n"); 2369 - return status; 2368 + if (need_restart) { 2369 + status = ql_adapter_up(qdev); 2370 + if (status) { 2371 + netif_err(qdev, link, qdev->ndev, 2372 + "Failed to bring up the adapter\n"); 2373 + return status; 2374 + } 2370 2375 } 2376 + 2371 2377 return status; 2372 2378 } 2373 2379
+1
drivers/net/ethernet/sun/sunvnet.c
··· 1119 1119 skb_shinfo(nskb)->gso_size = skb_shinfo(skb)->gso_size; 1120 1120 skb_shinfo(nskb)->gso_type = skb_shinfo(skb)->gso_type; 1121 1121 } 1122 + nskb->queue_mapping = skb->queue_mapping; 1122 1123 dev_kfree_skb(skb); 1123 1124 skb = nskb; 1124 1125 }
+8 -3
drivers/net/hyperv/netvsc.c
··· 716 716 u64 req_id; 717 717 unsigned int section_index = NETVSC_INVALID_INDEX; 718 718 u32 msg_size = 0; 719 - struct sk_buff *skb; 719 + struct sk_buff *skb = NULL; 720 720 u16 q_idx = packet->q_idx; 721 721 722 722 ··· 743 743 packet); 744 744 skb = (struct sk_buff *) 745 745 (unsigned long)packet->send_completion_tid; 746 - if (skb) 747 - dev_kfree_skb_any(skb); 748 746 packet->page_buf_cnt = 0; 749 747 } 750 748 } ··· 806 808 } else { 807 809 netdev_err(ndev, "Unable to send packet %p ret %d\n", 808 810 packet, ret); 811 + } 812 + 813 + if (ret != 0) { 814 + if (section_index != NETVSC_INVALID_INDEX) 815 + netvsc_free_send_slot(net_device, section_index); 816 + } else if (skb) { 817 + dev_kfree_skb_any(skb); 809 818 } 810 819 811 820 return ret;
+8 -8
drivers/net/macvtap.c
··· 17 17 #include <linux/fs.h> 18 18 #include <linux/uio.h> 19 19 20 - #include <net/ipv6.h> 21 20 #include <net/net_namespace.h> 22 21 #include <net/rtnetlink.h> 23 22 #include <net/sock.h> ··· 80 81 static const struct proto_ops macvtap_socket_ops; 81 82 82 83 #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ 83 - NETIF_F_TSO6) 84 + NETIF_F_TSO6 | NETIF_F_UFO) 84 85 #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) 85 86 #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) 86 87 ··· 585 586 gso_type = SKB_GSO_TCPV6; 586 587 break; 587 588 case VIRTIO_NET_HDR_GSO_UDP: 588 - pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n", 589 - current->comm); 590 589 gso_type = SKB_GSO_UDP; 591 - if (skb->protocol == htons(ETH_P_IPV6)) 592 - ipv6_proxy_select_ident(skb); 593 590 break; 594 591 default: 595 592 return -EINVAL; ··· 631 636 vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; 632 637 else if (sinfo->gso_type & SKB_GSO_TCPV6) 633 638 vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 639 + else if (sinfo->gso_type & SKB_GSO_UDP) 640 + vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; 634 641 else 635 642 BUG(); 636 643 if (sinfo->gso_type & SKB_GSO_TCP_ECN) ··· 962 965 if (arg & TUN_F_TSO6) 963 966 feature_mask |= NETIF_F_TSO6; 964 967 } 968 + 969 + if (arg & TUN_F_UFO) 970 + feature_mask |= NETIF_F_UFO; 965 971 } 966 972 967 973 /* tun/tap driver inverts the usage for TSO offloads, where ··· 975 975 * When user space turns off TSO, we turn off GSO/LRO so that 976 976 * user-space will not receive TSO frames. 977 977 */ 978 - if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) 978 + if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) 979 979 features |= RX_OFFLOADS; 980 980 else 981 981 features &= ~RX_OFFLOADS; ··· 1090 1090 case TUNSETOFFLOAD: 1091 1091 /* let the user check for future flags */ 1092 1092 if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | 1093 - TUN_F_TSO_ECN)) 1093 + TUN_F_TSO_ECN | TUN_F_UFO)) 1094 1094 return -EINVAL; 1095 1095 1096 1096 rtnl_lock();
+1 -1
drivers/net/ppp/ppp_deflate.c
··· 246 246 /* 247 247 * See if we managed to reduce the size of the packet. 248 248 */ 249 - if (olen < isize) { 249 + if (olen < isize && olen <= osize) { 250 250 state->stats.comp_bytes += olen; 251 251 state->stats.comp_packets++; 252 252 } else {
+9 -16
drivers/net/tun.c
··· 65 65 #include <linux/nsproxy.h> 66 66 #include <linux/virtio_net.h> 67 67 #include <linux/rcupdate.h> 68 - #include <net/ipv6.h> 69 68 #include <net/net_namespace.h> 70 69 #include <net/netns/generic.h> 71 70 #include <net/rtnetlink.h> ··· 186 187 struct net_device *dev; 187 188 netdev_features_t set_features; 188 189 #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ 189 - NETIF_F_TSO6) 190 + NETIF_F_TSO6|NETIF_F_UFO) 190 191 191 192 int vnet_hdr_sz; 192 193 int sndbuf; ··· 1166 1167 break; 1167 1168 } 1168 1169 1169 - skb_reset_network_header(skb); 1170 - 1171 1170 if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { 1172 1171 pr_debug("GSO!\n"); 1173 1172 switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { ··· 1176 1179 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; 1177 1180 break; 1178 1181 case VIRTIO_NET_HDR_GSO_UDP: 1179 - { 1180 - static bool warned; 1181 - 1182 - if (!warned) { 1183 - warned = true; 1184 - netdev_warn(tun->dev, 1185 - "%s: using disabled UFO feature; please fix this program\n", 1186 - current->comm); 1187 - } 1188 1182 skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 1189 - if (skb->protocol == htons(ETH_P_IPV6)) 1190 - ipv6_proxy_select_ident(skb); 1191 1183 break; 1192 - } 1193 1184 default: 1194 1185 tun->dev->stats.rx_frame_errors++; 1195 1186 kfree_skb(skb); ··· 1206 1221 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; 1207 1222 } 1208 1223 1224 + skb_reset_network_header(skb); 1209 1225 skb_probe_transport_header(skb, 0); 1210 1226 1211 1227 rxhash = skb_get_hash(skb); ··· 1284 1298 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; 1285 1299 else if (sinfo->gso_type & SKB_GSO_TCPV6) 1286 1300 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 1301 + else if (sinfo->gso_type & SKB_GSO_UDP) 1302 + gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; 1287 1303 else { 1288 1304 pr_err("unexpected GSO type: " 1289 1305 "0x%x, gso_size %d, hdr_len %d\n", ··· 1733 1745 if (arg & TUN_F_TSO6) 1734 1746 features |= NETIF_F_TSO6; 1735 1747 arg &= ~(TUN_F_TSO4|TUN_F_TSO6); 1748 + } 1749 + 1750 + if (arg & TUN_F_UFO) { 1751 + features |= NETIF_F_UFO; 1752 + arg &= ~TUN_F_UFO; 1736 1753 } 1737 1754 } 1738 1755
+18 -18
drivers/net/usb/sr9700.c
··· 77 77 int ret; 78 78 79 79 udelay(1); 80 - ret = sr_read_reg(dev, EPCR, &tmp); 80 + ret = sr_read_reg(dev, SR_EPCR, &tmp); 81 81 if (ret < 0) 82 82 return ret; 83 83 ··· 98 98 99 99 mutex_lock(&dev->phy_mutex); 100 100 101 - sr_write_reg(dev, EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); 102 - sr_write_reg(dev, EPCR, phy ? (EPCR_EPOS | EPCR_ERPRR) : EPCR_ERPRR); 101 + sr_write_reg(dev, SR_EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); 102 + sr_write_reg(dev, SR_EPCR, phy ? (EPCR_EPOS | EPCR_ERPRR) : EPCR_ERPRR); 103 103 104 104 ret = wait_phy_eeprom_ready(dev, phy); 105 105 if (ret < 0) 106 106 goto out_unlock; 107 107 108 - sr_write_reg(dev, EPCR, 0x0); 109 - ret = sr_read(dev, EPDR, 2, value); 108 + sr_write_reg(dev, SR_EPCR, 0x0); 109 + ret = sr_read(dev, SR_EPDR, 2, value); 110 110 111 111 netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n", 112 112 phy, reg, *value, ret); ··· 123 123 124 124 mutex_lock(&dev->phy_mutex); 125 125 126 - ret = sr_write(dev, EPDR, 2, &value); 126 + ret = sr_write(dev, SR_EPDR, 2, &value); 127 127 if (ret < 0) 128 128 goto out_unlock; 129 129 130 - sr_write_reg(dev, EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); 131 - sr_write_reg(dev, EPCR, phy ? (EPCR_WEP | EPCR_EPOS | EPCR_ERPRW) : 130 + sr_write_reg(dev, SR_EPAR, phy ? (reg | EPAR_PHY_ADR) : reg); 131 + sr_write_reg(dev, SR_EPCR, phy ? (EPCR_WEP | EPCR_EPOS | EPCR_ERPRW) : 132 132 (EPCR_WEP | EPCR_ERPRW)); 133 133 134 134 ret = wait_phy_eeprom_ready(dev, phy); 135 135 if (ret < 0) 136 136 goto out_unlock; 137 137 138 - sr_write_reg(dev, EPCR, 0x0); 138 + sr_write_reg(dev, SR_EPCR, 0x0); 139 139 140 140 out_unlock: 141 141 mutex_unlock(&dev->phy_mutex); ··· 188 188 if (loc == MII_BMSR) { 189 189 u8 value; 190 190 191 - sr_read_reg(dev, NSR, &value); 191 + sr_read_reg(dev, SR_NSR, &value); 192 192 if (value & NSR_LINKST) 193 193 rc = 1; 194 194 } ··· 228 228 int rc = 0; 229 229 230 230 /* Get the Link Status directly */ 231 - sr_read_reg(dev, NSR, &value); 231 + sr_read_reg(dev, SR_NSR, &value); 232 232 if (value & NSR_LINKST) 233 233 rc = 1; 234 234 ··· 281 281 } 282 282 } 283 283 284 - sr_write_async(dev, MAR, SR_MCAST_SIZE, hashes); 285 - sr_write_reg_async(dev, RCR, rx_ctl); 284 + sr_write_async(dev, SR_MAR, SR_MCAST_SIZE, hashes); 285 + sr_write_reg_async(dev, SR_RCR, rx_ctl); 286 286 } 287 287 288 288 static int sr9700_set_mac_address(struct net_device *netdev, void *p) ··· 297 297 } 298 298 299 299 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 300 - sr_write_async(dev, PAR, 6, netdev->dev_addr); 300 + sr_write_async(dev, SR_PAR, 6, netdev->dev_addr); 301 301 302 302 return 0; 303 303 } ··· 340 340 mii->phy_id_mask = 0x1f; 341 341 mii->reg_num_mask = 0x1f; 342 342 343 - sr_write_reg(dev, NCR, NCR_RST); 343 + sr_write_reg(dev, SR_NCR, NCR_RST); 344 344 udelay(20); 345 345 346 346 /* read MAC ··· 348 348 * EEPROM automatically to PAR. In case there is no EEPROM externally, 349 349 * a default MAC address is stored in PAR for making chip work properly. 350 350 */ 351 - if (sr_read(dev, PAR, ETH_ALEN, netdev->dev_addr) < 0) { 351 + if (sr_read(dev, SR_PAR, ETH_ALEN, netdev->dev_addr) < 0) { 352 352 netdev_err(netdev, "Error reading MAC address\n"); 353 353 ret = -ENODEV; 354 354 goto out; 355 355 } 356 356 357 357 /* power up and reset phy */ 358 - sr_write_reg(dev, PRR, PRR_PHY_RST); 358 + sr_write_reg(dev, SR_PRR, PRR_PHY_RST); 359 359 /* at least 10ms, here 20ms for safe */ 360 360 mdelay(20); 361 - sr_write_reg(dev, PRR, 0); 361 + sr_write_reg(dev, SR_PRR, 0); 362 362 /* at least 1ms, here 2ms for reading right register */ 363 363 udelay(2 * 1000); 364 364
+33 -33
drivers/net/usb/sr9700.h
··· 14 14 /* sr9700 spec. register table on Linux platform */ 15 15 16 16 /* Network Control Reg */ 17 - #define NCR 0x00 17 + #define SR_NCR 0x00 18 18 #define NCR_RST (1 << 0) 19 19 #define NCR_LBK (3 << 1) 20 20 #define NCR_FDX (1 << 3) 21 21 #define NCR_WAKEEN (1 << 6) 22 22 /* Network Status Reg */ 23 - #define NSR 0x01 23 + #define SR_NSR 0x01 24 24 #define NSR_RXRDY (1 << 0) 25 25 #define NSR_RXOV (1 << 1) 26 26 #define NSR_TX1END (1 << 2) ··· 30 30 #define NSR_LINKST (1 << 6) 31 31 #define NSR_SPEED (1 << 7) 32 32 /* Tx Control Reg */ 33 - #define TCR 0x02 33 + #define SR_TCR 0x02 34 34 #define TCR_CRC_DIS (1 << 1) 35 35 #define TCR_PAD_DIS (1 << 2) 36 36 #define TCR_LC_CARE (1 << 3) ··· 38 38 #define TCR_EXCECM (1 << 5) 39 39 #define TCR_LF_EN (1 << 6) 40 40 /* Tx Status Reg for Packet Index 1 */ 41 - #define TSR1 0x03 41 + #define SR_TSR1 0x03 42 42 #define TSR1_EC (1 << 2) 43 43 #define TSR1_COL (1 << 3) 44 44 #define TSR1_LC (1 << 4) ··· 46 46 #define TSR1_LOC (1 << 6) 47 47 #define TSR1_TLF (1 << 7) 48 48 /* Tx Status Reg for Packet Index 2 */ 49 - #define TSR2 0x04 49 + #define SR_TSR2 0x04 50 50 #define TSR2_EC (1 << 2) 51 51 #define TSR2_COL (1 << 3) 52 52 #define TSR2_LC (1 << 4) ··· 54 54 #define TSR2_LOC (1 << 6) 55 55 #define TSR2_TLF (1 << 7) 56 56 /* Rx Control Reg*/ 57 - #define RCR 0x05 57 + #define SR_RCR 0x05 58 58 #define RCR_RXEN (1 << 0) 59 59 #define RCR_PRMSC (1 << 1) 60 60 #define RCR_RUNT (1 << 2) ··· 62 62 #define RCR_DIS_CRC (1 << 4) 63 63 #define RCR_DIS_LONG (1 << 5) 64 64 /* Rx Status Reg */ 65 - #define RSR 0x06 65 + #define SR_RSR 0x06 66 66 #define RSR_AE (1 << 2) 67 67 #define RSR_MF (1 << 6) 68 68 #define RSR_RF (1 << 7) 69 69 /* Rx Overflow Counter Reg */ 70 - #define ROCR 0x07 70 + #define SR_ROCR 0x07 71 71 #define ROCR_ROC (0x7F << 0) 72 72 #define ROCR_RXFU (1 << 7) 73 73 /* Back Pressure Threshold Reg */ 74 - #define BPTR 0x08 74 + #define SR_BPTR 0x08 75 75 #define BPTR_JPT (0x0F << 0) 76 76 #define BPTR_BPHW (0x0F << 4) 77 77 /* Flow Control Threshold Reg */ 78 - #define FCTR 0x09 78 + #define SR_FCTR 0x09 79 79 #define FCTR_LWOT (0x0F << 0) 80 80 #define FCTR_HWOT (0x0F << 4) 81 81 /* rx/tx Flow Control Reg */ 82 - #define FCR 0x0A 82 + #define SR_FCR 0x0A 83 83 #define FCR_FLCE (1 << 0) 84 84 #define FCR_BKPA (1 << 4) 85 85 #define FCR_TXPEN (1 << 5) 86 86 #define FCR_TXPF (1 << 6) 87 87 #define FCR_TXP0 (1 << 7) 88 88 /* Eeprom & Phy Control Reg */ 89 - #define EPCR 0x0B 89 + #define SR_EPCR 0x0B 90 90 #define EPCR_ERRE (1 << 0) 91 91 #define EPCR_ERPRW (1 << 1) 92 92 #define EPCR_ERPRR (1 << 2) 93 93 #define EPCR_EPOS (1 << 3) 94 94 #define EPCR_WEP (1 << 4) 95 95 /* Eeprom & Phy Address Reg */ 96 - #define EPAR 0x0C 96 + #define SR_EPAR 0x0C 97 97 #define EPAR_EROA (0x3F << 0) 98 98 #define EPAR_PHY_ADR_MASK (0x03 << 6) 99 99 #define EPAR_PHY_ADR (0x01 << 6) 100 100 /* Eeprom & Phy Data Reg */ 101 - #define EPDR 0x0D /* 0x0D ~ 0x0E for Data Reg Low & High */ 101 + #define SR_EPDR 0x0D /* 0x0D ~ 0x0E for Data Reg Low & High */ 102 102 /* Wakeup Control Reg */ 103 - #define WCR 0x0F 103 + #define SR_WCR 0x0F 104 104 #define WCR_MAGICST (1 << 0) 105 105 #define WCR_LINKST (1 << 2) 106 106 #define WCR_MAGICEN (1 << 3) 107 107 #define WCR_LINKEN (1 << 5) 108 108 /* Physical Address Reg */ 109 - #define PAR 0x10 /* 0x10 ~ 0x15 6 bytes for PAR */ 109 + #define SR_PAR 0x10 /* 0x10 ~ 0x15 6 bytes for PAR */ 110 110 /* Multicast Address Reg */ 111 - #define MAR 0x16 /* 0x16 ~ 0x1D 8 bytes for MAR */ 111 + #define SR_MAR 0x16 /* 0x16 ~ 0x1D 8 bytes for MAR */ 112 112 /* 0x1e unused */ 113 113 /* Phy Reset Reg */ 114 - #define PRR 0x1F 114 + #define SR_PRR 0x1F 115 115 #define PRR_PHY_RST (1 << 0) 116 116 /* Tx sdram Write Pointer Address Low */ 117 - #define TWPAL 0x20 117 + #define SR_TWPAL 0x20 118 118 /* Tx sdram Write Pointer Address High */ 119 - #define TWPAH 0x21 119 + #define SR_TWPAH 0x21 120 120 /* Tx sdram Read Pointer Address Low */ 121 - #define TRPAL 0x22 121 + #define SR_TRPAL 0x22 122 122 /* Tx sdram Read Pointer Address High */ 123 - #define TRPAH 0x23 123 + #define SR_TRPAH 0x23 124 124 /* Rx sdram Write Pointer Address Low */ 125 - #define RWPAL 0x24 125 + #define SR_RWPAL 0x24 126 126 /* Rx sdram Write Pointer Address High */ 127 - #define RWPAH 0x25 127 + #define SR_RWPAH 0x25 128 128 /* Rx sdram Read Pointer Address Low */ 129 - #define RRPAL 0x26 129 + #define SR_RRPAL 0x26 130 130 /* Rx sdram Read Pointer Address High */ 131 - #define RRPAH 0x27 131 + #define SR_RRPAH 0x27 132 132 /* Vendor ID register */ 133 - #define VID 0x28 /* 0x28 ~ 0x29 2 bytes for VID */ 133 + #define SR_VID 0x28 /* 0x28 ~ 0x29 2 bytes for VID */ 134 134 /* Product ID register */ 135 - #define PID 0x2A /* 0x2A ~ 0x2B 2 bytes for PID */ 135 + #define SR_PID 0x2A /* 0x2A ~ 0x2B 2 bytes for PID */ 136 136 /* CHIP Revision register */ 137 - #define CHIPR 0x2C 137 + #define SR_CHIPR 0x2C 138 138 /* 0x2D --> 0xEF unused */ 139 139 /* USB Device Address */ 140 - #define USBDA 0xF0 140 + #define SR_USBDA 0xF0 141 141 #define USBDA_USBFA (0x7F << 0) 142 142 /* RX packet Counter Reg */ 143 - #define RXC 0xF1 143 + #define SR_RXC 0xF1 144 144 /* Tx packet Counter & USB Status Reg */ 145 - #define TXC_USBS 0xF2 145 + #define SR_TXC_USBS 0xF2 146 146 #define TXC_USBS_TXC0 (1 << 0) 147 147 #define TXC_USBS_TXC1 (1 << 1) 148 148 #define TXC_USBS_TXC2 (1 << 2) ··· 150 150 #define TXC_USBS_SUSFLAG (1 << 6) 151 151 #define TXC_USBS_RXFAULT (1 << 7) 152 152 /* USB Control register */ 153 - #define USBC 0xF4 153 + #define SR_USBC 0xF4 154 154 #define USBC_EP3NAK (1 << 4) 155 155 #define USBC_EP3ACK (1 << 5) 156 156
+10 -14
drivers/net/virtio_net.c
··· 490 490 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; 491 491 break; 492 492 case VIRTIO_NET_HDR_GSO_UDP: 493 - { 494 - static bool warned; 495 - 496 - if (!warned) { 497 - warned = true; 498 - netdev_warn(dev, 499 - "host using disabled UFO feature; please fix it\n"); 500 - } 501 493 skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 502 494 break; 503 - } 504 495 case VIRTIO_NET_HDR_GSO_TCPV6: 505 496 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; 506 497 break; ··· 879 888 hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; 880 889 else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) 881 890 hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 891 + else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) 892 + hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_UDP; 882 893 else 883 894 BUG(); 884 895 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) ··· 1741 1748 dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 1742 1749 1743 1750 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { 1744 - dev->hw_features |= NETIF_F_TSO 1751 + dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO 1745 1752 | NETIF_F_TSO_ECN | NETIF_F_TSO6; 1746 1753 } 1747 1754 /* Individual feature bits: what can host handle? */ ··· 1751 1758 dev->hw_features |= NETIF_F_TSO6; 1752 1759 if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) 1753 1760 dev->hw_features |= NETIF_F_TSO_ECN; 1761 + if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) 1762 + dev->hw_features |= NETIF_F_UFO; 1754 1763 1755 1764 if (gso) 1756 - dev->features |= dev->hw_features & NETIF_F_ALL_TSO; 1765 + dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); 1757 1766 /* (!csum && gso) case will be fixed by register_netdev() */ 1758 1767 } 1759 1768 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) ··· 1793 1798 /* If we can receive ANY GSO packets, we must allocate large ones. */ 1794 1799 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || 1795 1800 virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || 1796 - virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) 1801 + virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || 1802 + virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) 1797 1803 vi->big_packets = true; 1798 1804 1799 1805 if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) ··· 1990 1994 static unsigned int features[] = { 1991 1995 VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, 1992 1996 VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, 1993 - VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_TSO6, 1997 + VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, 1994 1998 VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, 1995 - VIRTIO_NET_F_GUEST_ECN, 1999 + VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, 1996 2000 VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, 1997 2001 VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, 1998 2002 VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ,
+5 -5
drivers/net/vxlan.c
··· 2432 2432 dev_put(vxlan->dev); 2433 2433 } 2434 2434 2435 - static int vxlan_newlink(struct net *net, struct net_device *dev, 2435 + static int vxlan_newlink(struct net *src_net, struct net_device *dev, 2436 2436 struct nlattr *tb[], struct nlattr *data[]) 2437 2437 { 2438 - struct vxlan_net *vn = net_generic(net, vxlan_net_id); 2438 + struct vxlan_net *vn = net_generic(src_net, vxlan_net_id); 2439 2439 struct vxlan_dev *vxlan = netdev_priv(dev); 2440 2440 struct vxlan_rdst *dst = &vxlan->default_dst; 2441 2441 __u32 vni; ··· 2445 2445 if (!data[IFLA_VXLAN_ID]) 2446 2446 return -EINVAL; 2447 2447 2448 - vxlan->net = dev_net(dev); 2448 + vxlan->net = src_net; 2449 2449 2450 2450 vni = nla_get_u32(data[IFLA_VXLAN_ID]); 2451 2451 dst->remote_vni = vni; ··· 2481 2481 if (data[IFLA_VXLAN_LINK] && 2482 2482 (dst->remote_ifindex = nla_get_u32(data[IFLA_VXLAN_LINK]))) { 2483 2483 struct net_device *lowerdev 2484 - = __dev_get_by_index(net, dst->remote_ifindex); 2484 + = __dev_get_by_index(src_net, dst->remote_ifindex); 2485 2485 2486 2486 if (!lowerdev) { 2487 2487 pr_info("ifindex %d does not exist\n", dst->remote_ifindex); ··· 2557 2557 nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) 2558 2558 vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; 2559 2559 2560 - if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET, 2560 + if (vxlan_find_vni(src_net, vni, use_ipv6 ? AF_INET6 : AF_INET, 2561 2561 vxlan->dst_port)) { 2562 2562 pr_info("duplicate VNI %u\n", vni); 2563 2563 return -EEXIST;
+3 -3
drivers/net/wan/Kconfig
··· 25 25 # There is no way to detect a comtrol sv11 - force it modular for now. 26 26 config HOSTESS_SV11 27 27 tristate "Comtrol Hostess SV-11 support" 28 - depends on ISA && m && ISA_DMA_API && INET && HDLC 28 + depends on ISA && m && ISA_DMA_API && INET && HDLC && VIRT_TO_BUS 29 29 help 30 30 Driver for Comtrol Hostess SV-11 network card which 31 31 operates on low speed synchronous serial links at up to ··· 37 37 # The COSA/SRP driver has not been tested as non-modular yet. 38 38 config COSA 39 39 tristate "COSA/SRP sync serial boards support" 40 - depends on ISA && m && ISA_DMA_API && HDLC 40 + depends on ISA && m && ISA_DMA_API && HDLC && VIRT_TO_BUS 41 41 ---help--- 42 42 Driver for COSA and SRP synchronous serial boards. 43 43 ··· 87 87 # There is no way to detect a Sealevel board. Force it modular 88 88 config SEALEVEL_4021 89 89 tristate "Sealevel Systems 4021 support" 90 - depends on ISA && m && ISA_DMA_API && INET && HDLC 90 + depends on ISA && m && ISA_DMA_API && INET && HDLC && VIRT_TO_BUS 91 91 help 92 92 This is a driver for the Sealevel Systems ACB 56 serial I/O adapter. 93 93
+2
drivers/net/xen-netback/interface.c
··· 578 578 goto err_rx_unbind; 579 579 } 580 580 queue->task = task; 581 + get_task_struct(task); 581 582 582 583 task = kthread_create(xenvif_dealloc_kthread, 583 584 (void *)queue, "%s-dealloc", queue->name); ··· 635 634 636 635 if (queue->task) { 637 636 kthread_stop(queue->task); 637 + put_task_struct(queue->task); 638 638 queue->task = NULL; 639 639 } 640 640
+1 -2
drivers/net/xen-netback/netback.c
··· 2109 2109 */ 2110 2110 if (unlikely(vif->disabled && queue->id == 0)) { 2111 2111 xenvif_carrier_off(vif); 2112 - xenvif_rx_queue_purge(queue); 2113 - continue; 2112 + break; 2114 2113 } 2115 2114 2116 2115 if (!skb_queue_empty(&queue->rx_queue))
+3 -1
drivers/vhost/net.c
··· 650 650 break; 651 651 } 652 652 /* TODO: Should check and handle checksum. */ 653 + 654 + hdr.num_buffers = cpu_to_vhost16(vq, headcount); 653 655 if (likely(mergeable) && 654 - memcpy_toiovecend(nvq->hdr, (unsigned char *)&headcount, 656 + memcpy_toiovecend(nvq->hdr, (void *)&hdr.num_buffers, 655 657 offsetof(typeof(hdr), num_buffers), 656 658 sizeof hdr.num_buffers)) { 657 659 vq_err(vq, "Failed num_buffers write");
+45 -13
include/linux/if_vlan.h
··· 472 472 /** 473 473 * vlan_get_protocol - get protocol EtherType. 474 474 * @skb: skbuff to query 475 + * @type: first vlan protocol 476 + * @depth: buffer to store length of eth and vlan tags in bytes 475 477 * 476 478 * Returns the EtherType of the packet, regardless of whether it is 477 479 * vlan encapsulated (normal or hardware accelerated) or not. 478 480 */ 479 - static inline __be16 vlan_get_protocol(const struct sk_buff *skb) 481 + static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, 482 + int *depth) 480 483 { 481 - __be16 protocol = 0; 484 + unsigned int vlan_depth = skb->mac_len; 482 485 483 - if (vlan_tx_tag_present(skb) || 484 - skb->protocol != cpu_to_be16(ETH_P_8021Q)) 485 - protocol = skb->protocol; 486 - else { 487 - __be16 proto, *protop; 488 - protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr, 489 - h_vlan_encapsulated_proto), 490 - sizeof(proto), &proto); 491 - if (likely(protop)) 492 - protocol = *protop; 486 + /* if type is 802.1Q/AD then the header should already be 487 + * present at mac_len - VLAN_HLEN (if mac_len > 0), or at 488 + * ETH_HLEN otherwise 489 + */ 490 + if (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) { 491 + if (vlan_depth) { 492 + if (WARN_ON(vlan_depth < VLAN_HLEN)) 493 + return 0; 494 + vlan_depth -= VLAN_HLEN; 495 + } else { 496 + vlan_depth = ETH_HLEN; 497 + } 498 + do { 499 + struct vlan_hdr *vh; 500 + 501 + if (unlikely(!pskb_may_pull(skb, 502 + vlan_depth + VLAN_HLEN))) 503 + return 0; 504 + 505 + vh = (struct vlan_hdr *)(skb->data + vlan_depth); 506 + type = vh->h_vlan_encapsulated_proto; 507 + vlan_depth += VLAN_HLEN; 508 + } while (type == htons(ETH_P_8021Q) || 509 + type == htons(ETH_P_8021AD)); 493 510 } 494 511 495 - return protocol; 512 + if (depth) 513 + *depth = vlan_depth; 514 + 515 + return type; 516 + } 517 + 518 + /** 519 + * vlan_get_protocol - get protocol EtherType. 520 + * @skb: skbuff to query 521 + * 522 + * Returns the EtherType of the packet, regardless of whether it is 523 + * vlan encapsulated (normal or hardware accelerated) or not. 524 + */ 525 + static inline __be16 vlan_get_protocol(struct sk_buff *skb) 526 + { 527 + return __vlan_get_protocol(skb, skb->protocol, NULL); 496 528 } 497 529 498 530 static inline void vlan_set_encap_proto(struct sk_buff *skb,
+1 -1
include/linux/mlx4/device.h
··· 97 97 MLX4_MAX_NUM_PF = 16, 98 98 MLX4_MAX_NUM_VF = 126, 99 99 MLX4_MAX_NUM_VF_P_PORT = 64, 100 - MLX4_MFUNC_MAX = 80, 100 + MLX4_MFUNC_MAX = 128, 101 101 MLX4_MAX_EQ_NUM = 1024, 102 102 MLX4_MFUNC_EQ_NUM = 4, 103 103 MLX4_MFUNC_MAX_EQES = 8,
+3 -3
include/net/flow_keys.h
··· 22 22 __be32 ports; 23 23 __be16 port16[2]; 24 24 }; 25 - u16 thoff; 26 - u16 n_proto; 27 - u8 ip_proto; 25 + u16 thoff; 26 + __be16 n_proto; 27 + u8 ip_proto; 28 28 }; 29 29 30 30 bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow,
+1 -1
include/net/ip.h
··· 181 181 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; 182 182 } 183 183 184 - void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, 184 + void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, 185 185 const struct ip_options *sopt, 186 186 __be32 daddr, __be32 saddr, 187 187 const struct ip_reply_arg *arg,
+5 -2
include/net/ipv6.h
··· 671 671 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 672 672 } 673 673 674 + u32 __ipv6_select_ident(u32 hashrnd, struct in6_addr *dst, 675 + struct in6_addr *src); 676 + void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 674 677 void ipv6_proxy_select_ident(struct sk_buff *skb); 675 678 676 679 int ip6_dst_hoplimit(struct dst_entry *dst); ··· 711 708 __be32 flowlabel, bool autolabel) 712 709 { 713 710 if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) { 714 - __be32 hash; 711 + u32 hash; 715 712 716 713 hash = skb_get_hash(skb); 717 714 ··· 721 718 */ 722 719 hash ^= hash >> 12; 723 720 724 - flowlabel = hash & IPV6_FLOWLABEL_MASK; 721 + flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK; 725 722 } 726 723 727 724 return flowlabel;
+2
include/net/netfilter/nf_tables.h
··· 530 530 531 531 int nft_chain_validate_dependency(const struct nft_chain *chain, 532 532 enum nft_chain_type type); 533 + int nft_chain_validate_hooks(const struct nft_chain *chain, 534 + unsigned int hook_flags); 533 535 534 536 struct nft_stats { 535 537 u64 bytes;
+1
include/net/netns/ipv4.h
··· 52 52 struct inet_peer_base *peers; 53 53 struct tcpm_hash_bucket *tcp_metrics_hash; 54 54 unsigned int tcp_metrics_hash_log; 55 + struct sock * __percpu *tcp_sk; 55 56 struct netns_frags frags; 56 57 #ifdef CONFIG_NETFILTER 57 58 struct xt_table *iptable_filter;
+5 -8
include/net/sch_generic.h
··· 79 79 struct netdev_queue *dev_queue; 80 80 81 81 struct gnet_stats_rate_est64 rate_est; 82 + struct gnet_stats_basic_cpu __percpu *cpu_bstats; 83 + struct gnet_stats_queue __percpu *cpu_qstats; 84 + 82 85 struct Qdisc *next_sched; 83 86 struct sk_buff *gso_skb; 84 87 /* ··· 89 86 */ 90 87 unsigned long state; 91 88 struct sk_buff_head q; 92 - union { 93 - struct gnet_stats_basic_packed bstats; 94 - struct gnet_stats_basic_cpu __percpu *cpu_bstats; 95 - } __packed; 89 + struct gnet_stats_basic_packed bstats; 96 90 unsigned int __state; 97 - union { 98 - struct gnet_stats_queue qstats; 99 - struct gnet_stats_queue __percpu *cpu_qstats; 100 - } __packed; 91 + struct gnet_stats_queue qstats; 101 92 struct rcu_head rcu_head; 102 93 int padded; 103 94 atomic_t refcnt;
+2 -2
include/net/tcp.h
··· 834 834 void tcp_get_allowed_congestion_control(char *buf, size_t len); 835 835 int tcp_set_allowed_congestion_control(char *allowed); 836 836 int tcp_set_congestion_control(struct sock *sk, const char *name); 837 - void tcp_slow_start(struct tcp_sock *tp, u32 acked); 838 - void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); 837 + u32 tcp_slow_start(struct tcp_sock *tp, u32 acked); 838 + void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked); 839 839 840 840 u32 tcp_reno_ssthresh(struct sock *sk); 841 841 void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);
+10 -2
lib/checksum.c
··· 181 181 EXPORT_SYMBOL(csum_partial_copy); 182 182 183 183 #ifndef csum_tcpudp_nofold 184 + static inline u32 from64to32(u64 x) 185 + { 186 + /* add up 32-bit and 32-bit for 32+c bit */ 187 + x = (x & 0xffffffff) + (x >> 32); 188 + /* add up carry.. */ 189 + x = (x & 0xffffffff) + (x >> 32); 190 + return (u32)x; 191 + } 192 + 184 193 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 185 194 unsigned short len, 186 195 unsigned short proto, ··· 204 195 #else 205 196 s += (proto + len) << 8; 206 197 #endif 207 - s += (s >> 32); 208 - return (__force __wsum)s; 198 + return (__force __wsum)from64to32(s); 209 199 } 210 200 EXPORT_SYMBOL(csum_tcpudp_nofold); 211 201 #endif
+6 -23
net/bridge/netfilter/nft_reject_bridge.c
··· 265 265 data[NFT_REG_VERDICT].verdict = NF_DROP; 266 266 } 267 267 268 - static int nft_reject_bridge_validate_hooks(const struct nft_chain *chain) 268 + static int nft_reject_bridge_validate(const struct nft_ctx *ctx, 269 + const struct nft_expr *expr, 270 + const struct nft_data **data) 269 271 { 270 - struct nft_base_chain *basechain; 271 - 272 - if (chain->flags & NFT_BASE_CHAIN) { 273 - basechain = nft_base_chain(chain); 274 - 275 - switch (basechain->ops[0].hooknum) { 276 - case NF_BR_PRE_ROUTING: 277 - case NF_BR_LOCAL_IN: 278 - break; 279 - default: 280 - return -EOPNOTSUPP; 281 - } 282 - } 283 - return 0; 272 + return nft_chain_validate_hooks(ctx->chain, (1 << NF_BR_PRE_ROUTING) | 273 + (1 << NF_BR_LOCAL_IN)); 284 274 } 285 275 286 276 static int nft_reject_bridge_init(const struct nft_ctx *ctx, ··· 280 290 struct nft_reject *priv = nft_expr_priv(expr); 281 291 int icmp_code, err; 282 292 283 - err = nft_reject_bridge_validate_hooks(ctx->chain); 293 + err = nft_reject_bridge_validate(ctx, expr, NULL); 284 294 if (err < 0) 285 295 return err; 286 296 ··· 329 339 330 340 nla_put_failure: 331 341 return -1; 332 - } 333 - 334 - static int nft_reject_bridge_validate(const struct nft_ctx *ctx, 335 - const struct nft_expr *expr, 336 - const struct nft_data **data) 337 - { 338 - return nft_reject_bridge_validate_hooks(ctx->chain); 339 342 } 340 343 341 344 static struct nft_expr_type nft_reject_bridge_type;
-1
net/caif/chnl_net.c
··· 470 470 ASSERT_RTNL(); 471 471 caifdev = netdev_priv(dev); 472 472 caif_netlink_parms(data, &caifdev->conn_req); 473 - dev_net_set(caifdev->netdev, src_net); 474 473 475 474 ret = register_netdevice(dev); 476 475 if (ret)
+4 -33
net/core/dev.c
··· 2352 2352 2353 2353 __be16 skb_network_protocol(struct sk_buff *skb, int *depth) 2354 2354 { 2355 - unsigned int vlan_depth = skb->mac_len; 2356 2355 __be16 type = skb->protocol; 2357 2356 2358 2357 /* Tunnel gso handlers can set protocol to ethernet. */ ··· 2365 2366 type = eth->h_proto; 2366 2367 } 2367 2368 2368 - /* if skb->protocol is 802.1Q/AD then the header should already be 2369 - * present at mac_len - VLAN_HLEN (if mac_len > 0), or at 2370 - * ETH_HLEN otherwise 2371 - */ 2372 - if (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) { 2373 - if (vlan_depth) { 2374 - if (WARN_ON(vlan_depth < VLAN_HLEN)) 2375 - return 0; 2376 - vlan_depth -= VLAN_HLEN; 2377 - } else { 2378 - vlan_depth = ETH_HLEN; 2379 - } 2380 - do { 2381 - struct vlan_hdr *vh; 2382 - 2383 - if (unlikely(!pskb_may_pull(skb, 2384 - vlan_depth + VLAN_HLEN))) 2385 - return 0; 2386 - 2387 - vh = (struct vlan_hdr *)(skb->data + vlan_depth); 2388 - type = vh->h_vlan_encapsulated_proto; 2389 - vlan_depth += VLAN_HLEN; 2390 - } while (type == htons(ETH_P_8021Q) || 2391 - type == htons(ETH_P_8021AD)); 2392 - } 2393 - 2394 - *depth = vlan_depth; 2395 - 2396 - return type; 2369 + return __vlan_get_protocol(skb, type, depth); 2397 2370 } 2398 2371 2399 2372 /** ··· 5294 5323 } 5295 5324 EXPORT_SYMBOL(netdev_upper_dev_unlink); 5296 5325 5297 - void netdev_adjacent_add_links(struct net_device *dev) 5326 + static void netdev_adjacent_add_links(struct net_device *dev) 5298 5327 { 5299 5328 struct netdev_adjacent *iter; 5300 5329 ··· 5319 5348 } 5320 5349 } 5321 5350 5322 - void netdev_adjacent_del_links(struct net_device *dev) 5351 + static void netdev_adjacent_del_links(struct net_device *dev) 5323 5352 { 5324 5353 struct netdev_adjacent *iter; 5325 5354 ··· 6627 6656 if (!queue) 6628 6657 return NULL; 6629 6658 netdev_init_one_queue(dev, queue, NULL); 6630 - queue->qdisc = &noop_qdisc; 6659 + RCU_INIT_POINTER(queue->qdisc, &noop_qdisc); 6631 6660 queue->qdisc_sleeping = &noop_qdisc; 6632 6661 rcu_assign_pointer(dev->ingress_queue, queue); 6633 6662 #endif
+5 -1
net/core/rtnetlink.c
··· 2895 2895 goto errout; 2896 2896 } 2897 2897 2898 + if (!skb->len) 2899 + goto errout; 2900 + 2898 2901 rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); 2899 2902 return 0; 2900 2903 errout: 2901 2904 WARN_ON(err == -EMSGSIZE); 2902 2905 kfree_skb(skb); 2903 - rtnl_set_sk_err(net, RTNLGRP_LINK, err); 2906 + if (err) 2907 + rtnl_set_sk_err(net, RTNLGRP_LINK, err); 2904 2908 return err; 2905 2909 } 2906 2910
+3 -26
net/ipv4/ip_output.c
··· 1506 1506 /* 1507 1507 * Generic function to send a packet as reply to another packet. 1508 1508 * Used to send some TCP resets/acks so far. 1509 - * 1510 - * Use a fake percpu inet socket to avoid false sharing and contention. 1511 1509 */ 1512 - static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = { 1513 - .sk = { 1514 - .__sk_common = { 1515 - .skc_refcnt = ATOMIC_INIT(1), 1516 - }, 1517 - .sk_wmem_alloc = ATOMIC_INIT(1), 1518 - .sk_allocation = GFP_ATOMIC, 1519 - .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE), 1520 - }, 1521 - .pmtudisc = IP_PMTUDISC_WANT, 1522 - .uc_ttl = -1, 1523 - }; 1524 - 1525 - void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, 1510 + void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, 1526 1511 const struct ip_options *sopt, 1527 1512 __be32 daddr, __be32 saddr, 1528 1513 const struct ip_reply_arg *arg, ··· 1517 1532 struct ipcm_cookie ipc; 1518 1533 struct flowi4 fl4; 1519 1534 struct rtable *rt = skb_rtable(skb); 1535 + struct net *net = sock_net(sk); 1520 1536 struct sk_buff *nskb; 1521 - struct sock *sk; 1522 - struct inet_sock *inet; 1523 1537 int err; 1524 1538 1525 1539 if (__ip_options_echo(&replyopts.opt.opt, skb, sopt)) ··· 1549 1565 if (IS_ERR(rt)) 1550 1566 return; 1551 1567 1552 - inet = &get_cpu_var(unicast_sock); 1568 + inet_sk(sk)->tos = arg->tos; 1553 1569 1554 - inet->tos = arg->tos; 1555 - sk = &inet->sk; 1556 1570 sk->sk_priority = skb->priority; 1557 1571 sk->sk_protocol = ip_hdr(skb)->protocol; 1558 1572 sk->sk_bound_dev_if = arg->bound_dev_if; 1559 - sock_net_set(sk, net); 1560 - __skb_queue_head_init(&sk->sk_write_queue); 1561 1573 sk->sk_sndbuf = sysctl_wmem_default; 1562 1574 err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, 1563 1575 len, 0, &ipc, &rt, MSG_DONTWAIT); ··· 1569 1589 arg->csumoffset) = csum_fold(csum_add(nskb->csum, 1570 1590 arg->csum)); 1571 1591 nskb->ip_summed = CHECKSUM_NONE; 1572 - skb_orphan(nskb); 1573 1592 skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb)); 1574 1593 ip_push_pending_frames(sk, &fl4); 1575 1594 } 1576 1595 out: 1577 - put_cpu_var(unicast_sock); 1578 - 1579 1596 ip_rt_put(rt); 1580 1597 } 1581 1598
+3
net/ipv4/route.c
··· 966 966 if (dst->dev->mtu < mtu) 967 967 return; 968 968 969 + if (rt->rt_pmtu && rt->rt_pmtu < mtu) 970 + return; 971 + 969 972 if (mtu < ip_rt_min_pmtu) 970 973 mtu = ip_rt_min_pmtu; 971 974
+1 -1
net/ipv4/tcp_bic.c
··· 150 150 tcp_slow_start(tp, acked); 151 151 else { 152 152 bictcp_update(ca, tp->snd_cwnd); 153 - tcp_cong_avoid_ai(tp, ca->cnt); 153 + tcp_cong_avoid_ai(tp, ca->cnt, 1); 154 154 } 155 155 } 156 156
+20 -12
net/ipv4/tcp_cong.c
··· 291 291 * ABC caps N to 2. Slow start exits when cwnd grows over ssthresh and 292 292 * returns the leftover acks to adjust cwnd in congestion avoidance mode. 293 293 */ 294 - void tcp_slow_start(struct tcp_sock *tp, u32 acked) 294 + u32 tcp_slow_start(struct tcp_sock *tp, u32 acked) 295 295 { 296 296 u32 cwnd = tp->snd_cwnd + acked; 297 297 298 298 if (cwnd > tp->snd_ssthresh) 299 299 cwnd = tp->snd_ssthresh + 1; 300 + acked -= cwnd - tp->snd_cwnd; 300 301 tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp); 302 + 303 + return acked; 301 304 } 302 305 EXPORT_SYMBOL_GPL(tcp_slow_start); 303 306 304 - /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */ 305 - void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w) 307 + /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w), 308 + * for every packet that was ACKed. 309 + */ 310 + void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) 306 311 { 312 + tp->snd_cwnd_cnt += acked; 307 313 if (tp->snd_cwnd_cnt >= w) { 308 - if (tp->snd_cwnd < tp->snd_cwnd_clamp) 309 - tp->snd_cwnd++; 310 - tp->snd_cwnd_cnt = 0; 311 - } else { 312 - tp->snd_cwnd_cnt++; 314 + u32 delta = tp->snd_cwnd_cnt / w; 315 + 316 + tp->snd_cwnd_cnt -= delta * w; 317 + tp->snd_cwnd += delta; 313 318 } 319 + tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_cwnd_clamp); 314 320 } 315 321 EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai); 316 322 ··· 335 329 return; 336 330 337 331 /* In "safe" area, increase. */ 338 - if (tp->snd_cwnd <= tp->snd_ssthresh) 339 - tcp_slow_start(tp, acked); 332 + if (tp->snd_cwnd <= tp->snd_ssthresh) { 333 + acked = tcp_slow_start(tp, acked); 334 + if (!acked) 335 + return; 336 + } 340 337 /* In dangerous area, increase slowly. */ 341 - else 342 - tcp_cong_avoid_ai(tp, tp->snd_cwnd); 338 + tcp_cong_avoid_ai(tp, tp->snd_cwnd, acked); 343 339 } 344 340 EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); 345 341
+17 -22
net/ipv4/tcp_cubic.c
··· 93 93 u32 epoch_start; /* beginning of an epoch */ 94 94 u32 ack_cnt; /* number of acks */ 95 95 u32 tcp_cwnd; /* estimated tcp cwnd */ 96 - #define ACK_RATIO_SHIFT 4 97 - #define ACK_RATIO_LIMIT (32u << ACK_RATIO_SHIFT) 98 - u16 delayed_ack; /* estimate the ratio of Packets/ACKs << 4 */ 96 + u16 unused; 99 97 u8 sample_cnt; /* number of samples to decide curr_rtt */ 100 98 u8 found; /* the exit point is found? */ 101 99 u32 round_start; /* beginning of each round */ ··· 112 114 ca->bic_K = 0; 113 115 ca->delay_min = 0; 114 116 ca->epoch_start = 0; 115 - ca->delayed_ack = 2 << ACK_RATIO_SHIFT; 116 117 ca->ack_cnt = 0; 117 118 ca->tcp_cwnd = 0; 118 119 ca->found = 0; ··· 202 205 /* 203 206 * Compute congestion window to use. 204 207 */ 205 - static inline void bictcp_update(struct bictcp *ca, u32 cwnd) 208 + static inline void bictcp_update(struct bictcp *ca, u32 cwnd, u32 acked) 206 209 { 207 210 u32 delta, bic_target, max_cnt; 208 211 u64 offs, t; 209 212 210 - ca->ack_cnt++; /* count the number of ACKs */ 213 + ca->ack_cnt += acked; /* count the number of ACKed packets */ 211 214 212 215 if (ca->last_cwnd == cwnd && 213 216 (s32)(tcp_time_stamp - ca->last_time) <= HZ / 32) 214 217 return; 218 + 219 + /* The CUBIC function can update ca->cnt at most once per jiffy. 220 + * On all cwnd reduction events, ca->epoch_start is set to 0, 221 + * which will force a recalculation of ca->cnt. 222 + */ 223 + if (ca->epoch_start && tcp_time_stamp == ca->last_time) 224 + goto tcp_friendliness; 215 225 216 226 ca->last_cwnd = cwnd; 217 227 ca->last_time = tcp_time_stamp; 218 228 219 229 if (ca->epoch_start == 0) { 220 230 ca->epoch_start = tcp_time_stamp; /* record beginning */ 221 - ca->ack_cnt = 1; /* start counting */ 231 + ca->ack_cnt = acked; /* start counting */ 222 232 ca->tcp_cwnd = cwnd; /* syn with cubic */ 223 233 224 234 if (ca->last_max_cwnd <= cwnd) { ··· 287 283 if (ca->last_max_cwnd == 0 && ca->cnt > 20) 288 284 ca->cnt = 20; /* increase cwnd 5% per RTT */ 289 285 286 + tcp_friendliness: 290 287 /* TCP Friendly */ 291 288 if (tcp_friendliness) { 292 289 u32 scale = beta_scale; ··· 306 301 } 307 302 } 308 303 309 - ca->cnt = (ca->cnt << ACK_RATIO_SHIFT) / ca->delayed_ack; 310 304 if (ca->cnt == 0) /* cannot be zero */ 311 305 ca->cnt = 1; 312 306 } ··· 321 317 if (tp->snd_cwnd <= tp->snd_ssthresh) { 322 318 if (hystart && after(ack, ca->end_seq)) 323 319 bictcp_hystart_reset(sk); 324 - tcp_slow_start(tp, acked); 325 - } else { 326 - bictcp_update(ca, tp->snd_cwnd); 327 - tcp_cong_avoid_ai(tp, ca->cnt); 320 + acked = tcp_slow_start(tp, acked); 321 + if (!acked) 322 + return; 328 323 } 324 + bictcp_update(ca, tp->snd_cwnd, acked); 325 + tcp_cong_avoid_ai(tp, ca->cnt, acked); 329 326 } 330 327 331 328 static u32 bictcp_recalc_ssthresh(struct sock *sk) ··· 416 411 */ 417 412 static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) 418 413 { 419 - const struct inet_connection_sock *icsk = inet_csk(sk); 420 414 const struct tcp_sock *tp = tcp_sk(sk); 421 415 struct bictcp *ca = inet_csk_ca(sk); 422 416 u32 delay; 423 - 424 - if (icsk->icsk_ca_state == TCP_CA_Open) { 425 - u32 ratio = ca->delayed_ack; 426 - 427 - ratio -= ca->delayed_ack >> ACK_RATIO_SHIFT; 428 - ratio += cnt; 429 - 430 - ca->delayed_ack = clamp(ratio, 1U, ACK_RATIO_LIMIT); 431 - } 432 417 433 418 /* Some calls are for duplicates without timetamps */ 434 419 if (rtt_us < 0)
+35 -8
net/ipv4/tcp_ipv4.c
··· 683 683 arg.bound_dev_if = sk->sk_bound_dev_if; 684 684 685 685 arg.tos = ip_hdr(skb)->tos; 686 - ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt, 686 + ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), 687 + skb, &TCP_SKB_CB(skb)->header.h4.opt, 687 688 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, 688 689 &arg, arg.iov[0].iov_len); 689 690 ··· 768 767 if (oif) 769 768 arg.bound_dev_if = oif; 770 769 arg.tos = tos; 771 - ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt, 770 + ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), 771 + skb, &TCP_SKB_CB(skb)->header.h4.opt, 772 772 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, 773 773 &arg, arg.iov[0].iov_len); 774 774 ··· 2430 2428 }; 2431 2429 EXPORT_SYMBOL(tcp_prot); 2432 2430 2433 - static int __net_init tcp_sk_init(struct net *net) 2434 - { 2435 - net->ipv4.sysctl_tcp_ecn = 2; 2436 - return 0; 2437 - } 2438 - 2439 2431 static void __net_exit tcp_sk_exit(struct net *net) 2440 2432 { 2433 + int cpu; 2434 + 2435 + for_each_possible_cpu(cpu) 2436 + inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu)); 2437 + free_percpu(net->ipv4.tcp_sk); 2438 + } 2439 + 2440 + static int __net_init tcp_sk_init(struct net *net) 2441 + { 2442 + int res, cpu; 2443 + 2444 + net->ipv4.tcp_sk = alloc_percpu(struct sock *); 2445 + if (!net->ipv4.tcp_sk) 2446 + return -ENOMEM; 2447 + 2448 + for_each_possible_cpu(cpu) { 2449 + struct sock *sk; 2450 + 2451 + res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW, 2452 + IPPROTO_TCP, net); 2453 + if (res) 2454 + goto fail; 2455 + *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk; 2456 + } 2457 + net->ipv4.sysctl_tcp_ecn = 2; 2458 + return 0; 2459 + 2460 + fail: 2461 + tcp_sk_exit(net); 2462 + 2463 + return res; 2441 2464 } 2442 2465 2443 2466 static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
+2 -1
net/ipv4/tcp_scalable.c
··· 25 25 if (tp->snd_cwnd <= tp->snd_ssthresh) 26 26 tcp_slow_start(tp, acked); 27 27 else 28 - tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)); 28 + tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT), 29 + 1); 29 30 } 30 31 31 32 static u32 tcp_scalable_ssthresh(struct sock *sk)
+1 -1
net/ipv4/tcp_veno.c
··· 159 159 /* In the "non-congestive state", increase cwnd 160 160 * every rtt. 161 161 */ 162 - tcp_cong_avoid_ai(tp, tp->snd_cwnd); 162 + tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); 163 163 } else { 164 164 /* In the "congestive state", increase cwnd 165 165 * every other rtt.
+1 -1
net/ipv4/tcp_yeah.c
··· 92 92 93 93 } else { 94 94 /* Reno */ 95 - tcp_cong_avoid_ai(tp, tp->snd_cwnd); 95 + tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); 96 96 } 97 97 98 98 /* The key players are v_vegas.beg_snd_una and v_beg_snd_nxt.
+2 -2
net/ipv6/ip6_gre.c
··· 417 417 if (code == ICMPV6_HDR_FIELD) 418 418 teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data); 419 419 420 - if (teli && teli == info - 2) { 420 + if (teli && teli == be32_to_cpu(info) - 2) { 421 421 tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli]; 422 422 if (tel->encap_limit == 0) { 423 423 net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n", ··· 429 429 } 430 430 break; 431 431 case ICMPV6_PKT_TOOBIG: 432 - mtu = info - offset; 432 + mtu = be32_to_cpu(info) - offset; 433 433 if (mtu < IPV6_MIN_MTU) 434 434 mtu = IPV6_MIN_MTU; 435 435 t->dev->mtu = mtu;
-14
net/ipv6/ip6_output.c
··· 537 537 skb_copy_secmark(to, from); 538 538 } 539 539 540 - static void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) 541 - { 542 - static u32 ip6_idents_hashrnd __read_mostly; 543 - u32 hash, id; 544 - 545 - net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); 546 - 547 - hash = __ipv6_addr_jhash(&rt->rt6i_dst.addr, ip6_idents_hashrnd); 548 - hash = __ipv6_addr_jhash(&rt->rt6i_src.addr, hash); 549 - 550 - id = ip_idents_reserve(hash, 1); 551 - fhdr->identification = htonl(id); 552 - } 553 - 554 540 int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) 555 541 { 556 542 struct sk_buff *frag;
+35 -6
net/ipv6/output_core.c
··· 9 9 #include <net/addrconf.h> 10 10 #include <net/secure_seq.h> 11 11 12 + u32 __ipv6_select_ident(u32 hashrnd, struct in6_addr *dst, struct in6_addr *src) 13 + { 14 + u32 hash, id; 15 + 16 + hash = __ipv6_addr_jhash(dst, hashrnd); 17 + hash = __ipv6_addr_jhash(src, hash); 18 + 19 + /* Treat id of 0 as unset and if we get 0 back from ip_idents_reserve, 20 + * set the hight order instead thus minimizing possible future 21 + * collisions. 22 + */ 23 + id = ip_idents_reserve(hash, 1); 24 + if (unlikely(!id)) 25 + id = 1 << 31; 26 + 27 + return id; 28 + } 29 + 12 30 /* This function exists only for tap drivers that must support broken 13 31 * clients requesting UFO without specifying an IPv6 fragment ID. 14 32 * ··· 40 22 static u32 ip6_proxy_idents_hashrnd __read_mostly; 41 23 struct in6_addr buf[2]; 42 24 struct in6_addr *addrs; 43 - u32 hash, id; 25 + u32 id; 44 26 45 27 addrs = skb_header_pointer(skb, 46 28 skb_network_offset(skb) + ··· 52 34 net_get_random_once(&ip6_proxy_idents_hashrnd, 53 35 sizeof(ip6_proxy_idents_hashrnd)); 54 36 55 - hash = __ipv6_addr_jhash(&addrs[1], ip6_proxy_idents_hashrnd); 56 - hash = __ipv6_addr_jhash(&addrs[0], hash); 57 - 58 - id = ip_idents_reserve(hash, 1); 59 - skb_shinfo(skb)->ip6_frag_id = htonl(id); 37 + id = __ipv6_select_ident(ip6_proxy_idents_hashrnd, 38 + &addrs[1], &addrs[0]); 39 + skb_shinfo(skb)->ip6_frag_id = id; 60 40 } 61 41 EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); 42 + 43 + void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) 44 + { 45 + static u32 ip6_idents_hashrnd __read_mostly; 46 + u32 id; 47 + 48 + net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); 49 + 50 + id = __ipv6_select_ident(ip6_idents_hashrnd, &rt->rt6i_dst.addr, 51 + &rt->rt6i_src.addr); 52 + fhdr->identification = htonl(id); 53 + } 54 + EXPORT_SYMBOL(ipv6_select_ident); 62 55 63 56 int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) 64 57 {
+4 -4
net/ipv6/sit.c
··· 1506 1506 1507 1507 if (data[IFLA_IPTUN_ENCAP_SPORT]) { 1508 1508 ret = true; 1509 - ipencap->sport = nla_get_u16(data[IFLA_IPTUN_ENCAP_SPORT]); 1509 + ipencap->sport = nla_get_be16(data[IFLA_IPTUN_ENCAP_SPORT]); 1510 1510 } 1511 1511 1512 1512 if (data[IFLA_IPTUN_ENCAP_DPORT]) { 1513 1513 ret = true; 1514 - ipencap->dport = nla_get_u16(data[IFLA_IPTUN_ENCAP_DPORT]); 1514 + ipencap->dport = nla_get_be16(data[IFLA_IPTUN_ENCAP_DPORT]); 1515 1515 } 1516 1516 1517 1517 return ret; ··· 1707 1707 1708 1708 if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, 1709 1709 tunnel->encap.type) || 1710 - nla_put_u16(skb, IFLA_IPTUN_ENCAP_SPORT, 1710 + nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, 1711 1711 tunnel->encap.sport) || 1712 - nla_put_u16(skb, IFLA_IPTUN_ENCAP_DPORT, 1712 + nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, 1713 1713 tunnel->encap.dport) || 1714 1714 nla_put_u16(skb, IFLA_IPTUN_ENCAP_FLAGS, 1715 1715 tunnel->encap.flags))
+9 -1
net/ipv6/udp_offload.c
··· 52 52 53 53 skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); 54 54 55 + /* Set the IPv6 fragment id if not set yet */ 56 + if (!skb_shinfo(skb)->ip6_frag_id) 57 + ipv6_proxy_select_ident(skb); 58 + 55 59 segs = NULL; 56 60 goto out; 57 61 } ··· 112 108 fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); 113 109 fptr->nexthdr = nexthdr; 114 110 fptr->reserved = 0; 115 - fptr->identification = skb_shinfo(skb)->ip6_frag_id; 111 + if (skb_shinfo(skb)->ip6_frag_id) 112 + fptr->identification = skb_shinfo(skb)->ip6_frag_id; 113 + else 114 + ipv6_select_ident(fptr, 115 + (struct rt6_info *)skb_dst(skb)); 116 116 117 117 /* Fragment the skb. ipv6 header and the remaining fields of the 118 118 * fragment header are updated in ipv6_gso_segment()
+22 -11
net/netfilter/ipvs/ip_vs_core.c
··· 659 659 return err; 660 660 } 661 661 662 - static int ip_vs_route_me_harder(int af, struct sk_buff *skb) 662 + static int ip_vs_route_me_harder(int af, struct sk_buff *skb, 663 + unsigned int hooknum) 663 664 { 665 + if (!sysctl_snat_reroute(skb)) 666 + return 0; 667 + /* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */ 668 + if (NF_INET_LOCAL_IN == hooknum) 669 + return 0; 664 670 #ifdef CONFIG_IP_VS_IPV6 665 671 if (af == AF_INET6) { 666 - if (sysctl_snat_reroute(skb) && ip6_route_me_harder(skb) != 0) 672 + struct dst_entry *dst = skb_dst(skb); 673 + 674 + if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && 675 + ip6_route_me_harder(skb) != 0) 667 676 return 1; 668 677 } else 669 678 #endif 670 - if ((sysctl_snat_reroute(skb) || 671 - skb_rtable(skb)->rt_flags & RTCF_LOCAL) && 679 + if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && 672 680 ip_route_me_harder(skb, RTN_LOCAL) != 0) 673 681 return 1; 674 682 ··· 799 791 union nf_inet_addr *snet, 800 792 __u8 protocol, struct ip_vs_conn *cp, 801 793 struct ip_vs_protocol *pp, 802 - unsigned int offset, unsigned int ihl) 794 + unsigned int offset, unsigned int ihl, 795 + unsigned int hooknum) 803 796 { 804 797 unsigned int verdict = NF_DROP; 805 798 ··· 830 821 #endif 831 822 ip_vs_nat_icmp(skb, pp, cp, 1); 832 823 833 - if (ip_vs_route_me_harder(af, skb)) 824 + if (ip_vs_route_me_harder(af, skb, hooknum)) 834 825 goto out; 835 826 836 827 /* do the statistics and put it back */ ··· 925 916 926 917 snet.ip = iph->saddr; 927 918 return handle_response_icmp(AF_INET, skb, &snet, cih->protocol, cp, 928 - pp, ciph.len, ihl); 919 + pp, ciph.len, ihl, hooknum); 929 920 } 930 921 931 922 #ifdef CONFIG_IP_VS_IPV6 ··· 990 981 snet.in6 = ciph.saddr.in6; 991 982 writable = ciph.len; 992 983 return handle_response_icmp(AF_INET6, skb, &snet, ciph.protocol, cp, 993 - pp, writable, sizeof(struct ipv6hdr)); 984 + pp, writable, sizeof(struct ipv6hdr), 985 + hooknum); 994 986 } 995 987 #endif 996 988 ··· 1050 1040 */ 1051 1041 static unsigned int 1052 1042 handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, 1053 - struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) 1043 + struct ip_vs_conn *cp, struct ip_vs_iphdr *iph, 1044 + unsigned int hooknum) 1054 1045 { 1055 1046 struct ip_vs_protocol *pp = pd->pp; 1056 1047 ··· 1089 1078 * if it came from this machine itself. So re-compute 1090 1079 * the routing information. 1091 1080 */ 1092 - if (ip_vs_route_me_harder(af, skb)) 1081 + if (ip_vs_route_me_harder(af, skb, hooknum)) 1093 1082 goto drop; 1094 1083 1095 1084 IP_VS_DBG_PKT(10, af, pp, skb, 0, "After SNAT"); ··· 1192 1181 cp = pp->conn_out_get(af, skb, &iph, 0); 1193 1182 1194 1183 if (likely(cp)) 1195 - return handle_response(af, skb, pd, cp, &iph); 1184 + return handle_response(af, skb, pd, cp, &iph, hooknum); 1196 1185 if (sysctl_nat_icmp_send(net) && 1197 1186 (pp->protocol == IPPROTO_TCP || 1198 1187 pp->protocol == IPPROTO_UDP ||
+26 -2
net/netfilter/nf_tables_api.c
··· 1134 1134 /* Restore old counters on this cpu, no problem. Per-cpu statistics 1135 1135 * are not exposed to userspace. 1136 1136 */ 1137 + preempt_disable(); 1137 1138 stats = this_cpu_ptr(newstats); 1138 1139 stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES])); 1139 1140 stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS])); 1141 + preempt_enable(); 1140 1142 1141 1143 return newstats; 1142 1144 } ··· 1264 1262 nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); 1265 1263 trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN, 1266 1264 sizeof(struct nft_trans_chain)); 1267 - if (trans == NULL) 1265 + if (trans == NULL) { 1266 + free_percpu(stats); 1268 1267 return -ENOMEM; 1268 + } 1269 1269 1270 1270 nft_trans_chain_stats(trans) = stats; 1271 1271 nft_trans_chain_update(trans) = true; ··· 1323 1319 hookfn = type->hooks[hooknum]; 1324 1320 1325 1321 basechain = kzalloc(sizeof(*basechain), GFP_KERNEL); 1326 - if (basechain == NULL) 1322 + if (basechain == NULL) { 1323 + module_put(type->owner); 1327 1324 return -ENOMEM; 1325 + } 1328 1326 1329 1327 if (nla[NFTA_CHAIN_COUNTERS]) { 1330 1328 stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]); ··· 3758 3752 return 0; 3759 3753 } 3760 3754 EXPORT_SYMBOL_GPL(nft_chain_validate_dependency); 3755 + 3756 + int nft_chain_validate_hooks(const struct nft_chain *chain, 3757 + unsigned int hook_flags) 3758 + { 3759 + struct nft_base_chain *basechain; 3760 + 3761 + if (chain->flags & NFT_BASE_CHAIN) { 3762 + basechain = nft_base_chain(chain); 3763 + 3764 + if ((1 << basechain->ops[0].hooknum) & hook_flags) 3765 + return 0; 3766 + 3767 + return -EOPNOTSUPP; 3768 + } 3769 + 3770 + return 0; 3771 + } 3772 + EXPORT_SYMBOL_GPL(nft_chain_validate_hooks); 3761 3773 3762 3774 /* 3763 3775 * Loop detection - walk through the ruleset beginning at the destination chain
+17 -9
net/netfilter/nft_masq.c
··· 21 21 }; 22 22 EXPORT_SYMBOL_GPL(nft_masq_policy); 23 23 24 + int nft_masq_validate(const struct nft_ctx *ctx, 25 + const struct nft_expr *expr, 26 + const struct nft_data **data) 27 + { 28 + int err; 29 + 30 + err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 31 + if (err < 0) 32 + return err; 33 + 34 + return nft_chain_validate_hooks(ctx->chain, 35 + (1 << NF_INET_POST_ROUTING)); 36 + } 37 + EXPORT_SYMBOL_GPL(nft_masq_validate); 38 + 24 39 int nft_masq_init(const struct nft_ctx *ctx, 25 40 const struct nft_expr *expr, 26 41 const struct nlattr * const tb[]) ··· 43 28 struct nft_masq *priv = nft_expr_priv(expr); 44 29 int err; 45 30 46 - err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 47 - if (err < 0) 31 + err = nft_masq_validate(ctx, expr, NULL); 32 + if (err) 48 33 return err; 49 34 50 35 if (tb[NFTA_MASQ_FLAGS] == NULL) ··· 74 59 return -1; 75 60 } 76 61 EXPORT_SYMBOL_GPL(nft_masq_dump); 77 - 78 - int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, 79 - const struct nft_data **data) 80 - { 81 - return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 82 - } 83 - EXPORT_SYMBOL_GPL(nft_masq_validate); 84 62 85 63 MODULE_LICENSE("GPL"); 86 64 MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>");
+31 -11
net/netfilter/nft_nat.c
··· 88 88 [NFTA_NAT_FLAGS] = { .type = NLA_U32 }, 89 89 }; 90 90 91 + static int nft_nat_validate(const struct nft_ctx *ctx, 92 + const struct nft_expr *expr, 93 + const struct nft_data **data) 94 + { 95 + struct nft_nat *priv = nft_expr_priv(expr); 96 + int err; 97 + 98 + err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 99 + if (err < 0) 100 + return err; 101 + 102 + switch (priv->type) { 103 + case NFT_NAT_SNAT: 104 + err = nft_chain_validate_hooks(ctx->chain, 105 + (1 << NF_INET_POST_ROUTING) | 106 + (1 << NF_INET_LOCAL_IN)); 107 + break; 108 + case NFT_NAT_DNAT: 109 + err = nft_chain_validate_hooks(ctx->chain, 110 + (1 << NF_INET_PRE_ROUTING) | 111 + (1 << NF_INET_LOCAL_OUT)); 112 + break; 113 + } 114 + 115 + return err; 116 + } 117 + 91 118 static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, 92 119 const struct nlattr * const tb[]) 93 120 { 94 121 struct nft_nat *priv = nft_expr_priv(expr); 95 122 u32 family; 96 123 int err; 97 - 98 - err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 99 - if (err < 0) 100 - return err; 101 124 102 125 if (tb[NFTA_NAT_TYPE] == NULL || 103 126 (tb[NFTA_NAT_REG_ADDR_MIN] == NULL && ··· 137 114 default: 138 115 return -EINVAL; 139 116 } 117 + 118 + err = nft_nat_validate(ctx, expr, NULL); 119 + if (err < 0) 120 + return err; 140 121 141 122 if (tb[NFTA_NAT_FAMILY] == NULL) 142 123 return -EINVAL; ··· 244 217 245 218 nla_put_failure: 246 219 return -1; 247 - } 248 - 249 - static int nft_nat_validate(const struct nft_ctx *ctx, 250 - const struct nft_expr *expr, 251 - const struct nft_data **data) 252 - { 253 - return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 254 220 } 255 221 256 222 static struct nft_expr_type nft_nat_type;
+17 -8
net/netfilter/nft_redir.c
··· 23 23 }; 24 24 EXPORT_SYMBOL_GPL(nft_redir_policy); 25 25 26 + int nft_redir_validate(const struct nft_ctx *ctx, 27 + const struct nft_expr *expr, 28 + const struct nft_data **data) 29 + { 30 + int err; 31 + 32 + err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 33 + if (err < 0) 34 + return err; 35 + 36 + return nft_chain_validate_hooks(ctx->chain, 37 + (1 << NF_INET_PRE_ROUTING) | 38 + (1 << NF_INET_LOCAL_OUT)); 39 + } 40 + EXPORT_SYMBOL_GPL(nft_redir_validate); 41 + 26 42 int nft_redir_init(const struct nft_ctx *ctx, 27 43 const struct nft_expr *expr, 28 44 const struct nlattr * const tb[]) ··· 46 30 struct nft_redir *priv = nft_expr_priv(expr); 47 31 int err; 48 32 49 - err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 33 + err = nft_redir_validate(ctx, expr, NULL); 50 34 if (err < 0) 51 35 return err; 52 36 ··· 103 87 return -1; 104 88 } 105 89 EXPORT_SYMBOL_GPL(nft_redir_dump); 106 - 107 - int nft_redir_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, 108 - const struct nft_data **data) 109 - { 110 - return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 111 - } 112 - EXPORT_SYMBOL_GPL(nft_redir_validate); 113 90 114 91 MODULE_LICENSE("GPL"); 115 92 MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>");
+2 -2
net/netlink/af_netlink.c
··· 1438 1438 1439 1439 for (undo = 0; undo < group; undo++) 1440 1440 if (test_bit(undo, &groups)) 1441 - nlk->netlink_unbind(sock_net(sk), undo); 1441 + nlk->netlink_unbind(sock_net(sk), undo + 1); 1442 1442 } 1443 1443 1444 1444 static int netlink_bind(struct socket *sock, struct sockaddr *addr, ··· 1476 1476 for (group = 0; group < nlk->ngroups; group++) { 1477 1477 if (!test_bit(group, &groups)) 1478 1478 continue; 1479 - err = nlk->netlink_bind(net, group); 1479 + err = nlk->netlink_bind(net, group + 1); 1480 1480 if (!err) 1481 1481 continue; 1482 1482 netlink_undo_bind(group, groups, sk);
+2 -2
net/rds/sysctl.c
··· 71 71 { 72 72 .procname = "max_unacked_packets", 73 73 .data = &rds_sysctl_max_unacked_packets, 74 - .maxlen = sizeof(unsigned long), 74 + .maxlen = sizeof(int), 75 75 .mode = 0644, 76 76 .proc_handler = proc_dointvec, 77 77 }, 78 78 { 79 79 .procname = "max_unacked_bytes", 80 80 .data = &rds_sysctl_max_unacked_bytes, 81 - .maxlen = sizeof(unsigned long), 81 + .maxlen = sizeof(int), 82 82 .mode = 0644, 83 83 .proc_handler = proc_dointvec, 84 84 },
+4 -3
net/sched/cls_api.c
··· 556 556 } 557 557 EXPORT_SYMBOL(tcf_exts_change); 558 558 559 - #define tcf_exts_first_act(ext) \ 560 - list_first_entry(&(exts)->actions, struct tc_action, list) 559 + #define tcf_exts_first_act(ext) \ 560 + list_first_entry_or_null(&(exts)->actions, \ 561 + struct tc_action, list) 561 562 562 563 int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) 563 564 { ··· 604 603 { 605 604 #ifdef CONFIG_NET_CLS_ACT 606 605 struct tc_action *a = tcf_exts_first_act(exts); 607 - if (tcf_action_copy_stats(skb, a, 1) < 0) 606 + if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0) 608 607 return -1; 609 608 #endif 610 609 return 0;
+8 -2
net/sched/sch_fq.c
··· 670 670 if (tb[TCA_FQ_FLOW_PLIMIT]) 671 671 q->flow_plimit = nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]); 672 672 673 - if (tb[TCA_FQ_QUANTUM]) 674 - q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); 673 + if (tb[TCA_FQ_QUANTUM]) { 674 + u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); 675 + 676 + if (quantum > 0) 677 + q->quantum = quantum; 678 + else 679 + err = -EINVAL; 680 + } 675 681 676 682 if (tb[TCA_FQ_INITIAL_QUANTUM]) 677 683 q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]);
+1 -1
net/sctp/sm_make_chunk.c
··· 2608 2608 2609 2609 addr_param = param.v + sizeof(sctp_addip_param_t); 2610 2610 2611 - af = sctp_get_af_specific(param_type2af(param.p->type)); 2611 + af = sctp_get_af_specific(param_type2af(addr_param->p.type)); 2612 2612 if (af == NULL) 2613 2613 break; 2614 2614