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:
"Sorry I let so much accumulate, I was in Buffalo and wanted a few
things to cook in my tree for a while before sending to you. Anyways,
it's a lot of little things as usual at this stage in the game"

1) Make bonding MAINTAINERS entry reflect reality, from Andy
Gospodarek.

2) Fix accidental sock_put() on timewait mini sockets, from Eric
Dumazet.

3) Fix crashes in l2tp due to mis-handling of ipv4 mapped ipv6
addresses, from François CACHEREUL.

4) Fix heap overflow in __audit_sockaddr(), from the eagle eyed Dan
Carpenter.

5) tcp_shifted_skb() doesn't take handle FINs properly, from Eric
Dumazet.

6) SFC driver bug fixes from Ben Hutchings.

7) Fix TX packet scheduling wedge after channel change in ath9k driver,
from Felix Fietkau.

8) Fix user after free in BPF JIT code, from Alexei Starovoitov.

9) Source address selection test is reversed in
__ip_route_output_key(), fix from Jiri Benc.

10) VLAN and CAN layer mis-size netlink attributes, from Marc
Kleine-Budde.

11) Fix permission checks in sysctls to use current_euid() instead of
current_uid(). From Eric W Biederman.

12) IPSEC policies can go away while a timer is still pending for them,
add appropriate ref-counting to fix, from Steffen Klassert.

13) Fix mis-programming of FDR and RMCR registers on R8A7740 sh_eth
chips, from Nguyen Hong Ky and Simon Horman.

14) MLX4 forgets to DMA unmap pages on RX, fix from Amir Vadai.

15) IPV6 GRE tunnel MTU upper limit is miscalculated, from Oussama
Ghorbel.

16) Fix typo in fq_change(), we were assigning "initial quantum" to
"quantum". From Eric Dumazet.

17) Set a more appropriate sk_pacing_rate for non-TCP sockets, otherwise
FQ packet scheduler does not pace those flows properly. Also from
Eric Dumazet.

18) rtlwifi miscalculates packet pointers, from Mark Cave-Ayland.

19) l2tp_xmit_skb() can be called from process context, not just softirq
context, so we must always make sure to BH disable around it. From
Eric Dumazet.

20) On qdisc reset, we forget to purge the RB tree of SKBs in netem
packet scheduler. From Stephen Hemminger.

21) Fix info leak in farsync WAN driver ioctl() handler, from Dan
Carpenter and Salva Peiró.

22) Fix PHY reset and other issues in dm9000 driver, from Nikita
Kiryanov and Michael Abbott.

23) When hardware can do SCTP crc32 checksums, we accidently don't
disable the csum offload when IPSEC transformations have been
applied. From Fan Du and Vlad Yasevich.

24) Tail loss probing in TCP leaves the socket in the wrong congestion
avoidance state. From Yuchung Cheng.

25) In CPSW driver, enable NAPI before interrupts are turned on, from
Markus Pargmann.

26) Integer underflow and dual-assignment in YAM hamradio driver, from
Dan Carpenter.

27) If we are going to mangle a packet in tcp_set_skb_tso_segs() we must
unclone it. This fixes various hard to track down crashes in
drivers where the SKBs ->gso_segs was changing right from underneath
the driver during TX queueing. From Eric Dumazet.

28) Fix the handling of VLAN IDs, and in particular the special IDs 0
and 4095, in the bridging layer. From Toshiaki Makita.

29) Another info leak, this time in wanxl WAN driver, from Salva Peiró.

30) Fix race in socket credential passing, from Daniel Borkmann.

31) WHen NETLABEL is disabled, we don't validate CIPSO packets properly,
from Seif Mazareeb.

32) Fix identification of fragmented frames in ipv4/ipv6 UDP
Fragmentation Offload output paths, from Jiri Pirko.

33) Virtual Function fixes in bnx2x driver from Yuval Mintz and Ariel
Elior.

34) When we removed the explicit neighbour pointer from ipv6 routes a
slight regression was introduced for users such as IPVS, xt_TEE, and
raw sockets. We mix up the users requested destination address with
the routes assigned nexthop/gateway. From Julian Anastasov and
Simon Horman.

35) Fix stack overruns in rt6_probe(), the issue is that can end up
doing two full packet xmit paths at the same time when emitting
neighbour discovery messages. From Hannes Frederic Sowa.

36) davinci_emac driver doesn't handle IFF_ALLMULTI correctly, from
Mariusz Ceier.

37) Make sure to set TCP sk_pacing_rate after the first legitimate RTT
sample, from Neal Cardwell.

38) Wrong netlink attribute passed to xfrm_replay_verify_len(), from
Steffen Klassert.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (152 commits)
ax88179_178a: Add VID:DID for Samsung USB Ethernet Adapter
ax88179_178a: Correct the RX error definition in RX header
Revert "bridge: only expire the mdb entry when query is received"
tcp: initialize passive-side sk_pacing_rate after 3WHS
davinci_emac.c: Fix IFF_ALLMULTI setup
mac802154: correct a typo in ieee802154_alloc_device() prototype
ipv6: probe routes asynchronous in rt6_probe
netfilter: nf_conntrack: fix rt6i_gateway checks for H.323 helper
ipv6: fill rt6i_gateway with nexthop address
ipv6: always prefer rt6i_gateway if present
bnx2x: Set NETIF_F_HIGHDMA unconditionally
bnx2x: Don't pretend during register dump
bnx2x: Lock DMAE when used by statistic flow
bnx2x: Prevent null pointer dereference on error flow
bnx2x: Fix config when SR-IOV and iSCSI are enabled
bnx2x: Fix Coalescing configuration
bnx2x: Unlock VF-PF channel on MAC/VLAN config error
bnx2x: Prevent an illegal pointer dereference during panic
bnx2x: Fix Maximum CoS estimation for VFs
drivers: net: cpsw: fix kernel warn during iperf test with interrupt pacing
...

+1312 -716
+1 -1
Documentation/connector/ucon.c
··· 71 71 nlh->nlmsg_seq = seq++; 72 72 nlh->nlmsg_pid = getpid(); 73 73 nlh->nlmsg_type = NLMSG_DONE; 74 - nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); 74 + nlh->nlmsg_len = size; 75 75 nlh->nlmsg_flags = 0; 76 76 77 77 m = NLMSG_DATA(nlh);
+1
MAINTAINERS
··· 1791 1791 1792 1792 BONDING DRIVER 1793 1793 M: Jay Vosburgh <fubar@us.ibm.com> 1794 + M: Veaceslav Falico <vfalico@redhat.com> 1794 1795 M: Andy Gospodarek <andy@greyhouse.net> 1795 1796 L: netdev@vger.kernel.org 1796 1797 W: http://sourceforge.net/projects/bonding/
+1
arch/arm/net/bpf_jit_32.c
··· 930 930 { 931 931 if (fp->bpf_func != sk_run_filter) 932 932 module_free(NULL, fp->bpf_func); 933 + kfree(fp); 933 934 }
+1
arch/powerpc/net/bpf_jit_comp.c
··· 691 691 { 692 692 if (fp->bpf_func != sk_run_filter) 693 693 module_free(NULL, fp->bpf_func); 694 + kfree(fp); 694 695 }
+3 -1
arch/s390/net/bpf_jit_comp.c
··· 881 881 struct bpf_binary_header *header = (void *)addr; 882 882 883 883 if (fp->bpf_func == sk_run_filter) 884 - return; 884 + goto free_filter; 885 885 set_memory_rw(addr, header->pages); 886 886 module_free(NULL, header); 887 + free_filter: 888 + kfree(fp); 887 889 }
+1
arch/sparc/net/bpf_jit_comp.c
··· 808 808 { 809 809 if (fp->bpf_func != sk_run_filter) 810 810 module_free(NULL, fp->bpf_func); 811 + kfree(fp); 811 812 }
+13 -5
arch/x86/net/bpf_jit_comp.c
··· 772 772 return; 773 773 } 774 774 775 + static void bpf_jit_free_deferred(struct work_struct *work) 776 + { 777 + struct sk_filter *fp = container_of(work, struct sk_filter, work); 778 + unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 779 + struct bpf_binary_header *header = (void *)addr; 780 + 781 + set_memory_rw(addr, header->pages); 782 + module_free(NULL, header); 783 + kfree(fp); 784 + } 785 + 775 786 void bpf_jit_free(struct sk_filter *fp) 776 787 { 777 788 if (fp->bpf_func != sk_run_filter) { 778 - unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 779 - struct bpf_binary_header *header = (void *)addr; 780 - 781 - set_memory_rw(addr, header->pages); 782 - module_free(NULL, header); 789 + INIT_WORK(&fp->work, bpf_jit_free_deferred); 790 + schedule_work(&fp->work); 783 791 } 784 792 }
+18
drivers/connector/cn_proc.c
··· 65 65 66 66 msg = (struct cn_msg *)buffer; 67 67 ev = (struct proc_event *)msg->data; 68 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 68 69 get_seq(&msg->seq, &ev->cpu); 69 70 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 70 71 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 81 80 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 82 81 msg->ack = 0; /* not used */ 83 82 msg->len = sizeof(*ev); 83 + msg->flags = 0; /* not used */ 84 84 /* If cn_netlink_send() failed, the data is not sent */ 85 85 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 86 86 } ··· 98 96 99 97 msg = (struct cn_msg *)buffer; 100 98 ev = (struct proc_event *)msg->data; 99 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 101 100 get_seq(&msg->seq, &ev->cpu); 102 101 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 103 102 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 109 106 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 110 107 msg->ack = 0; /* not used */ 111 108 msg->len = sizeof(*ev); 109 + msg->flags = 0; /* not used */ 112 110 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 113 111 } 114 112 ··· 126 122 127 123 msg = (struct cn_msg *)buffer; 128 124 ev = (struct proc_event *)msg->data; 125 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 129 126 ev->what = which_id; 130 127 ev->event_data.id.process_pid = task->pid; 131 128 ev->event_data.id.process_tgid = task->tgid; ··· 150 145 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 151 146 msg->ack = 0; /* not used */ 152 147 msg->len = sizeof(*ev); 148 + msg->flags = 0; /* not used */ 153 149 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 154 150 } 155 151 ··· 166 160 167 161 msg = (struct cn_msg *)buffer; 168 162 ev = (struct proc_event *)msg->data; 163 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 169 164 get_seq(&msg->seq, &ev->cpu); 170 165 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 171 166 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 177 170 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 178 171 msg->ack = 0; /* not used */ 179 172 msg->len = sizeof(*ev); 173 + msg->flags = 0; /* not used */ 180 174 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 181 175 } 182 176 ··· 193 185 194 186 msg = (struct cn_msg *)buffer; 195 187 ev = (struct proc_event *)msg->data; 188 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 196 189 get_seq(&msg->seq, &ev->cpu); 197 190 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 198 191 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 212 203 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 213 204 msg->ack = 0; /* not used */ 214 205 msg->len = sizeof(*ev); 206 + msg->flags = 0; /* not used */ 215 207 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 216 208 } 217 209 ··· 228 218 229 219 msg = (struct cn_msg *)buffer; 230 220 ev = (struct proc_event *)msg->data; 221 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 231 222 get_seq(&msg->seq, &ev->cpu); 232 223 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 233 224 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 240 229 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 241 230 msg->ack = 0; /* not used */ 242 231 msg->len = sizeof(*ev); 232 + msg->flags = 0; /* not used */ 243 233 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 244 234 } 245 235 ··· 256 244 257 245 msg = (struct cn_msg *)buffer; 258 246 ev = (struct proc_event *)msg->data; 247 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 259 248 get_seq(&msg->seq, &ev->cpu); 260 249 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 261 250 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 267 254 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 268 255 msg->ack = 0; /* not used */ 269 256 msg->len = sizeof(*ev); 257 + msg->flags = 0; /* not used */ 270 258 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 271 259 } 272 260 ··· 283 269 284 270 msg = (struct cn_msg *)buffer; 285 271 ev = (struct proc_event *)msg->data; 272 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 286 273 get_seq(&msg->seq, &ev->cpu); 287 274 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 288 275 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 296 281 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 297 282 msg->ack = 0; /* not used */ 298 283 msg->len = sizeof(*ev); 284 + msg->flags = 0; /* not used */ 299 285 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 300 286 } 301 287 ··· 320 304 321 305 msg = (struct cn_msg *)buffer; 322 306 ev = (struct proc_event *)msg->data; 307 + memset(&ev->event_data, 0, sizeof(ev->event_data)); 323 308 msg->seq = rcvd_seq; 324 309 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 325 310 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ··· 330 313 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 331 314 msg->ack = rcvd_ack + 1; 332 315 msg->len = sizeof(*ev); 316 + msg->flags = 0; /* not used */ 333 317 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 334 318 } 335 319
+5 -4
drivers/connector/connector.c
··· 109 109 110 110 data = nlmsg_data(nlh); 111 111 112 - memcpy(data, msg, sizeof(*data) + msg->len); 112 + memcpy(data, msg, size); 113 113 114 114 NETLINK_CB(skb).dst_group = group; 115 115 ··· 157 157 static void cn_rx_skb(struct sk_buff *__skb) 158 158 { 159 159 struct nlmsghdr *nlh; 160 - int err; 161 160 struct sk_buff *skb; 161 + int len, err; 162 162 163 163 skb = skb_get(__skb); 164 164 165 165 if (skb->len >= NLMSG_HDRLEN) { 166 166 nlh = nlmsg_hdr(skb); 167 + len = nlmsg_len(nlh); 167 168 168 - if (nlh->nlmsg_len < sizeof(struct cn_msg) || 169 + if (len < (int)sizeof(struct cn_msg) || 169 170 skb->len < nlh->nlmsg_len || 170 - nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { 171 + len > CONNECTOR_MAX_MSG_SIZE) { 171 172 kfree_skb(skb); 172 173 return; 173 174 }
+2 -2
drivers/net/can/at91_can.c
··· 1405 1405 1406 1406 static const struct platform_device_id at91_can_id_table[] = { 1407 1407 { 1408 - .name = "at91_can", 1408 + .name = "at91sam9x5_can", 1409 1409 .driver_data = (kernel_ulong_t)&at91_at91sam9x5_data, 1410 1410 }, { 1411 - .name = "at91sam9x5_can", 1411 + .name = "at91_can", 1412 1412 .driver_data = (kernel_ulong_t)&at91_at91sam9263_data, 1413 1413 }, { 1414 1414 /* sentinel */
+5 -5
drivers/net/can/dev.c
··· 705 705 size_t size; 706 706 707 707 size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ 708 - size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */ 708 + size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ 709 709 size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ 710 - size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */ 711 - size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */ 710 + size += nla_total_size(sizeof(struct can_bittiming)); /* IFLA_CAN_BITTIMING */ 711 + size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ 712 712 if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ 713 - size += sizeof(struct can_berr_counter); 713 + size += nla_total_size(sizeof(struct can_berr_counter)); 714 714 if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ 715 - size += sizeof(struct can_bittiming_const); 715 + size += nla_total_size(sizeof(struct can_bittiming_const)); 716 716 717 717 return size; 718 718 }
+10 -4
drivers/net/can/flexcan.c
··· 62 62 #define FLEXCAN_MCR_BCC BIT(16) 63 63 #define FLEXCAN_MCR_LPRIO_EN BIT(13) 64 64 #define FLEXCAN_MCR_AEN BIT(12) 65 - #define FLEXCAN_MCR_MAXMB(x) ((x) & 0xf) 65 + #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f) 66 66 #define FLEXCAN_MCR_IDAM_A (0 << 8) 67 67 #define FLEXCAN_MCR_IDAM_B (1 << 8) 68 68 #define FLEXCAN_MCR_IDAM_C (2 << 8) ··· 735 735 * 736 736 */ 737 737 reg_mcr = flexcan_read(&regs->mcr); 738 + reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff); 738 739 reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT | 739 740 FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | 740 - FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS; 741 + FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS | 742 + FLEXCAN_MCR_MAXMB(FLEXCAN_TX_BUF_ID); 741 743 netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr); 742 744 flexcan_write(reg_mcr, &regs->mcr); 743 745 ··· 772 770 priv->reg_ctrl_default = reg_ctrl; 773 771 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); 774 772 flexcan_write(reg_ctrl, &regs->ctrl); 773 + 774 + /* Abort any pending TX, mark Mailbox as INACTIVE */ 775 + flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), 776 + &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); 775 777 776 778 /* acceptance mask/acceptance code (accept everything) */ 777 779 flexcan_write(0x0, &regs->rxgmask); ··· 985 979 } 986 980 987 981 static const struct of_device_id flexcan_of_match[] = { 988 - { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, }, 989 - { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, 990 982 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, 983 + { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, 984 + { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, }, 991 985 { /* sentinel */ }, 992 986 }; 993 987 MODULE_DEVICE_TABLE(of, flexcan_of_match);
+10 -5
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1197 1197 /* TM (timers) host DB constants */ 1198 1198 #define TM_ILT_PAGE_SZ_HW 0 1199 1199 #define TM_ILT_PAGE_SZ (4096 << TM_ILT_PAGE_SZ_HW) /* 4K */ 1200 - /* #define TM_CONN_NUM (CNIC_STARTING_CID+CNIC_ISCSI_CXT_MAX) */ 1201 - #define TM_CONN_NUM 1024 1200 + #define TM_CONN_NUM (BNX2X_FIRST_VF_CID + \ 1201 + BNX2X_VF_CIDS + \ 1202 + CNIC_ISCSI_CID_MAX) 1202 1203 #define TM_ILT_SZ (8 * TM_CONN_NUM) 1203 1204 #define TM_ILT_LINES DIV_ROUND_UP(TM_ILT_SZ, TM_ILT_PAGE_SZ) 1204 1205 ··· 1528 1527 #define PCI_32BIT_FLAG (1 << 1) 1529 1528 #define ONE_PORT_FLAG (1 << 2) 1530 1529 #define NO_WOL_FLAG (1 << 3) 1531 - #define USING_DAC_FLAG (1 << 4) 1532 1530 #define USING_MSIX_FLAG (1 << 5) 1533 1531 #define USING_MSI_FLAG (1 << 6) 1534 1532 #define DISABLE_MSI_FLAG (1 << 7) ··· 1621 1621 u16 rx_ticks_int; 1622 1622 u16 rx_ticks; 1623 1623 /* Maximal coalescing timeout in us */ 1624 - #define BNX2X_MAX_COALESCE_TOUT (0xf0*12) 1624 + #define BNX2X_MAX_COALESCE_TOUT (0xff*BNX2X_BTR) 1625 1625 1626 1626 u32 lin_cnt; 1627 1627 ··· 2072 2072 2073 2073 void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae, 2074 2074 u8 src_type, u8 dst_type); 2075 - int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae); 2075 + int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae, 2076 + u32 *comp); 2076 2077 2077 2078 /* FLR related routines */ 2078 2079 u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp); ··· 2499 2498 }; 2500 2499 2501 2500 void bnx2x_set_local_cmng(struct bnx2x *bp); 2501 + 2502 + #define MCPR_SCRATCH_BASE(bp) \ 2503 + (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH) 2504 + 2502 2505 #endif /* bnx2x.h */
+1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 681 681 } 682 682 } 683 683 #endif 684 + skb_record_rx_queue(skb, fp->rx_queue); 684 685 napi_gro_receive(&fp->napi, skb); 685 686 } 686 687
+2 -38
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
··· 891 891 * will re-enable parity attentions right after the dump. 892 892 */ 893 893 894 - /* Disable parity on path 0 */ 895 - bnx2x_pretend_func(bp, 0); 896 894 bnx2x_disable_blocks_parity(bp); 897 - 898 - /* Disable parity on path 1 */ 899 - bnx2x_pretend_func(bp, 1); 900 - bnx2x_disable_blocks_parity(bp); 901 - 902 - /* Return to current function */ 903 - bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); 904 895 905 896 dump_hdr.header_size = (sizeof(struct dump_header) / 4) - 1; 906 897 dump_hdr.preset = DUMP_ALL_PRESETS; ··· 919 928 /* Actually read the registers */ 920 929 __bnx2x_get_regs(bp, p); 921 930 922 - /* Re-enable parity attentions on path 0 */ 923 - bnx2x_pretend_func(bp, 0); 931 + /* Re-enable parity attentions */ 924 932 bnx2x_clear_blocks_parity(bp); 925 933 bnx2x_enable_blocks_parity(bp); 926 - 927 - /* Re-enable parity attentions on path 1 */ 928 - bnx2x_pretend_func(bp, 1); 929 - bnx2x_clear_blocks_parity(bp); 930 - bnx2x_enable_blocks_parity(bp); 931 - 932 - /* Return to current function */ 933 - bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); 934 934 } 935 935 936 936 static int bnx2x_get_preset_regs_len(struct net_device *dev, u32 preset) ··· 975 993 * will re-enable parity attentions right after the dump. 976 994 */ 977 995 978 - /* Disable parity on path 0 */ 979 - bnx2x_pretend_func(bp, 0); 980 996 bnx2x_disable_blocks_parity(bp); 981 - 982 - /* Disable parity on path 1 */ 983 - bnx2x_pretend_func(bp, 1); 984 - bnx2x_disable_blocks_parity(bp); 985 - 986 - /* Return to current function */ 987 - bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); 988 997 989 998 dump_hdr.header_size = (sizeof(struct dump_header) / 4) - 1; 990 999 dump_hdr.preset = bp->dump_preset_idx; ··· 1005 1032 /* Actually read the registers */ 1006 1033 __bnx2x_get_preset_regs(bp, p, dump_hdr.preset); 1007 1034 1008 - /* Re-enable parity attentions on path 0 */ 1009 - bnx2x_pretend_func(bp, 0); 1035 + /* Re-enable parity attentions */ 1010 1036 bnx2x_clear_blocks_parity(bp); 1011 1037 bnx2x_enable_blocks_parity(bp); 1012 - 1013 - /* Re-enable parity attentions on path 1 */ 1014 - bnx2x_pretend_func(bp, 1); 1015 - bnx2x_clear_blocks_parity(bp); 1016 - bnx2x_enable_blocks_parity(bp); 1017 - 1018 - /* Return to current function */ 1019 - bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); 1020 1038 1021 1039 return 0; 1022 1040 }
+25 -13
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h
··· 640 640 * [30] MCP Latched ump_tx_parity 641 641 * [31] MCP Latched scpad_parity 642 642 */ 643 - #define MISC_AEU_ENABLE_MCP_PRTY_BITS \ 643 + #define MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS \ 644 644 (AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY | \ 645 645 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY | \ 646 - AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY | \ 646 + AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY) 647 + 648 + #define MISC_AEU_ENABLE_MCP_PRTY_BITS \ 649 + (MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS | \ 647 650 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY) 648 651 649 652 /* Below registers control the MCP parity attention output. When 650 653 * MISC_AEU_ENABLE_MCP_PRTY_BITS are set - attentions are 651 654 * enabled, when cleared - disabled. 652 655 */ 653 - static const u32 mcp_attn_ctl_regs[] = { 654 - MISC_REG_AEU_ENABLE4_FUNC_0_OUT_0, 655 - MISC_REG_AEU_ENABLE4_NIG_0, 656 - MISC_REG_AEU_ENABLE4_PXP_0, 657 - MISC_REG_AEU_ENABLE4_FUNC_1_OUT_0, 658 - MISC_REG_AEU_ENABLE4_NIG_1, 659 - MISC_REG_AEU_ENABLE4_PXP_1 656 + static const struct { 657 + u32 addr; 658 + u32 bits; 659 + } mcp_attn_ctl_regs[] = { 660 + { MISC_REG_AEU_ENABLE4_FUNC_0_OUT_0, 661 + MISC_AEU_ENABLE_MCP_PRTY_BITS }, 662 + { MISC_REG_AEU_ENABLE4_NIG_0, 663 + MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS }, 664 + { MISC_REG_AEU_ENABLE4_PXP_0, 665 + MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS }, 666 + { MISC_REG_AEU_ENABLE4_FUNC_1_OUT_0, 667 + MISC_AEU_ENABLE_MCP_PRTY_BITS }, 668 + { MISC_REG_AEU_ENABLE4_NIG_1, 669 + MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS }, 670 + { MISC_REG_AEU_ENABLE4_PXP_1, 671 + MISC_AEU_ENABLE_MCP_PRTY_SUB_BITS } 660 672 }; 661 673 662 674 static inline void bnx2x_set_mcp_parity(struct bnx2x *bp, u8 enable) ··· 677 665 u32 reg_val; 678 666 679 667 for (i = 0; i < ARRAY_SIZE(mcp_attn_ctl_regs); i++) { 680 - reg_val = REG_RD(bp, mcp_attn_ctl_regs[i]); 668 + reg_val = REG_RD(bp, mcp_attn_ctl_regs[i].addr); 681 669 682 670 if (enable) 683 - reg_val |= MISC_AEU_ENABLE_MCP_PRTY_BITS; 671 + reg_val |= mcp_attn_ctl_regs[i].bits; 684 672 else 685 - reg_val &= ~MISC_AEU_ENABLE_MCP_PRTY_BITS; 673 + reg_val &= ~mcp_attn_ctl_regs[i].bits; 686 674 687 - REG_WR(bp, mcp_attn_ctl_regs[i], reg_val); 675 + REG_WR(bp, mcp_attn_ctl_regs[i].addr, reg_val); 688 676 } 689 677 } 690 678
+212 -176
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 503 503 } 504 504 505 505 /* issue a dmae command over the init-channel and wait for completion */ 506 - int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae) 506 + int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae, 507 + u32 *comp) 507 508 { 508 - u32 *wb_comp = bnx2x_sp(bp, wb_comp); 509 509 int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 4000; 510 510 int rc = 0; 511 511 ··· 518 518 spin_lock_bh(&bp->dmae_lock); 519 519 520 520 /* reset completion */ 521 - *wb_comp = 0; 521 + *comp = 0; 522 522 523 523 /* post the command on the channel used for initializations */ 524 524 bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp)); 525 525 526 526 /* wait for completion */ 527 527 udelay(5); 528 - while ((*wb_comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) { 528 + while ((*comp & ~DMAE_PCI_ERR_FLAG) != DMAE_COMP_VAL) { 529 529 530 530 if (!cnt || 531 531 (bp->recovery_state != BNX2X_RECOVERY_DONE && ··· 537 537 cnt--; 538 538 udelay(50); 539 539 } 540 - if (*wb_comp & DMAE_PCI_ERR_FLAG) { 540 + if (*comp & DMAE_PCI_ERR_FLAG) { 541 541 BNX2X_ERR("DMAE PCI error!\n"); 542 542 rc = DMAE_PCI_ERROR; 543 543 } ··· 574 574 dmae.len = len32; 575 575 576 576 /* issue the command and wait for completion */ 577 - rc = bnx2x_issue_dmae_with_comp(bp, &dmae); 577 + rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 578 578 if (rc) { 579 579 BNX2X_ERR("DMAE returned failure %d\n", rc); 580 580 bnx2x_panic(); ··· 611 611 dmae.len = len32; 612 612 613 613 /* issue the command and wait for completion */ 614 - rc = bnx2x_issue_dmae_with_comp(bp, &dmae); 614 + rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 615 615 if (rc) { 616 616 BNX2X_ERR("DMAE returned failure %d\n", rc); 617 617 bnx2x_panic(); ··· 751 751 return rc; 752 752 } 753 753 754 + #define MCPR_TRACE_BUFFER_SIZE (0x800) 755 + #define SCRATCH_BUFFER_SIZE(bp) \ 756 + (CHIP_IS_E1(bp) ? 0x10000 : (CHIP_IS_E1H(bp) ? 0x20000 : 0x28000)) 757 + 754 758 void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl) 755 759 { 756 760 u32 addr, val; ··· 779 775 trace_shmem_base = bp->common.shmem_base; 780 776 else 781 777 trace_shmem_base = SHMEM2_RD(bp, other_shmem_base_addr); 782 - addr = trace_shmem_base - 0x800; 778 + 779 + /* sanity */ 780 + if (trace_shmem_base < MCPR_SCRATCH_BASE(bp) + MCPR_TRACE_BUFFER_SIZE || 781 + trace_shmem_base >= MCPR_SCRATCH_BASE(bp) + 782 + SCRATCH_BUFFER_SIZE(bp)) { 783 + BNX2X_ERR("Unable to dump trace buffer (mark %x)\n", 784 + trace_shmem_base); 785 + return; 786 + } 787 + 788 + addr = trace_shmem_base - MCPR_TRACE_BUFFER_SIZE; 783 789 784 790 /* validate TRCB signature */ 785 791 mark = REG_RD(bp, addr); ··· 801 787 /* read cyclic buffer pointer */ 802 788 addr += 4; 803 789 mark = REG_RD(bp, addr); 804 - mark = (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH) 805 - + ((mark + 0x3) & ~0x3) - 0x08000000; 790 + mark = MCPR_SCRATCH_BASE(bp) + ((mark + 0x3) & ~0x3) - 0x08000000; 791 + if (mark >= trace_shmem_base || mark < addr + 4) { 792 + BNX2X_ERR("Mark doesn't fall inside Trace Buffer\n"); 793 + return; 794 + } 806 795 printk("%s" "begin fw dump (mark 0x%x)\n", lvl, mark); 807 796 808 797 printk("%s", lvl); 809 798 810 799 /* dump buffer after the mark */ 811 - for (offset = mark; offset <= trace_shmem_base; offset += 0x8*4) { 800 + for (offset = mark; offset < trace_shmem_base; offset += 0x8*4) { 812 801 for (word = 0; word < 8; word++) 813 802 data[word] = htonl(REG_RD(bp, offset + 4*word)); 814 803 data[8] = 0x0; ··· 4297 4280 pr_cont("%s%s", idx ? ", " : "", blk); 4298 4281 } 4299 4282 4300 - static int bnx2x_check_blocks_with_parity0(struct bnx2x *bp, u32 sig, 4301 - int par_num, bool print) 4283 + static bool bnx2x_check_blocks_with_parity0(struct bnx2x *bp, u32 sig, 4284 + int *par_num, bool print) 4302 4285 { 4303 - int i = 0; 4304 - u32 cur_bit = 0; 4286 + u32 cur_bit; 4287 + bool res; 4288 + int i; 4289 + 4290 + res = false; 4291 + 4305 4292 for (i = 0; sig; i++) { 4306 - cur_bit = ((u32)0x1 << i); 4293 + cur_bit = (0x1UL << i); 4307 4294 if (sig & cur_bit) { 4308 - switch (cur_bit) { 4309 - case AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR: 4310 - if (print) { 4311 - _print_next_block(par_num++, "BRB"); 4295 + res |= true; /* Each bit is real error! */ 4296 + 4297 + if (print) { 4298 + switch (cur_bit) { 4299 + case AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR: 4300 + _print_next_block((*par_num)++, "BRB"); 4312 4301 _print_parity(bp, 4313 4302 BRB1_REG_BRB1_PRTY_STS); 4314 - } 4315 - break; 4316 - case AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR: 4317 - if (print) { 4318 - _print_next_block(par_num++, "PARSER"); 4303 + break; 4304 + case AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR: 4305 + _print_next_block((*par_num)++, 4306 + "PARSER"); 4319 4307 _print_parity(bp, PRS_REG_PRS_PRTY_STS); 4320 - } 4321 - break; 4322 - case AEU_INPUTS_ATTN_BITS_TSDM_PARITY_ERROR: 4323 - if (print) { 4324 - _print_next_block(par_num++, "TSDM"); 4308 + break; 4309 + case AEU_INPUTS_ATTN_BITS_TSDM_PARITY_ERROR: 4310 + _print_next_block((*par_num)++, "TSDM"); 4325 4311 _print_parity(bp, 4326 4312 TSDM_REG_TSDM_PRTY_STS); 4327 - } 4328 - break; 4329 - case AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR: 4330 - if (print) { 4331 - _print_next_block(par_num++, 4313 + break; 4314 + case AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR: 4315 + _print_next_block((*par_num)++, 4332 4316 "SEARCHER"); 4333 4317 _print_parity(bp, SRC_REG_SRC_PRTY_STS); 4334 - } 4335 - break; 4336 - case AEU_INPUTS_ATTN_BITS_TCM_PARITY_ERROR: 4337 - if (print) { 4338 - _print_next_block(par_num++, "TCM"); 4339 - _print_parity(bp, 4340 - TCM_REG_TCM_PRTY_STS); 4341 - } 4342 - break; 4343 - case AEU_INPUTS_ATTN_BITS_TSEMI_PARITY_ERROR: 4344 - if (print) { 4345 - _print_next_block(par_num++, "TSEMI"); 4318 + break; 4319 + case AEU_INPUTS_ATTN_BITS_TCM_PARITY_ERROR: 4320 + _print_next_block((*par_num)++, "TCM"); 4321 + _print_parity(bp, TCM_REG_TCM_PRTY_STS); 4322 + break; 4323 + case AEU_INPUTS_ATTN_BITS_TSEMI_PARITY_ERROR: 4324 + _print_next_block((*par_num)++, 4325 + "TSEMI"); 4346 4326 _print_parity(bp, 4347 4327 TSEM_REG_TSEM_PRTY_STS_0); 4348 4328 _print_parity(bp, 4349 4329 TSEM_REG_TSEM_PRTY_STS_1); 4350 - } 4351 - break; 4352 - case AEU_INPUTS_ATTN_BITS_PBCLIENT_PARITY_ERROR: 4353 - if (print) { 4354 - _print_next_block(par_num++, "XPB"); 4330 + break; 4331 + case AEU_INPUTS_ATTN_BITS_PBCLIENT_PARITY_ERROR: 4332 + _print_next_block((*par_num)++, "XPB"); 4355 4333 _print_parity(bp, GRCBASE_XPB + 4356 4334 PB_REG_PB_PRTY_STS); 4335 + break; 4357 4336 } 4358 - break; 4359 4337 } 4360 4338 4361 4339 /* Clear the bit */ ··· 4358 4346 } 4359 4347 } 4360 4348 4361 - return par_num; 4349 + return res; 4362 4350 } 4363 4351 4364 - static int bnx2x_check_blocks_with_parity1(struct bnx2x *bp, u32 sig, 4365 - int par_num, bool *global, 4352 + static bool bnx2x_check_blocks_with_parity1(struct bnx2x *bp, u32 sig, 4353 + int *par_num, bool *global, 4366 4354 bool print) 4367 4355 { 4368 - int i = 0; 4369 - u32 cur_bit = 0; 4356 + u32 cur_bit; 4357 + bool res; 4358 + int i; 4359 + 4360 + res = false; 4361 + 4370 4362 for (i = 0; sig; i++) { 4371 - cur_bit = ((u32)0x1 << i); 4363 + cur_bit = (0x1UL << i); 4372 4364 if (sig & cur_bit) { 4365 + res |= true; /* Each bit is real error! */ 4373 4366 switch (cur_bit) { 4374 4367 case AEU_INPUTS_ATTN_BITS_PBF_PARITY_ERROR: 4375 4368 if (print) { 4376 - _print_next_block(par_num++, "PBF"); 4369 + _print_next_block((*par_num)++, "PBF"); 4377 4370 _print_parity(bp, PBF_REG_PBF_PRTY_STS); 4378 4371 } 4379 4372 break; 4380 4373 case AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR: 4381 4374 if (print) { 4382 - _print_next_block(par_num++, "QM"); 4375 + _print_next_block((*par_num)++, "QM"); 4383 4376 _print_parity(bp, QM_REG_QM_PRTY_STS); 4384 4377 } 4385 4378 break; 4386 4379 case AEU_INPUTS_ATTN_BITS_TIMERS_PARITY_ERROR: 4387 4380 if (print) { 4388 - _print_next_block(par_num++, "TM"); 4381 + _print_next_block((*par_num)++, "TM"); 4389 4382 _print_parity(bp, TM_REG_TM_PRTY_STS); 4390 4383 } 4391 4384 break; 4392 4385 case AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR: 4393 4386 if (print) { 4394 - _print_next_block(par_num++, "XSDM"); 4387 + _print_next_block((*par_num)++, "XSDM"); 4395 4388 _print_parity(bp, 4396 4389 XSDM_REG_XSDM_PRTY_STS); 4397 4390 } 4398 4391 break; 4399 4392 case AEU_INPUTS_ATTN_BITS_XCM_PARITY_ERROR: 4400 4393 if (print) { 4401 - _print_next_block(par_num++, "XCM"); 4394 + _print_next_block((*par_num)++, "XCM"); 4402 4395 _print_parity(bp, XCM_REG_XCM_PRTY_STS); 4403 4396 } 4404 4397 break; 4405 4398 case AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR: 4406 4399 if (print) { 4407 - _print_next_block(par_num++, "XSEMI"); 4400 + _print_next_block((*par_num)++, 4401 + "XSEMI"); 4408 4402 _print_parity(bp, 4409 4403 XSEM_REG_XSEM_PRTY_STS_0); 4410 4404 _print_parity(bp, ··· 4419 4401 break; 4420 4402 case AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR: 4421 4403 if (print) { 4422 - _print_next_block(par_num++, 4404 + _print_next_block((*par_num)++, 4423 4405 "DOORBELLQ"); 4424 4406 _print_parity(bp, 4425 4407 DORQ_REG_DORQ_PRTY_STS); ··· 4427 4409 break; 4428 4410 case AEU_INPUTS_ATTN_BITS_NIG_PARITY_ERROR: 4429 4411 if (print) { 4430 - _print_next_block(par_num++, "NIG"); 4412 + _print_next_block((*par_num)++, "NIG"); 4431 4413 if (CHIP_IS_E1x(bp)) { 4432 4414 _print_parity(bp, 4433 4415 NIG_REG_NIG_PRTY_STS); ··· 4441 4423 break; 4442 4424 case AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR: 4443 4425 if (print) 4444 - _print_next_block(par_num++, 4426 + _print_next_block((*par_num)++, 4445 4427 "VAUX PCI CORE"); 4446 4428 *global = true; 4447 4429 break; 4448 4430 case AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR: 4449 4431 if (print) { 4450 - _print_next_block(par_num++, "DEBUG"); 4432 + _print_next_block((*par_num)++, 4433 + "DEBUG"); 4451 4434 _print_parity(bp, DBG_REG_DBG_PRTY_STS); 4452 4435 } 4453 4436 break; 4454 4437 case AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR: 4455 4438 if (print) { 4456 - _print_next_block(par_num++, "USDM"); 4439 + _print_next_block((*par_num)++, "USDM"); 4457 4440 _print_parity(bp, 4458 4441 USDM_REG_USDM_PRTY_STS); 4459 4442 } 4460 4443 break; 4461 4444 case AEU_INPUTS_ATTN_BITS_UCM_PARITY_ERROR: 4462 4445 if (print) { 4463 - _print_next_block(par_num++, "UCM"); 4446 + _print_next_block((*par_num)++, "UCM"); 4464 4447 _print_parity(bp, UCM_REG_UCM_PRTY_STS); 4465 4448 } 4466 4449 break; 4467 4450 case AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR: 4468 4451 if (print) { 4469 - _print_next_block(par_num++, "USEMI"); 4452 + _print_next_block((*par_num)++, 4453 + "USEMI"); 4470 4454 _print_parity(bp, 4471 4455 USEM_REG_USEM_PRTY_STS_0); 4472 4456 _print_parity(bp, ··· 4477 4457 break; 4478 4458 case AEU_INPUTS_ATTN_BITS_UPB_PARITY_ERROR: 4479 4459 if (print) { 4480 - _print_next_block(par_num++, "UPB"); 4460 + _print_next_block((*par_num)++, "UPB"); 4481 4461 _print_parity(bp, GRCBASE_UPB + 4482 4462 PB_REG_PB_PRTY_STS); 4483 4463 } 4484 4464 break; 4485 4465 case AEU_INPUTS_ATTN_BITS_CSDM_PARITY_ERROR: 4486 4466 if (print) { 4487 - _print_next_block(par_num++, "CSDM"); 4467 + _print_next_block((*par_num)++, "CSDM"); 4488 4468 _print_parity(bp, 4489 4469 CSDM_REG_CSDM_PRTY_STS); 4490 4470 } 4491 4471 break; 4492 4472 case AEU_INPUTS_ATTN_BITS_CCM_PARITY_ERROR: 4493 4473 if (print) { 4494 - _print_next_block(par_num++, "CCM"); 4474 + _print_next_block((*par_num)++, "CCM"); 4495 4475 _print_parity(bp, CCM_REG_CCM_PRTY_STS); 4496 4476 } 4497 4477 break; ··· 4502 4482 } 4503 4483 } 4504 4484 4505 - return par_num; 4485 + return res; 4506 4486 } 4507 4487 4508 - static int bnx2x_check_blocks_with_parity2(struct bnx2x *bp, u32 sig, 4509 - int par_num, bool print) 4488 + static bool bnx2x_check_blocks_with_parity2(struct bnx2x *bp, u32 sig, 4489 + int *par_num, bool print) 4510 4490 { 4511 - int i = 0; 4512 - u32 cur_bit = 0; 4491 + u32 cur_bit; 4492 + bool res; 4493 + int i; 4494 + 4495 + res = false; 4496 + 4513 4497 for (i = 0; sig; i++) { 4514 - cur_bit = ((u32)0x1 << i); 4498 + cur_bit = (0x1UL << i); 4515 4499 if (sig & cur_bit) { 4516 - switch (cur_bit) { 4517 - case AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR: 4518 - if (print) { 4519 - _print_next_block(par_num++, "CSEMI"); 4500 + res |= true; /* Each bit is real error! */ 4501 + if (print) { 4502 + switch (cur_bit) { 4503 + case AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR: 4504 + _print_next_block((*par_num)++, 4505 + "CSEMI"); 4520 4506 _print_parity(bp, 4521 4507 CSEM_REG_CSEM_PRTY_STS_0); 4522 4508 _print_parity(bp, 4523 4509 CSEM_REG_CSEM_PRTY_STS_1); 4524 - } 4525 - break; 4526 - case AEU_INPUTS_ATTN_BITS_PXP_PARITY_ERROR: 4527 - if (print) { 4528 - _print_next_block(par_num++, "PXP"); 4510 + break; 4511 + case AEU_INPUTS_ATTN_BITS_PXP_PARITY_ERROR: 4512 + _print_next_block((*par_num)++, "PXP"); 4529 4513 _print_parity(bp, PXP_REG_PXP_PRTY_STS); 4530 4514 _print_parity(bp, 4531 4515 PXP2_REG_PXP2_PRTY_STS_0); 4532 4516 _print_parity(bp, 4533 4517 PXP2_REG_PXP2_PRTY_STS_1); 4534 - } 4535 - break; 4536 - case AEU_IN_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR: 4537 - if (print) 4538 - _print_next_block(par_num++, 4539 - "PXPPCICLOCKCLIENT"); 4540 - break; 4541 - case AEU_INPUTS_ATTN_BITS_CFC_PARITY_ERROR: 4542 - if (print) { 4543 - _print_next_block(par_num++, "CFC"); 4518 + break; 4519 + case AEU_IN_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR: 4520 + _print_next_block((*par_num)++, 4521 + "PXPPCICLOCKCLIENT"); 4522 + break; 4523 + case AEU_INPUTS_ATTN_BITS_CFC_PARITY_ERROR: 4524 + _print_next_block((*par_num)++, "CFC"); 4544 4525 _print_parity(bp, 4545 4526 CFC_REG_CFC_PRTY_STS); 4546 - } 4547 - break; 4548 - case AEU_INPUTS_ATTN_BITS_CDU_PARITY_ERROR: 4549 - if (print) { 4550 - _print_next_block(par_num++, "CDU"); 4527 + break; 4528 + case AEU_INPUTS_ATTN_BITS_CDU_PARITY_ERROR: 4529 + _print_next_block((*par_num)++, "CDU"); 4551 4530 _print_parity(bp, CDU_REG_CDU_PRTY_STS); 4552 - } 4553 - break; 4554 - case AEU_INPUTS_ATTN_BITS_DMAE_PARITY_ERROR: 4555 - if (print) { 4556 - _print_next_block(par_num++, "DMAE"); 4531 + break; 4532 + case AEU_INPUTS_ATTN_BITS_DMAE_PARITY_ERROR: 4533 + _print_next_block((*par_num)++, "DMAE"); 4557 4534 _print_parity(bp, 4558 4535 DMAE_REG_DMAE_PRTY_STS); 4559 - } 4560 - break; 4561 - case AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR: 4562 - if (print) { 4563 - _print_next_block(par_num++, "IGU"); 4536 + break; 4537 + case AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR: 4538 + _print_next_block((*par_num)++, "IGU"); 4564 4539 if (CHIP_IS_E1x(bp)) 4565 4540 _print_parity(bp, 4566 4541 HC_REG_HC_PRTY_STS); 4567 4542 else 4568 4543 _print_parity(bp, 4569 4544 IGU_REG_IGU_PRTY_STS); 4570 - } 4571 - break; 4572 - case AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR: 4573 - if (print) { 4574 - _print_next_block(par_num++, "MISC"); 4545 + break; 4546 + case AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR: 4547 + _print_next_block((*par_num)++, "MISC"); 4575 4548 _print_parity(bp, 4576 4549 MISC_REG_MISC_PRTY_STS); 4550 + break; 4577 4551 } 4578 - break; 4579 4552 } 4580 4553 4581 4554 /* Clear the bit */ ··· 4576 4563 } 4577 4564 } 4578 4565 4579 - return par_num; 4566 + return res; 4580 4567 } 4581 4568 4582 - static int bnx2x_check_blocks_with_parity3(u32 sig, int par_num, 4583 - bool *global, bool print) 4569 + static bool bnx2x_check_blocks_with_parity3(struct bnx2x *bp, u32 sig, 4570 + int *par_num, bool *global, 4571 + bool print) 4584 4572 { 4585 - int i = 0; 4586 - u32 cur_bit = 0; 4573 + bool res = false; 4574 + u32 cur_bit; 4575 + int i; 4576 + 4587 4577 for (i = 0; sig; i++) { 4588 - cur_bit = ((u32)0x1 << i); 4578 + cur_bit = (0x1UL << i); 4589 4579 if (sig & cur_bit) { 4590 4580 switch (cur_bit) { 4591 4581 case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY: 4592 4582 if (print) 4593 - _print_next_block(par_num++, "MCP ROM"); 4583 + _print_next_block((*par_num)++, 4584 + "MCP ROM"); 4594 4585 *global = true; 4586 + res |= true; 4595 4587 break; 4596 4588 case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY: 4597 4589 if (print) 4598 - _print_next_block(par_num++, 4590 + _print_next_block((*par_num)++, 4599 4591 "MCP UMP RX"); 4600 4592 *global = true; 4593 + res |= true; 4601 4594 break; 4602 4595 case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY: 4603 4596 if (print) 4604 - _print_next_block(par_num++, 4597 + _print_next_block((*par_num)++, 4605 4598 "MCP UMP TX"); 4606 4599 *global = true; 4600 + res |= true; 4607 4601 break; 4608 4602 case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY: 4609 4603 if (print) 4610 - _print_next_block(par_num++, 4604 + _print_next_block((*par_num)++, 4611 4605 "MCP SCPAD"); 4612 - *global = true; 4606 + /* clear latched SCPAD PATIRY from MCP */ 4607 + REG_WR(bp, MISC_REG_AEU_CLR_LATCH_SIGNAL, 4608 + 1UL << 10); 4613 4609 break; 4614 4610 } 4615 4611 ··· 4627 4605 } 4628 4606 } 4629 4607 4630 - return par_num; 4608 + return res; 4631 4609 } 4632 4610 4633 - static int bnx2x_check_blocks_with_parity4(struct bnx2x *bp, u32 sig, 4634 - int par_num, bool print) 4611 + static bool bnx2x_check_blocks_with_parity4(struct bnx2x *bp, u32 sig, 4612 + int *par_num, bool print) 4635 4613 { 4636 - int i = 0; 4637 - u32 cur_bit = 0; 4614 + u32 cur_bit; 4615 + bool res; 4616 + int i; 4617 + 4618 + res = false; 4619 + 4638 4620 for (i = 0; sig; i++) { 4639 - cur_bit = ((u32)0x1 << i); 4621 + cur_bit = (0x1UL << i); 4640 4622 if (sig & cur_bit) { 4641 - switch (cur_bit) { 4642 - case AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR: 4643 - if (print) { 4644 - _print_next_block(par_num++, "PGLUE_B"); 4623 + res |= true; /* Each bit is real error! */ 4624 + if (print) { 4625 + switch (cur_bit) { 4626 + case AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR: 4627 + _print_next_block((*par_num)++, 4628 + "PGLUE_B"); 4645 4629 _print_parity(bp, 4646 - PGLUE_B_REG_PGLUE_B_PRTY_STS); 4647 - } 4648 - break; 4649 - case AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR: 4650 - if (print) { 4651 - _print_next_block(par_num++, "ATC"); 4630 + PGLUE_B_REG_PGLUE_B_PRTY_STS); 4631 + break; 4632 + case AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR: 4633 + _print_next_block((*par_num)++, "ATC"); 4652 4634 _print_parity(bp, 4653 4635 ATC_REG_ATC_PRTY_STS); 4636 + break; 4654 4637 } 4655 - break; 4656 4638 } 4657 - 4658 4639 /* Clear the bit */ 4659 4640 sig &= ~cur_bit; 4660 4641 } 4661 4642 } 4662 4643 4663 - return par_num; 4644 + return res; 4664 4645 } 4665 4646 4666 4647 static bool bnx2x_parity_attn(struct bnx2x *bp, bool *global, bool print, 4667 4648 u32 *sig) 4668 4649 { 4650 + bool res = false; 4651 + 4669 4652 if ((sig[0] & HW_PRTY_ASSERT_SET_0) || 4670 4653 (sig[1] & HW_PRTY_ASSERT_SET_1) || 4671 4654 (sig[2] & HW_PRTY_ASSERT_SET_2) || ··· 4687 4660 if (print) 4688 4661 netdev_err(bp->dev, 4689 4662 "Parity errors detected in blocks: "); 4690 - par_num = bnx2x_check_blocks_with_parity0(bp, 4691 - sig[0] & HW_PRTY_ASSERT_SET_0, par_num, print); 4692 - par_num = bnx2x_check_blocks_with_parity1(bp, 4693 - sig[1] & HW_PRTY_ASSERT_SET_1, par_num, global, print); 4694 - par_num = bnx2x_check_blocks_with_parity2(bp, 4695 - sig[2] & HW_PRTY_ASSERT_SET_2, par_num, print); 4696 - par_num = bnx2x_check_blocks_with_parity3( 4697 - sig[3] & HW_PRTY_ASSERT_SET_3, par_num, global, print); 4698 - par_num = bnx2x_check_blocks_with_parity4(bp, 4699 - sig[4] & HW_PRTY_ASSERT_SET_4, par_num, print); 4663 + res |= bnx2x_check_blocks_with_parity0(bp, 4664 + sig[0] & HW_PRTY_ASSERT_SET_0, &par_num, print); 4665 + res |= bnx2x_check_blocks_with_parity1(bp, 4666 + sig[1] & HW_PRTY_ASSERT_SET_1, &par_num, global, print); 4667 + res |= bnx2x_check_blocks_with_parity2(bp, 4668 + sig[2] & HW_PRTY_ASSERT_SET_2, &par_num, print); 4669 + res |= bnx2x_check_blocks_with_parity3(bp, 4670 + sig[3] & HW_PRTY_ASSERT_SET_3, &par_num, global, print); 4671 + res |= bnx2x_check_blocks_with_parity4(bp, 4672 + sig[4] & HW_PRTY_ASSERT_SET_4, &par_num, print); 4700 4673 4701 4674 if (print) 4702 4675 pr_cont("\n"); 4676 + } 4703 4677 4704 - return true; 4705 - } else 4706 - return false; 4678 + return res; 4707 4679 } 4708 4680 4709 4681 /** ··· 7152 7126 int port = BP_PORT(bp); 7153 7127 int init_phase = port ? PHASE_PORT1 : PHASE_PORT0; 7154 7128 u32 low, high; 7155 - u32 val; 7129 + u32 val, reg; 7156 7130 7157 7131 DP(NETIF_MSG_HW, "starting port init port %d\n", port); 7158 7132 ··· 7296 7270 /* Enable DCBX attention for all but E1 */ 7297 7271 val |= CHIP_IS_E1(bp) ? 0 : 0x10; 7298 7272 REG_WR(bp, MISC_REG_AEU_MASK_ATTN_FUNC_0 + port*4, val); 7273 + 7274 + /* SCPAD_PARITY should NOT trigger close the gates */ 7275 + reg = port ? MISC_REG_AEU_ENABLE4_NIG_1 : MISC_REG_AEU_ENABLE4_NIG_0; 7276 + REG_WR(bp, reg, 7277 + REG_RD(bp, reg) & 7278 + ~AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY); 7279 + 7280 + reg = port ? MISC_REG_AEU_ENABLE4_PXP_1 : MISC_REG_AEU_ENABLE4_PXP_0; 7281 + REG_WR(bp, reg, 7282 + REG_RD(bp, reg) & 7283 + ~AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY); 7299 7284 7300 7285 bnx2x_init_block(bp, BLOCK_NIG, init_phase); 7301 7286 ··· 11722 11685 static int bnx2x_open(struct net_device *dev) 11723 11686 { 11724 11687 struct bnx2x *bp = netdev_priv(dev); 11725 - bool global = false; 11726 - int other_engine = BP_PATH(bp) ? 0 : 1; 11727 - bool other_load_status, load_status; 11728 11688 int rc; 11729 11689 11730 11690 bp->stats_init = true; ··· 11737 11703 * Parity recovery is only relevant for PF driver. 11738 11704 */ 11739 11705 if (IS_PF(bp)) { 11706 + int other_engine = BP_PATH(bp) ? 0 : 1; 11707 + bool other_load_status, load_status; 11708 + bool global = false; 11709 + 11740 11710 other_load_status = bnx2x_get_load_status(bp, other_engine); 11741 11711 load_status = bnx2x_get_load_status(bp, BP_PATH(bp)); 11742 11712 if (!bnx2x_reset_is_done(bp, BP_PATH(bp)) || ··· 12118 12080 struct device *dev = &bp->pdev->dev; 12119 12081 12120 12082 if (dma_set_mask(dev, DMA_BIT_MASK(64)) == 0) { 12121 - bp->flags |= USING_DAC_FLAG; 12122 12083 if (dma_set_coherent_mask(dev, DMA_BIT_MASK(64)) != 0) { 12123 12084 dev_err(dev, "dma_set_coherent_mask failed, aborting\n"); 12124 12085 return -EIO; ··· 12285 12248 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA; 12286 12249 12287 12250 dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX; 12288 - if (bp->flags & USING_DAC_FLAG) 12289 - dev->features |= NETIF_F_HIGHDMA; 12251 + dev->features |= NETIF_F_HIGHDMA; 12290 12252 12291 12253 /* Add Loopback capability to the device */ 12292 12254 dev->hw_features |= NETIF_F_LOOPBACK; ··· 12648 12612 return BNX2X_MULTI_TX_COS_E1X; 12649 12613 case BCM57712: 12650 12614 case BCM57712_MF: 12651 - case BCM57712_VF: 12652 12615 return BNX2X_MULTI_TX_COS_E2_E3A0; 12653 12616 case BCM57800: 12654 12617 case BCM57800_MF: 12655 - case BCM57800_VF: 12656 12618 case BCM57810: 12657 12619 case BCM57810_MF: 12658 12620 case BCM57840_4_10: 12659 12621 case BCM57840_2_20: 12660 12622 case BCM57840_O: 12661 12623 case BCM57840_MFO: 12662 - case BCM57810_VF: 12663 12624 case BCM57840_MF: 12664 - case BCM57840_VF: 12665 12625 case BCM57811: 12666 12626 case BCM57811_MF: 12667 - case BCM57811_VF: 12668 12627 return BNX2X_MULTI_TX_COS_E3B0; 12628 + case BCM57712_VF: 12629 + case BCM57800_VF: 12630 + case BCM57810_VF: 12631 + case BCM57840_VF: 12632 + case BCM57811_VF: 12669 12633 return 1; 12670 12634 default: 12671 12635 pr_err("Unknown board_type (%d), aborting\n", chip_id);
+17 -12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
··· 470 470 bnx2x_vfop_qdtor, cmd->done); 471 471 return bnx2x_vfop_transition(bp, vf, bnx2x_vfop_qdtor, 472 472 cmd->block); 473 + } else { 474 + BNX2X_ERR("VF[%d] failed to add a vfop\n", vf->abs_vfid); 475 + return -ENOMEM; 473 476 } 474 - DP(BNX2X_MSG_IOV, "VF[%d] failed to add a vfop. rc %d\n", 475 - vf->abs_vfid, vfop->rc); 476 - return -ENOMEM; 477 477 } 478 478 479 479 static void ··· 3390 3390 rc = bnx2x_del_all_macs(bp, mac_obj, BNX2X_ETH_MAC, true); 3391 3391 if (rc) { 3392 3392 BNX2X_ERR("failed to delete eth macs\n"); 3393 - return -EINVAL; 3393 + rc = -EINVAL; 3394 + goto out; 3394 3395 } 3395 3396 3396 3397 /* remove existing uc list macs */ 3397 3398 rc = bnx2x_del_all_macs(bp, mac_obj, BNX2X_UC_LIST_MAC, true); 3398 3399 if (rc) { 3399 3400 BNX2X_ERR("failed to delete uc_list macs\n"); 3400 - return -EINVAL; 3401 + rc = -EINVAL; 3402 + goto out; 3401 3403 } 3402 3404 3403 3405 /* configure the new mac to device */ ··· 3407 3405 bnx2x_set_mac_one(bp, (u8 *)&bulletin->mac, mac_obj, true, 3408 3406 BNX2X_ETH_MAC, &ramrod_flags); 3409 3407 3408 + out: 3410 3409 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); 3411 3410 } 3412 3411 ··· 3470 3467 &ramrod_flags); 3471 3468 if (rc) { 3472 3469 BNX2X_ERR("failed to delete vlans\n"); 3473 - return -EINVAL; 3470 + rc = -EINVAL; 3471 + goto out; 3474 3472 } 3475 3473 3476 3474 /* send queue update ramrod to configure default vlan and silent ··· 3505 3501 rc = bnx2x_config_vlan_mac(bp, &ramrod_param); 3506 3502 if (rc) { 3507 3503 BNX2X_ERR("failed to configure vlan\n"); 3508 - return -EINVAL; 3504 + rc = -EINVAL; 3505 + goto out; 3509 3506 } 3510 3507 3511 3508 /* configure default vlan to vf queue and set silent ··· 3524 3519 rc = bnx2x_queue_state_change(bp, &q_params); 3525 3520 if (rc) { 3526 3521 BNX2X_ERR("Failed to configure default VLAN\n"); 3527 - return rc; 3522 + goto out; 3528 3523 } 3529 3524 3530 3525 /* clear the flag indicating that this VF needs its vlan 3531 - * (will only be set if the HV configured th Vlan before vf was 3532 - * and we were called because the VF came up later 3526 + * (will only be set if the HV configured the Vlan before vf was 3527 + * up and we were called because the VF came up later 3533 3528 */ 3529 + out: 3534 3530 vf->cfg_flags &= ~VF_CFG_VLAN; 3535 - 3536 3531 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); 3537 3532 } 3538 - return 0; 3533 + return rc; 3539 3534 } 3540 3535 3541 3536 /* crc is the first field in the bulletin board. Compute the crc over the
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
··· 196 196 197 197 } else if (bp->func_stx) { 198 198 *stats_comp = 0; 199 - bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp)); 199 + bnx2x_issue_dmae_with_comp(bp, dmae, stats_comp); 200 200 } 201 201 } 202 202
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
··· 980 980 dmae.len = len32; 981 981 982 982 /* issue the command and wait for completion */ 983 - return bnx2x_issue_dmae_with_comp(bp, &dmae); 983 + return bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 984 984 } 985 985 986 986 static void bnx2x_vf_mbx_resp(struct bnx2x *bp, struct bnx2x_virtf *vf)
+14 -9
drivers/net/ethernet/calxeda/xgmac.c
··· 106 106 #define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */ 107 107 108 108 #define XGMAC_ADDR_AE 0x80000000 109 - #define XGMAC_MAX_FILTER_ADDR 31 110 109 111 110 /* PMT Control and Status */ 112 111 #define XGMAC_PMT_POINTER_RESET 0x80000000 ··· 383 384 struct device *device; 384 385 struct napi_struct napi; 385 386 387 + int max_macs; 386 388 struct xgmac_extra_stats xstats; 387 389 388 390 spinlock_t stats_lock; ··· 1291 1291 netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n", 1292 1292 netdev_mc_count(dev), netdev_uc_count(dev)); 1293 1293 1294 - if (dev->flags & IFF_PROMISC) { 1295 - writel(XGMAC_FRAME_FILTER_PR, ioaddr + XGMAC_FRAME_FILTER); 1296 - return; 1297 - } 1294 + if (dev->flags & IFF_PROMISC) 1295 + value |= XGMAC_FRAME_FILTER_PR; 1298 1296 1299 1297 memset(hash_filter, 0, sizeof(hash_filter)); 1300 1298 1301 - if (netdev_uc_count(dev) > XGMAC_MAX_FILTER_ADDR) { 1299 + if (netdev_uc_count(dev) > priv->max_macs) { 1302 1300 use_hash = true; 1303 1301 value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF; 1304 1302 } ··· 1319 1321 goto out; 1320 1322 } 1321 1323 1322 - if ((netdev_mc_count(dev) + reg - 1) > XGMAC_MAX_FILTER_ADDR) { 1324 + if ((netdev_mc_count(dev) + reg - 1) > priv->max_macs) { 1323 1325 use_hash = true; 1324 1326 value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF; 1325 1327 } else { ··· 1340 1342 } 1341 1343 1342 1344 out: 1343 - for (i = reg; i < XGMAC_MAX_FILTER_ADDR; i++) 1344 - xgmac_set_mac_addr(ioaddr, NULL, reg); 1345 + for (i = reg; i <= priv->max_macs; i++) 1346 + xgmac_set_mac_addr(ioaddr, NULL, i); 1345 1347 for (i = 0; i < XGMAC_NUM_HASH; i++) 1346 1348 writel(hash_filter[i], ioaddr + XGMAC_HASH(i)); 1347 1349 ··· 1758 1760 1759 1761 uid = readl(priv->base + XGMAC_VERSION); 1760 1762 netdev_info(ndev, "h/w version is 0x%x\n", uid); 1763 + 1764 + /* Figure out how many valid mac address filter registers we have */ 1765 + writel(1, priv->base + XGMAC_ADDR_HIGH(31)); 1766 + if (readl(priv->base + XGMAC_ADDR_HIGH(31)) == 1) 1767 + priv->max_macs = 31; 1768 + else 1769 + priv->max_macs = 7; 1761 1770 1762 1771 writel(0, priv->base + XGMAC_DMA_INTR_ENA); 1763 1772 ndev->irq = platform_get_irq(pdev, 0);
+38 -18
drivers/net/ethernet/davicom/dm9000.c
··· 158 158 159 159 /* DM9000 network board routine ---------------------------- */ 160 160 161 - static void 162 - dm9000_reset(board_info_t * db) 163 - { 164 - dev_dbg(db->dev, "resetting device\n"); 165 - 166 - /* RESET device */ 167 - writeb(DM9000_NCR, db->io_addr); 168 - udelay(200); 169 - writeb(NCR_RST, db->io_data); 170 - udelay(200); 171 - } 172 - 173 161 /* 174 162 * Read a byte from I/O port 175 163 */ ··· 177 189 { 178 190 writeb(reg, db->io_addr); 179 191 writeb(value, db->io_data); 192 + } 193 + 194 + static void 195 + dm9000_reset(board_info_t *db) 196 + { 197 + dev_dbg(db->dev, "resetting device\n"); 198 + 199 + /* Reset DM9000, see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 200 + * The essential point is that we have to do a double reset, and the 201 + * instruction is to set LBK into MAC internal loopback mode. 202 + */ 203 + iow(db, DM9000_NCR, 0x03); 204 + udelay(100); /* Application note says at least 20 us */ 205 + if (ior(db, DM9000_NCR) & 1) 206 + dev_err(db->dev, "dm9000 did not respond to first reset\n"); 207 + 208 + iow(db, DM9000_NCR, 0); 209 + iow(db, DM9000_NCR, 0x03); 210 + udelay(100); 211 + if (ior(db, DM9000_NCR) & 1) 212 + dev_err(db->dev, "dm9000 did not respond to second reset\n"); 180 213 } 181 214 182 215 /* routines for sending block to chip */ ··· 753 744 static void dm9000_show_carrier(board_info_t *db, 754 745 unsigned carrier, unsigned nsr) 755 746 { 747 + int lpa; 756 748 struct net_device *ndev = db->ndev; 749 + struct mii_if_info *mii = &db->mii; 757 750 unsigned ncr = dm9000_read_locked(db, DM9000_NCR); 758 751 759 - if (carrier) 760 - dev_info(db->dev, "%s: link up, %dMbps, %s-duplex, no LPA\n", 752 + if (carrier) { 753 + lpa = mii->mdio_read(mii->dev, mii->phy_id, MII_LPA); 754 + dev_info(db->dev, 755 + "%s: link up, %dMbps, %s-duplex, lpa 0x%04X\n", 761 756 ndev->name, (nsr & NSR_SPEED) ? 10 : 100, 762 - (ncr & NCR_FDX) ? "full" : "half"); 763 - else 757 + (ncr & NCR_FDX) ? "full" : "half", lpa); 758 + } else { 764 759 dev_info(db->dev, "%s: link down\n", ndev->name); 760 + } 765 761 } 766 762 767 763 static void ··· 904 890 (dev->features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0); 905 891 906 892 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ 893 + iow(db, DM9000_GPR, 0); 907 894 908 - dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */ 909 - dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */ 895 + /* If we are dealing with DM9000B, some extra steps are required: a 896 + * manual phy reset, and setting init params. 897 + */ 898 + if (db->type == TYPE_DM9000B) { 899 + dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); 900 + dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); 901 + } 910 902 911 903 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; 912 904
+2 -1
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 1198 1198 1199 1199 if (lancer_chip(adapter)) { 1200 1200 req->hdr.version = 1; 1201 - req->if_id = cpu_to_le16(adapter->if_handle); 1202 1201 } else if (BEx_chip(adapter)) { 1203 1202 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) 1204 1203 req->hdr.version = 2; ··· 1205 1206 req->hdr.version = 2; 1206 1207 } 1207 1208 1209 + if (req->hdr.version > 0) 1210 + req->if_id = cpu_to_le16(adapter->if_handle); 1208 1211 req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); 1209 1212 req->ulp_num = BE_ULP1_NUM; 1210 1213 req->type = BE_ETH_TX_RING_TYPE_STANDARD;
+29 -11
drivers/net/ethernet/freescale/gianfar.c
··· 88 88 89 89 #include <asm/io.h> 90 90 #include <asm/reg.h> 91 + #include <asm/mpc85xx.h> 91 92 #include <asm/irq.h> 92 93 #include <asm/uaccess.h> 93 94 #include <linux/module.h> ··· 940 939 } 941 940 } 942 941 943 - static void gfar_detect_errata(struct gfar_private *priv) 942 + static void __gfar_detect_errata_83xx(struct gfar_private *priv) 944 943 { 945 - struct device *dev = &priv->ofdev->dev; 946 944 unsigned int pvr = mfspr(SPRN_PVR); 947 945 unsigned int svr = mfspr(SPRN_SVR); 948 946 unsigned int mod = (svr >> 16) & 0xfff6; /* w/o E suffix */ ··· 957 957 (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) 958 958 priv->errata |= GFAR_ERRATA_76; 959 959 960 - /* MPC8313 and MPC837x all rev */ 961 - if ((pvr == 0x80850010 && mod == 0x80b0) || 962 - (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0)) 963 - priv->errata |= GFAR_ERRATA_A002; 964 - 965 - /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */ 966 - if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) || 967 - (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020)) 960 + /* MPC8313 Rev < 2.0 */ 961 + if (pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) 968 962 priv->errata |= GFAR_ERRATA_12; 963 + } 964 + 965 + static void __gfar_detect_errata_85xx(struct gfar_private *priv) 966 + { 967 + unsigned int svr = mfspr(SPRN_SVR); 968 + 969 + if ((SVR_SOC_VER(svr) == SVR_8548) && (SVR_REV(svr) == 0x20)) 970 + priv->errata |= GFAR_ERRATA_12; 971 + if (((SVR_SOC_VER(svr) == SVR_P2020) && (SVR_REV(svr) < 0x20)) || 972 + ((SVR_SOC_VER(svr) == SVR_P2010) && (SVR_REV(svr) < 0x20))) 973 + priv->errata |= GFAR_ERRATA_76; /* aka eTSEC 20 */ 974 + } 975 + 976 + static void gfar_detect_errata(struct gfar_private *priv) 977 + { 978 + struct device *dev = &priv->ofdev->dev; 979 + 980 + /* no plans to fix */ 981 + priv->errata |= GFAR_ERRATA_A002; 982 + 983 + if (pvr_version_is(PVR_VER_E500V1) || pvr_version_is(PVR_VER_E500V2)) 984 + __gfar_detect_errata_85xx(priv); 985 + else /* non-mpc85xx parts, i.e. e300 core based */ 986 + __gfar_detect_errata_83xx(priv); 969 987 970 988 if (priv->errata) 971 989 dev_info(dev, "enabled errata workarounds, flags: 0x%x\n", ··· 1617 1599 /* Normaly TSEC should not hang on GRS commands, so we should 1618 1600 * actually wait for IEVENT_GRSC flag. 1619 1601 */ 1620 - if (likely(!gfar_has_errata(priv, GFAR_ERRATA_A002))) 1602 + if (!gfar_has_errata(priv, GFAR_ERRATA_A002)) 1621 1603 return 0; 1622 1604 1623 1605 /* Read the eTSEC register at offset 0xD1C. If bits 7-14 are
+2
drivers/net/ethernet/intel/igb/igb_ethtool.c
··· 2655 2655 (hw->phy.media_type != e1000_media_type_copper)) 2656 2656 return -EOPNOTSUPP; 2657 2657 2658 + memset(&eee_curr, 0, sizeof(struct ethtool_eee)); 2659 + 2658 2660 ret_val = igb_get_eee(netdev, &eee_curr); 2659 2661 if (ret_val) 2660 2662 return ret_val;
+3 -4
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 1131 1131 p->rx_discard += rdlp(mp, RX_DISCARD_FRAME_CNT); 1132 1132 p->rx_overrun += rdlp(mp, RX_OVERRUN_FRAME_CNT); 1133 1133 spin_unlock_bh(&mp->mib_counters_lock); 1134 - 1135 - mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); 1136 1134 } 1137 1135 1138 1136 static void mib_counters_timer_wrapper(unsigned long _mp) 1139 1137 { 1140 1138 struct mv643xx_eth_private *mp = (void *)_mp; 1141 - 1142 1139 mib_counters_update(mp); 1140 + mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); 1143 1141 } 1144 1142 1145 1143 ··· 2235 2237 mp->int_mask |= INT_TX_END_0 << i; 2236 2238 } 2237 2239 2240 + add_timer(&mp->mib_counters_timer); 2238 2241 port_start(mp); 2239 2242 2240 2243 wrlp(mp, INT_MASK_EXT, INT_EXT_LINK_PHY | INT_EXT_TX); ··· 2533 2534 if (!ppdev) 2534 2535 return -ENOMEM; 2535 2536 ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 2537 + ppdev->dev.of_node = pnp; 2536 2538 2537 2539 ret = platform_device_add_resources(ppdev, &res, 1); 2538 2540 if (ret) ··· 2916 2916 mp->mib_counters_timer.data = (unsigned long)mp; 2917 2917 mp->mib_counters_timer.function = mib_counters_timer_wrapper; 2918 2918 mp->mib_counters_timer.expires = jiffies + 30 * HZ; 2919 - add_timer(&mp->mib_counters_timer); 2920 2919 2921 2920 spin_lock_init(&mp->mib_counters_lock); 2922 2921
+24 -17
drivers/net/ethernet/mellanox/mlx4/en_rx.c
··· 70 70 put_page(page); 71 71 return -ENOMEM; 72 72 } 73 - page_alloc->size = PAGE_SIZE << order; 73 + page_alloc->page_size = PAGE_SIZE << order; 74 74 page_alloc->page = page; 75 75 page_alloc->dma = dma; 76 - page_alloc->offset = frag_info->frag_align; 76 + page_alloc->page_offset = frag_info->frag_align; 77 77 /* Not doing get_page() for each frag is a big win 78 78 * on asymetric workloads. 79 79 */ 80 - atomic_set(&page->_count, page_alloc->size / frag_info->frag_stride); 80 + atomic_set(&page->_count, 81 + page_alloc->page_size / frag_info->frag_stride); 81 82 return 0; 82 83 } 83 84 ··· 97 96 for (i = 0; i < priv->num_frags; i++) { 98 97 frag_info = &priv->frag_info[i]; 99 98 page_alloc[i] = ring_alloc[i]; 100 - page_alloc[i].offset += frag_info->frag_stride; 101 - if (page_alloc[i].offset + frag_info->frag_stride <= ring_alloc[i].size) 99 + page_alloc[i].page_offset += frag_info->frag_stride; 100 + 101 + if (page_alloc[i].page_offset + frag_info->frag_stride <= 102 + ring_alloc[i].page_size) 102 103 continue; 104 + 103 105 if (mlx4_alloc_pages(priv, &page_alloc[i], frag_info, gfp)) 104 106 goto out; 105 107 } 106 108 107 109 for (i = 0; i < priv->num_frags; i++) { 108 110 frags[i] = ring_alloc[i]; 109 - dma = ring_alloc[i].dma + ring_alloc[i].offset; 111 + dma = ring_alloc[i].dma + ring_alloc[i].page_offset; 110 112 ring_alloc[i] = page_alloc[i]; 111 113 rx_desc->data[i].addr = cpu_to_be64(dma); 112 114 } ··· 121 117 frag_info = &priv->frag_info[i]; 122 118 if (page_alloc[i].page != ring_alloc[i].page) { 123 119 dma_unmap_page(priv->ddev, page_alloc[i].dma, 124 - page_alloc[i].size, PCI_DMA_FROMDEVICE); 120 + page_alloc[i].page_size, PCI_DMA_FROMDEVICE); 125 121 page = page_alloc[i].page; 126 122 atomic_set(&page->_count, 1); 127 123 put_page(page); ··· 135 131 int i) 136 132 { 137 133 const struct mlx4_en_frag_info *frag_info = &priv->frag_info[i]; 134 + u32 next_frag_end = frags[i].page_offset + 2 * frag_info->frag_stride; 138 135 139 - if (frags[i].offset + frag_info->frag_stride > frags[i].size) 140 - dma_unmap_page(priv->ddev, frags[i].dma, frags[i].size, 141 - PCI_DMA_FROMDEVICE); 136 + 137 + if (next_frag_end > frags[i].page_size) 138 + dma_unmap_page(priv->ddev, frags[i].dma, frags[i].page_size, 139 + PCI_DMA_FROMDEVICE); 142 140 143 141 if (frags[i].page) 144 142 put_page(frags[i].page); ··· 167 161 168 162 page_alloc = &ring->page_alloc[i]; 169 163 dma_unmap_page(priv->ddev, page_alloc->dma, 170 - page_alloc->size, PCI_DMA_FROMDEVICE); 164 + page_alloc->page_size, PCI_DMA_FROMDEVICE); 171 165 page = page_alloc->page; 172 166 atomic_set(&page->_count, 1); 173 167 put_page(page); ··· 190 184 i, page_count(page_alloc->page)); 191 185 192 186 dma_unmap_page(priv->ddev, page_alloc->dma, 193 - page_alloc->size, PCI_DMA_FROMDEVICE); 194 - while (page_alloc->offset + frag_info->frag_stride < page_alloc->size) { 187 + page_alloc->page_size, PCI_DMA_FROMDEVICE); 188 + while (page_alloc->page_offset + frag_info->frag_stride < 189 + page_alloc->page_size) { 195 190 put_page(page_alloc->page); 196 - page_alloc->offset += frag_info->frag_stride; 191 + page_alloc->page_offset += frag_info->frag_stride; 197 192 } 198 193 page_alloc->page = NULL; 199 194 } ··· 485 478 /* Save page reference in skb */ 486 479 __skb_frag_set_page(&skb_frags_rx[nr], frags[nr].page); 487 480 skb_frag_size_set(&skb_frags_rx[nr], frag_info->frag_size); 488 - skb_frags_rx[nr].page_offset = frags[nr].offset; 481 + skb_frags_rx[nr].page_offset = frags[nr].page_offset; 489 482 skb->truesize += frag_info->frag_stride; 490 483 frags[nr].page = NULL; 491 484 } ··· 524 517 525 518 /* Get pointer to first fragment so we could copy the headers into the 526 519 * (linear part of the) skb */ 527 - va = page_address(frags[0].page) + frags[0].offset; 520 + va = page_address(frags[0].page) + frags[0].page_offset; 528 521 529 522 if (length <= SMALL_PACKET_SIZE) { 530 523 /* We are copying all relevant data to the skb - temporarily ··· 652 645 dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), 653 646 DMA_FROM_DEVICE); 654 647 ethh = (struct ethhdr *)(page_address(frags[0].page) + 655 - frags[0].offset); 648 + frags[0].page_offset); 656 649 657 650 if (is_multicast_ether_addr(ethh->h_dest)) { 658 651 struct mlx4_mac_entry *entry;
+2 -2
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
··· 237 237 struct mlx4_en_rx_alloc { 238 238 struct page *page; 239 239 dma_addr_t dma; 240 - u32 offset; 241 - u32 size; 240 + u32 page_offset; 241 + u32 page_size; 242 242 }; 243 243 244 244 struct mlx4_en_tx_ring {
+16 -6
drivers/net/ethernet/moxa/moxart_ether.c
··· 448 448 irq = irq_of_parse_and_map(node, 0); 449 449 if (irq <= 0) { 450 450 netdev_err(ndev, "irq_of_parse_and_map failed\n"); 451 - return -EINVAL; 451 + ret = -EINVAL; 452 + goto irq_map_fail; 452 453 } 453 454 454 455 priv = netdev_priv(ndev); ··· 473 472 priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * 474 473 TX_DESC_NUM, &priv->tx_base, 475 474 GFP_DMA | GFP_KERNEL); 476 - if (priv->tx_desc_base == NULL) 475 + if (priv->tx_desc_base == NULL) { 476 + ret = -ENOMEM; 477 477 goto init_fail; 478 + } 478 479 479 480 priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * 480 481 RX_DESC_NUM, &priv->rx_base, 481 482 GFP_DMA | GFP_KERNEL); 482 - if (priv->rx_desc_base == NULL) 483 + if (priv->rx_desc_base == NULL) { 484 + ret = -ENOMEM; 483 485 goto init_fail; 486 + } 484 487 485 488 priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, 486 489 GFP_ATOMIC); 487 - if (!priv->tx_buf_base) 490 + if (!priv->tx_buf_base) { 491 + ret = -ENOMEM; 488 492 goto init_fail; 493 + } 489 494 490 495 priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, 491 496 GFP_ATOMIC); 492 - if (!priv->rx_buf_base) 497 + if (!priv->rx_buf_base) { 498 + ret = -ENOMEM; 493 499 goto init_fail; 500 + } 494 501 495 502 platform_set_drvdata(pdev, ndev); 496 503 ··· 531 522 init_fail: 532 523 netdev_err(ndev, "init failed\n"); 533 524 moxart_mac_free_memory(ndev); 534 - 525 + irq_map_fail: 526 + free_netdev(ndev); 535 527 return ret; 536 528 } 537 529
+1 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
··· 665 665 return err; 666 666 } 667 667 668 - if (channel->tx_count) { 668 + if (qlcnic_82xx_check(adapter) && channel->tx_count) { 669 669 err = qlcnic_validate_max_tx_rings(adapter, channel->tx_count); 670 670 if (err) 671 671 return err;
+5 -8
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 2257 2257 2258 2258 err = qlcnic_alloc_adapter_resources(adapter); 2259 2259 if (err) 2260 - goto err_out_free_netdev; 2260 + goto err_out_free_wq; 2261 2261 2262 2262 adapter->dev_rst_time = jiffies; 2263 2263 adapter->ahw->revision_id = pdev->revision; ··· 2395 2395 2396 2396 err_out_free_hw: 2397 2397 qlcnic_free_adapter_resources(adapter); 2398 + 2399 + err_out_free_wq: 2400 + destroy_workqueue(adapter->qlcnic_wq); 2398 2401 2399 2402 err_out_free_netdev: 2400 2403 free_netdev(netdev); ··· 3651 3648 u8 max_hw = QLCNIC_MAX_TX_RINGS; 3652 3649 u32 max_allowed; 3653 3650 3654 - if (!qlcnic_82xx_check(adapter)) { 3655 - netdev_err(netdev, "No Multi TX-Q support\n"); 3656 - return -EINVAL; 3657 - } 3658 - 3659 3651 if (!qlcnic_use_msi_x && !qlcnic_use_msi) { 3660 3652 netdev_err(netdev, "No Multi TX-Q support in INT-x mode\n"); 3661 3653 return -EINVAL; ··· 3690 3692 u8 max_hw = adapter->ahw->max_rx_ques; 3691 3693 u32 max_allowed; 3692 3694 3693 - if (qlcnic_82xx_check(adapter) && !qlcnic_use_msi_x && 3694 - !qlcnic_use_msi) { 3695 + if (!qlcnic_use_msi_x && !qlcnic_use_msi) { 3695 3696 netdev_err(netdev, "No RSS support in INT-x mode\n"); 3696 3697 return -EINVAL; 3697 3698 }
+4
drivers/net/ethernet/renesas/sh_eth.c
··· 688 688 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | 689 689 EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE | 690 690 EESR_TDE | EESR_ECI, 691 + .fdr_value = 0x0000070f, 692 + .rmcr_value = 0x00000001, 691 693 692 694 .apr = 1, 693 695 .mpr = 1, 694 696 .tpauser = 1, 695 697 .bculr = 1, 696 698 .hw_swap = 1, 699 + .rpadir = 1, 700 + .rpadir_value = 2 << 16, 697 701 .no_trimd = 1, 698 702 .no_ade = 1, 699 703 .tsu = 1,
+63 -20
drivers/net/ethernet/sfc/ef10.c
··· 444 444 EF10_DMA_STAT(rx_align_error, RX_ALIGN_ERROR_PKTS), 445 445 EF10_DMA_STAT(rx_length_error, RX_LENGTH_ERROR_PKTS), 446 446 EF10_DMA_STAT(rx_nodesc_drops, RX_NODESC_DROPS), 447 + EF10_DMA_STAT(rx_pm_trunc_bb_overflow, PM_TRUNC_BB_OVERFLOW), 448 + EF10_DMA_STAT(rx_pm_discard_bb_overflow, PM_DISCARD_BB_OVERFLOW), 449 + EF10_DMA_STAT(rx_pm_trunc_vfifo_full, PM_TRUNC_VFIFO_FULL), 450 + EF10_DMA_STAT(rx_pm_discard_vfifo_full, PM_DISCARD_VFIFO_FULL), 451 + EF10_DMA_STAT(rx_pm_trunc_qbb, PM_TRUNC_QBB), 452 + EF10_DMA_STAT(rx_pm_discard_qbb, PM_DISCARD_QBB), 453 + EF10_DMA_STAT(rx_pm_discard_mapping, PM_DISCARD_MAPPING), 454 + EF10_DMA_STAT(rx_dp_q_disabled_packets, RXDP_Q_DISABLED_PKTS), 455 + EF10_DMA_STAT(rx_dp_di_dropped_packets, RXDP_DI_DROPPED_PKTS), 456 + EF10_DMA_STAT(rx_dp_streaming_packets, RXDP_STREAMING_PKTS), 457 + EF10_DMA_STAT(rx_dp_emerg_fetch, RXDP_EMERGENCY_FETCH_CONDITIONS), 458 + EF10_DMA_STAT(rx_dp_emerg_wait, RXDP_EMERGENCY_WAIT_CONDITIONS), 447 459 }; 448 460 449 461 #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_tx_bytes) | \ ··· 510 498 #define HUNT_40G_EXTRA_STAT_MASK ((1ULL << EF10_STAT_rx_align_error) | \ 511 499 (1ULL << EF10_STAT_rx_length_error)) 512 500 513 - #if BITS_PER_LONG == 64 514 - #define STAT_MASK_BITMAP(bits) (bits) 515 - #else 516 - #define STAT_MASK_BITMAP(bits) (bits) & 0xffffffff, (bits) >> 32 517 - #endif 501 + /* These statistics are only provided if the firmware supports the 502 + * capability PM_AND_RXDP_COUNTERS. 503 + */ 504 + #define HUNT_PM_AND_RXDP_STAT_MASK ( \ 505 + (1ULL << EF10_STAT_rx_pm_trunc_bb_overflow) | \ 506 + (1ULL << EF10_STAT_rx_pm_discard_bb_overflow) | \ 507 + (1ULL << EF10_STAT_rx_pm_trunc_vfifo_full) | \ 508 + (1ULL << EF10_STAT_rx_pm_discard_vfifo_full) | \ 509 + (1ULL << EF10_STAT_rx_pm_trunc_qbb) | \ 510 + (1ULL << EF10_STAT_rx_pm_discard_qbb) | \ 511 + (1ULL << EF10_STAT_rx_pm_discard_mapping) | \ 512 + (1ULL << EF10_STAT_rx_dp_q_disabled_packets) | \ 513 + (1ULL << EF10_STAT_rx_dp_di_dropped_packets) | \ 514 + (1ULL << EF10_STAT_rx_dp_streaming_packets) | \ 515 + (1ULL << EF10_STAT_rx_dp_emerg_fetch) | \ 516 + (1ULL << EF10_STAT_rx_dp_emerg_wait)) 518 517 519 - static const unsigned long *efx_ef10_stat_mask(struct efx_nic *efx) 518 + static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) 520 519 { 521 - static const unsigned long hunt_40g_stat_mask[] = { 522 - STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | 523 - HUNT_40G_EXTRA_STAT_MASK) 524 - }; 525 - static const unsigned long hunt_10g_only_stat_mask[] = { 526 - STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | 527 - HUNT_10G_ONLY_STAT_MASK) 528 - }; 520 + u64 raw_mask = HUNT_COMMON_STAT_MASK; 529 521 u32 port_caps = efx_mcdi_phy_get_caps(efx); 522 + struct efx_ef10_nic_data *nic_data = efx->nic_data; 530 523 531 524 if (port_caps & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) 532 - return hunt_40g_stat_mask; 525 + raw_mask |= HUNT_40G_EXTRA_STAT_MASK; 533 526 else 534 - return hunt_10g_only_stat_mask; 527 + raw_mask |= HUNT_10G_ONLY_STAT_MASK; 528 + 529 + if (nic_data->datapath_caps & 530 + (1 << MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN)) 531 + raw_mask |= HUNT_PM_AND_RXDP_STAT_MASK; 532 + 533 + return raw_mask; 534 + } 535 + 536 + static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) 537 + { 538 + u64 raw_mask = efx_ef10_raw_stat_mask(efx); 539 + 540 + #if BITS_PER_LONG == 64 541 + mask[0] = raw_mask; 542 + #else 543 + mask[0] = raw_mask & 0xffffffff; 544 + mask[1] = raw_mask >> 32; 545 + #endif 535 546 } 536 547 537 548 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) 538 549 { 550 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 551 + 552 + efx_ef10_get_stat_mask(efx, mask); 539 553 return efx_nic_describe_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, 540 - efx_ef10_stat_mask(efx), names); 554 + mask, names); 541 555 } 542 556 543 557 static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) 544 558 { 545 559 struct efx_ef10_nic_data *nic_data = efx->nic_data; 546 - const unsigned long *stats_mask = efx_ef10_stat_mask(efx); 560 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 547 561 __le64 generation_start, generation_end; 548 562 u64 *stats = nic_data->stats; 549 563 __le64 *dma_stats; 564 + 565 + efx_ef10_get_stat_mask(efx, mask); 550 566 551 567 dma_stats = efx->stats_buffer.addr; 552 568 nic_data = efx->nic_data; ··· 583 543 if (generation_end == EFX_MC_STATS_GENERATION_INVALID) 584 544 return 0; 585 545 rmb(); 586 - efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, stats_mask, 546 + efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, mask, 587 547 stats, efx->stats_buffer.addr, false); 548 + rmb(); 588 549 generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; 589 550 if (generation_end != generation_start) 590 551 return -EAGAIN; ··· 604 563 static size_t efx_ef10_update_stats(struct efx_nic *efx, u64 *full_stats, 605 564 struct rtnl_link_stats64 *core_stats) 606 565 { 607 - const unsigned long *mask = efx_ef10_stat_mask(efx); 566 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 608 567 struct efx_ef10_nic_data *nic_data = efx->nic_data; 609 568 u64 *stats = nic_data->stats; 610 569 size_t stats_count = 0, index; 611 570 int retry; 571 + 572 + efx_ef10_get_stat_mask(efx, mask); 612 573 613 574 /* If we're unlucky enough to read statistics during the DMA, wait 614 575 * up to 10ms for it to finish (typically takes <500us)
+17 -1
drivers/net/ethernet/sfc/mcdi.c
··· 963 963 bool *was_attached) 964 964 { 965 965 MCDI_DECLARE_BUF(inbuf, MC_CMD_DRV_ATTACH_IN_LEN); 966 - MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_OUT_LEN); 966 + MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_EXT_OUT_LEN); 967 967 size_t outlen; 968 968 int rc; 969 969 ··· 979 979 if (outlen < MC_CMD_DRV_ATTACH_OUT_LEN) { 980 980 rc = -EIO; 981 981 goto fail; 982 + } 983 + 984 + /* We currently assume we have control of the external link 985 + * and are completely trusted by firmware. Abort probing 986 + * if that's not true for this function. 987 + */ 988 + if (driver_operating && 989 + outlen >= MC_CMD_DRV_ATTACH_EXT_OUT_LEN && 990 + (MCDI_DWORD(outbuf, DRV_ATTACH_EXT_OUT_FUNC_FLAGS) & 991 + (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL | 992 + 1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) != 993 + (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL | 994 + 1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) { 995 + netif_err(efx, probe, efx->net_dev, 996 + "This driver version only supports one function per port\n"); 997 + return -ENODEV; 982 998 } 983 999 984 1000 if (was_attached != NULL)
+54 -2
drivers/net/ethernet/sfc/mcdi_pcol.h
··· 2574 2574 #define MC_CMD_MAC_RX_LANES01_DISP_ERR 0x39 /* enum */ 2575 2575 #define MC_CMD_MAC_RX_LANES23_DISP_ERR 0x3a /* enum */ 2576 2576 #define MC_CMD_MAC_RX_MATCH_FAULT 0x3b /* enum */ 2577 - #define MC_CMD_GMAC_DMABUF_START 0x40 /* enum */ 2578 - #define MC_CMD_GMAC_DMABUF_END 0x5f /* enum */ 2577 + /* enum: PM trunc_bb_overflow counter. Valid for EF10 with PM_AND_RXDP_COUNTERS 2578 + * capability only. 2579 + */ 2580 + #define MC_CMD_MAC_PM_TRUNC_BB_OVERFLOW 0x3c 2581 + /* enum: PM discard_bb_overflow counter. Valid for EF10 with 2582 + * PM_AND_RXDP_COUNTERS capability only. 2583 + */ 2584 + #define MC_CMD_MAC_PM_DISCARD_BB_OVERFLOW 0x3d 2585 + /* enum: PM trunc_vfifo_full counter. Valid for EF10 with PM_AND_RXDP_COUNTERS 2586 + * capability only. 2587 + */ 2588 + #define MC_CMD_MAC_PM_TRUNC_VFIFO_FULL 0x3e 2589 + /* enum: PM discard_vfifo_full counter. Valid for EF10 with 2590 + * PM_AND_RXDP_COUNTERS capability only. 2591 + */ 2592 + #define MC_CMD_MAC_PM_DISCARD_VFIFO_FULL 0x3f 2593 + /* enum: PM trunc_qbb counter. Valid for EF10 with PM_AND_RXDP_COUNTERS 2594 + * capability only. 2595 + */ 2596 + #define MC_CMD_MAC_PM_TRUNC_QBB 0x40 2597 + /* enum: PM discard_qbb counter. Valid for EF10 with PM_AND_RXDP_COUNTERS 2598 + * capability only. 2599 + */ 2600 + #define MC_CMD_MAC_PM_DISCARD_QBB 0x41 2601 + /* enum: PM discard_mapping counter. Valid for EF10 with PM_AND_RXDP_COUNTERS 2602 + * capability only. 2603 + */ 2604 + #define MC_CMD_MAC_PM_DISCARD_MAPPING 0x42 2605 + /* enum: RXDP counter: Number of packets dropped due to the queue being 2606 + * disabled. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. 2607 + */ 2608 + #define MC_CMD_MAC_RXDP_Q_DISABLED_PKTS 0x43 2609 + /* enum: RXDP counter: Number of packets dropped by the DICPU. Valid for EF10 2610 + * with PM_AND_RXDP_COUNTERS capability only. 2611 + */ 2612 + #define MC_CMD_MAC_RXDP_DI_DROPPED_PKTS 0x45 2613 + /* enum: RXDP counter: Number of non-host packets. Valid for EF10 with 2614 + * PM_AND_RXDP_COUNTERS capability only. 2615 + */ 2616 + #define MC_CMD_MAC_RXDP_STREAMING_PKTS 0x46 2617 + /* enum: RXDP counter: Number of times an emergency descriptor fetch was 2618 + * performed. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. 2619 + */ 2620 + #define MC_CMD_MAC_RXDP_EMERGENCY_FETCH_CONDITIONS 0x47 2621 + /* enum: RXDP counter: Number of times the DPCPU waited for an existing 2622 + * descriptor fetch. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. 2623 + */ 2624 + #define MC_CMD_MAC_RXDP_EMERGENCY_WAIT_CONDITIONS 0x48 2625 + /* enum: Start of GMAC stats buffer space, for Siena only. */ 2626 + #define MC_CMD_GMAC_DMABUF_START 0x40 2627 + /* enum: End of GMAC stats buffer space, for Siena only. */ 2628 + #define MC_CMD_GMAC_DMABUF_END 0x5f 2579 2629 #define MC_CMD_MAC_GENERATION_END 0x60 /* enum */ 2580 2630 #define MC_CMD_MAC_NSTATS 0x61 /* enum */ 2581 2631 ··· 5115 5065 #define MC_CMD_GET_CAPABILITIES_OUT_RX_BATCHING_WIDTH 1 5116 5066 #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_LBN 26 5117 5067 #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_WIDTH 1 5068 + #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN 27 5069 + #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1 5118 5070 /* RxDPCPU firmware id. */ 5119 5071 #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_OFST 4 5120 5072 #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_LEN 2
+3 -6
drivers/net/ethernet/sfc/nic.c
··· 469 469 * @count: Length of the @desc array 470 470 * @mask: Bitmask of which elements of @desc are enabled 471 471 * @stats: Buffer to update with the converted statistics. The length 472 - * of this array must be at least the number of set bits in the 473 - * first @count bits of @mask. 472 + * of this array must be at least @count. 474 473 * @dma_buf: DMA buffer containing hardware statistics 475 474 * @accumulate: If set, the converted values will be added rather than 476 475 * directly stored to the corresponding elements of @stats ··· 502 503 } 503 504 504 505 if (accumulate) 505 - *stats += val; 506 + stats[index] += val; 506 507 else 507 - *stats = val; 508 + stats[index] = val; 508 509 } 509 - 510 - ++stats; 511 510 } 512 511 }
+12
drivers/net/ethernet/sfc/nic.h
··· 386 386 EF10_STAT_rx_align_error, 387 387 EF10_STAT_rx_length_error, 388 388 EF10_STAT_rx_nodesc_drops, 389 + EF10_STAT_rx_pm_trunc_bb_overflow, 390 + EF10_STAT_rx_pm_discard_bb_overflow, 391 + EF10_STAT_rx_pm_trunc_vfifo_full, 392 + EF10_STAT_rx_pm_discard_vfifo_full, 393 + EF10_STAT_rx_pm_trunc_qbb, 394 + EF10_STAT_rx_pm_discard_qbb, 395 + EF10_STAT_rx_pm_discard_mapping, 396 + EF10_STAT_rx_dp_q_disabled_packets, 397 + EF10_STAT_rx_dp_di_dropped_packets, 398 + EF10_STAT_rx_dp_streaming_packets, 399 + EF10_STAT_rx_dp_emerg_fetch, 400 + EF10_STAT_rx_dp_emerg_wait, 389 401 EF10_STAT_COUNT 390 402 }; 391 403
+2 -4
drivers/net/ethernet/smsc/smc91x.h
··· 1124 1124 void __iomem *__ioaddr = ioaddr; \ 1125 1125 if (__len >= 2 && (unsigned long)__ptr & 2) { \ 1126 1126 __len -= 2; \ 1127 - SMC_outw(*(u16 *)__ptr, ioaddr, \ 1128 - DATA_REG(lp)); \ 1127 + SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \ 1129 1128 __ptr += 2; \ 1130 1129 } \ 1131 1130 if (SMC_CAN_USE_DATACS && lp->datacs) \ ··· 1132 1133 SMC_outsl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \ 1133 1134 if (__len & 2) { \ 1134 1135 __ptr += (__len & ~3); \ 1135 - SMC_outw(*((u16 *)__ptr), ioaddr, \ 1136 - DATA_REG(lp)); \ 1136 + SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \ 1137 1137 } \ 1138 1138 } else if (SMC_16BIT(lp)) \ 1139 1139 SMC_outsw(ioaddr, DATA_REG(lp), p, (l) >> 1); \
+8 -11
drivers/net/ethernet/ti/cpsw.c
··· 639 639 static irqreturn_t cpsw_interrupt(int irq, void *dev_id) 640 640 { 641 641 struct cpsw_priv *priv = dev_id; 642 - u32 rx, tx, rx_thresh; 643 - 644 - rx_thresh = __raw_readl(&priv->wr_regs->rx_thresh_stat); 645 - rx = __raw_readl(&priv->wr_regs->rx_stat); 646 - tx = __raw_readl(&priv->wr_regs->tx_stat); 647 - if (!rx_thresh && !rx && !tx) 648 - return IRQ_NONE; 649 642 650 643 cpsw_intr_disable(priv); 651 644 if (priv->irq_enabled == true) { ··· 1162 1169 } 1163 1170 } 1164 1171 1172 + napi_enable(&priv->napi); 1165 1173 cpdma_ctlr_start(priv->dma); 1166 1174 cpsw_intr_enable(priv); 1167 - napi_enable(&priv->napi); 1168 1175 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); 1169 1176 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); 1170 1177 ··· 1764 1771 } 1765 1772 data->mac_control = prop; 1766 1773 1767 - if (!of_property_read_u32(node, "dual_emac", &prop)) 1768 - data->dual_emac = prop; 1774 + if (of_property_read_bool(node, "dual_emac")) 1775 + data->dual_emac = 1; 1769 1776 1770 1777 /* 1771 1778 * Populate all the child nodes here... ··· 1775 1782 if (ret) 1776 1783 pr_warn("Doesn't have any child node\n"); 1777 1784 1778 - for_each_node_by_name(slave_node, "slave") { 1785 + for_each_child_of_node(node, slave_node) { 1779 1786 struct cpsw_slave_data *slave_data = data->slave_data + i; 1780 1787 const void *mac_addr = NULL; 1781 1788 u32 phyid; ··· 1783 1790 const __be32 *parp; 1784 1791 struct device_node *mdio_node; 1785 1792 struct platform_device *mdio; 1793 + 1794 + /* This is no slave child node, continue */ 1795 + if (strcmp(slave_node->name, "slave")) 1796 + continue; 1786 1797 1787 1798 parp = of_get_property(slave_node, "phy_id", &lenp); 1788 1799 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
+1 -2
drivers/net/ethernet/ti/davinci_emac.c
··· 876 876 netdev_mc_count(ndev) > EMAC_DEF_MAX_MULTICAST_ADDRESSES) { 877 877 mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST); 878 878 emac_add_mcast(priv, EMAC_ALL_MULTI_SET, NULL); 879 - } 880 - if (!netdev_mc_empty(ndev)) { 879 + } else if (!netdev_mc_empty(ndev)) { 881 880 struct netdev_hw_addr *ha; 882 881 883 882 mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
-1
drivers/net/hamradio/yam.c
··· 975 975 return -EINVAL; /* Cannot change this parameter when up */ 976 976 if ((ym = kmalloc(sizeof(struct yamdrv_ioctl_mcs), GFP_KERNEL)) == NULL) 977 977 return -ENOBUFS; 978 - ym->bitrate = 9600; 979 978 if (copy_from_user(ym, ifr->ifr_data, sizeof(struct yamdrv_ioctl_mcs))) { 980 979 kfree(ym); 981 980 return -EFAULT;
+9 -22
drivers/net/ieee802154/mrf24j40.c
··· 82 82 83 83 struct mutex buffer_mutex; /* only used to protect buf */ 84 84 struct completion tx_complete; 85 - struct work_struct irqwork; 86 85 u8 *buf; /* 3 bytes. Used for SPI single-register transfers. */ 87 86 }; 88 87 ··· 343 344 if (ret) 344 345 goto err; 345 346 347 + INIT_COMPLETION(devrec->tx_complete); 348 + 346 349 /* Set TXNTRIG bit of TXNCON to send packet */ 347 350 ret = read_short_reg(devrec, REG_TXNCON, &val); 348 351 if (ret) ··· 354 353 if (skb->data[0] & IEEE802154_FC_ACK_REQ) 355 354 val |= 0x4; 356 355 write_short_reg(devrec, REG_TXNCON, val); 357 - 358 - INIT_COMPLETION(devrec->tx_complete); 359 356 360 357 /* Wait for the device to send the TX complete interrupt. */ 361 358 ret = wait_for_completion_interruptible_timeout( ··· 589 590 static irqreturn_t mrf24j40_isr(int irq, void *data) 590 591 { 591 592 struct mrf24j40 *devrec = data; 592 - 593 - disable_irq_nosync(irq); 594 - 595 - schedule_work(&devrec->irqwork); 596 - 597 - return IRQ_HANDLED; 598 - } 599 - 600 - static void mrf24j40_isrwork(struct work_struct *work) 601 - { 602 - struct mrf24j40 *devrec = container_of(work, struct mrf24j40, irqwork); 603 593 u8 intstat; 604 594 int ret; 605 595 ··· 606 618 mrf24j40_handle_rx(devrec); 607 619 608 620 out: 609 - enable_irq(devrec->spi->irq); 621 + return IRQ_HANDLED; 610 622 } 611 623 612 624 static int mrf24j40_probe(struct spi_device *spi) ··· 630 642 631 643 mutex_init(&devrec->buffer_mutex); 632 644 init_completion(&devrec->tx_complete); 633 - INIT_WORK(&devrec->irqwork, mrf24j40_isrwork); 634 645 devrec->spi = spi; 635 646 spi_set_drvdata(spi, devrec); 636 647 ··· 675 688 val &= ~0x3; /* Clear RX mode (normal) */ 676 689 write_short_reg(devrec, REG_RXMCR, val); 677 690 678 - ret = request_irq(spi->irq, 679 - mrf24j40_isr, 680 - IRQF_TRIGGER_FALLING, 681 - dev_name(&spi->dev), 682 - devrec); 691 + ret = request_threaded_irq(spi->irq, 692 + NULL, 693 + mrf24j40_isr, 694 + IRQF_TRIGGER_LOW|IRQF_ONESHOT, 695 + dev_name(&spi->dev), 696 + devrec); 683 697 684 698 if (ret) { 685 699 dev_err(printdev(devrec), "Unable to get IRQ"); ··· 709 721 dev_dbg(printdev(devrec), "remove\n"); 710 722 711 723 free_irq(spi->irq, devrec); 712 - flush_work(&devrec->irqwork); /* TODO: Is this the right call? */ 713 724 ieee802154_unregister_device(devrec->dev); 714 725 ieee802154_free_device(devrec->dev); 715 726 /* TODO: Will ieee802154_free_device() wait until ->xmit() is
+5 -3
drivers/net/tun.c
··· 1293 1293 if (unlikely(!noblock)) 1294 1294 add_wait_queue(&tfile->wq.wait, &wait); 1295 1295 while (len) { 1296 - current->state = TASK_INTERRUPTIBLE; 1296 + if (unlikely(!noblock)) 1297 + current->state = TASK_INTERRUPTIBLE; 1297 1298 1298 1299 /* Read frames from the queue */ 1299 1300 if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) { ··· 1321 1320 break; 1322 1321 } 1323 1322 1324 - current->state = TASK_RUNNING; 1325 - if (unlikely(!noblock)) 1323 + if (unlikely(!noblock)) { 1324 + current->state = TASK_RUNNING; 1326 1325 remove_wait_queue(&tfile->wq.wait, &wait); 1326 + } 1327 1327 1328 1328 return ret; 1329 1329 }
+20 -3
drivers/net/usb/ax88179_178a.c
··· 36 36 #define AX_RXHDR_L4_TYPE_TCP 16 37 37 #define AX_RXHDR_L3CSUM_ERR 2 38 38 #define AX_RXHDR_L4CSUM_ERR 1 39 - #define AX_RXHDR_CRC_ERR ((u32)BIT(31)) 40 - #define AX_RXHDR_DROP_ERR ((u32)BIT(30)) 39 + #define AX_RXHDR_CRC_ERR ((u32)BIT(29)) 40 + #define AX_RXHDR_DROP_ERR ((u32)BIT(31)) 41 41 #define AX_ACCESS_MAC 0x01 42 42 #define AX_ACCESS_PHY 0x02 43 43 #define AX_ACCESS_EEPROM 0x04 ··· 1406 1406 .tx_fixup = ax88179_tx_fixup, 1407 1407 }; 1408 1408 1409 + static const struct driver_info samsung_info = { 1410 + .description = "Samsung USB Ethernet Adapter", 1411 + .bind = ax88179_bind, 1412 + .unbind = ax88179_unbind, 1413 + .status = ax88179_status, 1414 + .link_reset = ax88179_link_reset, 1415 + .reset = ax88179_reset, 1416 + .stop = ax88179_stop, 1417 + .flags = FLAG_ETHER | FLAG_FRAMING_AX, 1418 + .rx_fixup = ax88179_rx_fixup, 1419 + .tx_fixup = ax88179_tx_fixup, 1420 + }; 1421 + 1409 1422 static const struct usb_device_id products[] = { 1410 1423 { 1411 1424 /* ASIX AX88179 10/100/1000 */ ··· 1431 1418 }, { 1432 1419 /* Sitecom USB 3.0 to Gigabit Adapter */ 1433 1420 USB_DEVICE(0x0df6, 0x0072), 1434 - .driver_info = (unsigned long) &sitecom_info, 1421 + .driver_info = (unsigned long)&sitecom_info, 1422 + }, { 1423 + /* Samsung USB Ethernet Adapter */ 1424 + USB_DEVICE(0x04e8, 0xa100), 1425 + .driver_info = (unsigned long)&samsung_info, 1435 1426 }, 1436 1427 { }, 1437 1428 };
+1
drivers/net/usb/qmi_wwan.c
··· 714 714 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ 715 715 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ 716 716 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ 717 + {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */ 717 718 {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ 718 719 719 720 /* 4. Gobi 1000 devices */
+3 -1
drivers/net/usb/usbnet.c
··· 1688 1688 if (dev->can_dma_sg && !(info->flags & FLAG_SEND_ZLP) && 1689 1689 !(info->flags & FLAG_MULTI_PACKET)) { 1690 1690 dev->padding_pkt = kzalloc(1, GFP_KERNEL); 1691 - if (!dev->padding_pkt) 1691 + if (!dev->padding_pkt) { 1692 + status = -ENOMEM; 1692 1693 goto out4; 1694 + } 1693 1695 } 1694 1696 1695 1697 status = register_netdev (net);
+13 -1
drivers/net/virtio_net.c
··· 938 938 return -EINVAL; 939 939 } else { 940 940 vi->curr_queue_pairs = queue_pairs; 941 - schedule_delayed_work(&vi->refill, 0); 941 + /* virtnet_open() will refill when device is going to up. */ 942 + if (dev->flags & IFF_UP) 943 + schedule_delayed_work(&vi->refill, 0); 942 944 } 943 945 944 946 return 0; ··· 1118 1116 { 1119 1117 struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb); 1120 1118 1119 + mutex_lock(&vi->config_lock); 1120 + 1121 + if (!vi->config_enable) 1122 + goto done; 1123 + 1121 1124 switch(action & ~CPU_TASKS_FROZEN) { 1122 1125 case CPU_ONLINE: 1123 1126 case CPU_DOWN_FAILED: ··· 1135 1128 default: 1136 1129 break; 1137 1130 } 1131 + 1132 + done: 1133 + mutex_unlock(&vi->config_lock); 1138 1134 return NOTIFY_OK; 1139 1135 } 1140 1136 ··· 1743 1733 vi->config_enable = true; 1744 1734 mutex_unlock(&vi->config_lock); 1745 1735 1736 + rtnl_lock(); 1746 1737 virtnet_set_queues(vi, vi->curr_queue_pairs); 1738 + rtnl_unlock(); 1747 1739 1748 1740 return 0; 1749 1741 }
+1
drivers/net/wan/farsync.c
··· 1972 1972 } 1973 1973 1974 1974 i = port->index; 1975 + memset(&sync, 0, sizeof(sync)); 1975 1976 sync.clock_rate = FST_RDL(card, portConfig[i].lineSpeed); 1976 1977 /* Lucky card and linux use same encoding here */ 1977 1978 sync.clock_type = FST_RDB(card, portConfig[i].internalClock) ==
+1
drivers/net/wan/wanxl.c
··· 355 355 ifr->ifr_settings.size = size; /* data size wanted */ 356 356 return -ENOBUFS; 357 357 } 358 + memset(&line, 0, sizeof(line)); 358 359 line.clock_type = get_status(port)->clocking; 359 360 line.clock_rate = 0; 360 361 line.loopback = 0;
+11 -12
drivers/net/wireless/ath/ath9k/main.c
··· 208 208 struct ath_hw *ah = sc->sc_ah; 209 209 struct ath_common *common = ath9k_hw_common(ah); 210 210 unsigned long flags; 211 + int i; 211 212 212 213 if (ath_startrecv(sc) != 0) { 213 214 ath_err(common, "Unable to restart recv logic\n"); ··· 236 235 } 237 236 work: 238 237 ath_restart_work(sc); 238 + 239 + for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 240 + if (!ATH_TXQ_SETUP(sc, i)) 241 + continue; 242 + 243 + spin_lock_bh(&sc->tx.txq[i].axq_lock); 244 + ath_txq_schedule(sc, &sc->tx.txq[i]); 245 + spin_unlock_bh(&sc->tx.txq[i].axq_lock); 246 + } 239 247 } 240 248 241 249 ieee80211_wake_queues(sc->hw); ··· 549 539 550 540 static int ath_reset(struct ath_softc *sc) 551 541 { 552 - int i, r; 542 + int r; 553 543 554 544 ath9k_ps_wakeup(sc); 555 - 556 545 r = ath_reset_internal(sc, NULL); 557 - 558 - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 559 - if (!ATH_TXQ_SETUP(sc, i)) 560 - continue; 561 - 562 - spin_lock_bh(&sc->tx.txq[i].axq_lock); 563 - ath_txq_schedule(sc, &sc->tx.txq[i]); 564 - spin_unlock_bh(&sc->tx.txq[i].axq_lock); 565 - } 566 - 567 546 ath9k_ps_restore(sc); 568 547 569 548 return r;
+6 -3
drivers/net/wireless/ath/ath9k/xmit.c
··· 1969 1969 static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, 1970 1970 struct ath_atx_tid *tid, struct sk_buff *skb) 1971 1971 { 1972 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 1972 1973 struct ath_frame_info *fi = get_frame_info(skb); 1973 1974 struct list_head bf_head; 1974 - struct ath_buf *bf; 1975 - 1976 - bf = fi->bf; 1975 + struct ath_buf *bf = fi->bf; 1977 1976 1978 1977 INIT_LIST_HEAD(&bf_head); 1979 1978 list_add_tail(&bf->list, &bf_head); 1980 1979 bf->bf_state.bf_type = 0; 1980 + if (tid && (tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { 1981 + bf->bf_state.bf_type = BUF_AMPDU; 1982 + ath_tx_addto_baw(sc, tid, bf); 1983 + } 1981 1984 1982 1985 bf->bf_next = NULL; 1983 1986 bf->bf_lastbf = bf;
+2
drivers/net/wireless/cw1200/cw1200_spi.c
··· 237 237 struct hwbus_priv *self = dev_id; 238 238 239 239 if (self->core) { 240 + cw1200_spi_lock(self); 240 241 cw1200_irq_handler(self->core); 242 + cw1200_spi_unlock(self); 241 243 return IRQ_HANDLED; 242 244 } else { 243 245 return IRQ_NONE;
+6
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 240 240 .ht_params = &iwl6000_ht_params, 241 241 }; 242 242 243 + const struct iwl_cfg iwl6035_2agn_sff_cfg = { 244 + .name = "Intel(R) Centrino(R) Ultimate-N 6235 AGN", 245 + IWL_DEVICE_6035, 246 + .ht_params = &iwl6000_ht_params, 247 + }; 248 + 243 249 const struct iwl_cfg iwl1030_bgn_cfg = { 244 250 .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN", 245 251 IWL_DEVICE_6030,
+1
drivers/net/wireless/iwlwifi/iwl-config.h
··· 280 280 extern const struct iwl_cfg iwl2000_2bgn_d_cfg; 281 281 extern const struct iwl_cfg iwl2030_2bgn_cfg; 282 282 extern const struct iwl_cfg iwl6035_2agn_cfg; 283 + extern const struct iwl_cfg iwl6035_2agn_sff_cfg; 283 284 extern const struct iwl_cfg iwl105_bgn_cfg; 284 285 extern const struct iwl_cfg iwl105_bgn_d_cfg; 285 286 extern const struct iwl_cfg iwl135_bgn_cfg;
+4 -2
drivers/net/wireless/iwlwifi/iwl-trans.h
··· 601 601 { 602 602 int ret; 603 603 604 - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, 605 - "%s bad state = %d", __func__, trans->state); 604 + if (trans->state != IWL_TRANS_FW_ALIVE) { 605 + IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); 606 + return -EIO; 607 + } 606 608 607 609 if (!(cmd->flags & CMD_ASYNC)) 608 610 lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
+4 -1
drivers/net/wireless/iwlwifi/mvm/power.c
··· 273 273 if (!mvmvif->queue_params[ac].uapsd) 274 274 continue; 275 275 276 - cmd->flags |= cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK); 276 + if (mvm->cur_ucode != IWL_UCODE_WOWLAN) 277 + cmd->flags |= 278 + cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK); 279 + 277 280 cmd->uapsd_ac_flags |= BIT(ac); 278 281 279 282 /* QNDP TID - the highest TID with no admission control */
+11 -1
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 394 394 return false; 395 395 } 396 396 397 + /* 398 + * If scan cannot be aborted, it means that we had a 399 + * SCAN_COMPLETE_NOTIFICATION in the pipe and it called 400 + * ieee80211_scan_completed already. 401 + */ 397 402 IWL_DEBUG_SCAN(mvm, "Scan cannot be aborted, exit now: %d\n", 398 403 *resp); 399 404 return true; ··· 422 417 SCAN_COMPLETE_NOTIFICATION }; 423 418 int ret; 424 419 420 + if (mvm->scan_status == IWL_MVM_SCAN_NONE) 421 + return; 422 + 425 423 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, 426 424 scan_abort_notif, 427 425 ARRAY_SIZE(scan_abort_notif), 428 426 iwl_mvm_scan_abort_notif, NULL); 429 427 430 - ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, CMD_SYNC, 0, NULL); 428 + ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, 429 + CMD_SYNC | CMD_SEND_IN_RFKILL, 0, NULL); 431 430 if (ret) { 432 431 IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); 432 + /* mac80211's state will be cleaned in the fw_restart flow */ 433 433 goto out_remove_notif; 434 434 } 435 435
+42
drivers/net/wireless/iwlwifi/pcie/drv.c
··· 139 139 140 140 /* 6x00 Series */ 141 141 {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, 142 + {IWL_PCI_DEVICE(0x422B, 0x1108, iwl6000_3agn_cfg)}, 142 143 {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, 144 + {IWL_PCI_DEVICE(0x422B, 0x1128, iwl6000_3agn_cfg)}, 143 145 {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, 144 146 {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, 145 147 {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, 146 148 {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, 147 149 {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, 148 150 {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, 151 + {IWL_PCI_DEVICE(0x4238, 0x1118, iwl6000_3agn_cfg)}, 149 152 {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, 150 153 {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, 151 154 ··· 156 153 {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, 157 154 {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, 158 155 {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, 156 + {IWL_PCI_DEVICE(0x0082, 0x1308, iwl6005_2agn_cfg)}, 159 157 {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, 160 158 {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, 159 + {IWL_PCI_DEVICE(0x0082, 0x1328, iwl6005_2agn_cfg)}, 161 160 {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, 161 + {IWL_PCI_DEVICE(0x0085, 0x1318, iwl6005_2agn_cfg)}, 162 162 {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, 163 163 {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)}, 164 164 {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)}, 165 + {IWL_PCI_DEVICE(0x0085, 0xC228, iwl6005_2agn_sff_cfg)}, 165 166 {IWL_PCI_DEVICE(0x0082, 0x4820, iwl6005_2agn_d_cfg)}, 166 167 {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_mow1_cfg)},/* low 5GHz active */ 167 168 {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_mow2_cfg)},/* high 5GHz active */ ··· 247 240 248 241 /* 6x35 Series */ 249 242 {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, 243 + {IWL_PCI_DEVICE(0x088E, 0x406A, iwl6035_2agn_sff_cfg)}, 250 244 {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, 245 + {IWL_PCI_DEVICE(0x088F, 0x426A, iwl6035_2agn_sff_cfg)}, 251 246 {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, 247 + {IWL_PCI_DEVICE(0x088E, 0x446A, iwl6035_2agn_sff_cfg)}, 252 248 {IWL_PCI_DEVICE(0x088E, 0x4860, iwl6035_2agn_cfg)}, 253 249 {IWL_PCI_DEVICE(0x088F, 0x5260, iwl6035_2agn_cfg)}, 254 250 ··· 270 260 #if IS_ENABLED(CONFIG_IWLMVM) 271 261 /* 7000 Series */ 272 262 {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, 263 + {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)}, 273 264 {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)}, 274 265 {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)}, 266 + {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)}, 275 267 {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)}, 276 268 {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_n_cfg)}, 277 269 {IWL_PCI_DEVICE(0x08B1, 0x4162, iwl7260_n_cfg)}, 278 270 {IWL_PCI_DEVICE(0x08B2, 0x4270, iwl7260_2ac_cfg)}, 271 + {IWL_PCI_DEVICE(0x08B2, 0x4272, iwl7260_2ac_cfg)}, 279 272 {IWL_PCI_DEVICE(0x08B2, 0x4260, iwl7260_2n_cfg)}, 273 + {IWL_PCI_DEVICE(0x08B2, 0x426A, iwl7260_2n_cfg)}, 280 274 {IWL_PCI_DEVICE(0x08B2, 0x4262, iwl7260_n_cfg)}, 281 275 {IWL_PCI_DEVICE(0x08B1, 0x4470, iwl7260_2ac_cfg)}, 276 + {IWL_PCI_DEVICE(0x08B1, 0x4472, iwl7260_2ac_cfg)}, 282 277 {IWL_PCI_DEVICE(0x08B1, 0x4460, iwl7260_2n_cfg)}, 278 + {IWL_PCI_DEVICE(0x08B1, 0x446A, iwl7260_2n_cfg)}, 283 279 {IWL_PCI_DEVICE(0x08B1, 0x4462, iwl7260_n_cfg)}, 284 280 {IWL_PCI_DEVICE(0x08B1, 0x4870, iwl7260_2ac_cfg)}, 285 281 {IWL_PCI_DEVICE(0x08B1, 0x486E, iwl7260_2ac_cfg)}, 286 282 {IWL_PCI_DEVICE(0x08B1, 0x4A70, iwl7260_2ac_cfg_high_temp)}, 287 283 {IWL_PCI_DEVICE(0x08B1, 0x4A6E, iwl7260_2ac_cfg_high_temp)}, 288 284 {IWL_PCI_DEVICE(0x08B1, 0x4A6C, iwl7260_2ac_cfg_high_temp)}, 285 + {IWL_PCI_DEVICE(0x08B1, 0x4570, iwl7260_2ac_cfg)}, 286 + {IWL_PCI_DEVICE(0x08B1, 0x4560, iwl7260_2n_cfg)}, 287 + {IWL_PCI_DEVICE(0x08B2, 0x4370, iwl7260_2ac_cfg)}, 288 + {IWL_PCI_DEVICE(0x08B2, 0x4360, iwl7260_2n_cfg)}, 289 + {IWL_PCI_DEVICE(0x08B1, 0x5070, iwl7260_2ac_cfg)}, 289 290 {IWL_PCI_DEVICE(0x08B1, 0x4020, iwl7260_2n_cfg)}, 291 + {IWL_PCI_DEVICE(0x08B1, 0x402A, iwl7260_2n_cfg)}, 290 292 {IWL_PCI_DEVICE(0x08B2, 0x4220, iwl7260_2n_cfg)}, 291 293 {IWL_PCI_DEVICE(0x08B1, 0x4420, iwl7260_2n_cfg)}, 292 294 {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)}, 295 + {IWL_PCI_DEVICE(0x08B1, 0xC072, iwl7260_2ac_cfg)}, 293 296 {IWL_PCI_DEVICE(0x08B1, 0xC170, iwl7260_2ac_cfg)}, 294 297 {IWL_PCI_DEVICE(0x08B1, 0xC060, iwl7260_2n_cfg)}, 298 + {IWL_PCI_DEVICE(0x08B1, 0xC06A, iwl7260_2n_cfg)}, 295 299 {IWL_PCI_DEVICE(0x08B1, 0xC160, iwl7260_2n_cfg)}, 296 300 {IWL_PCI_DEVICE(0x08B1, 0xC062, iwl7260_n_cfg)}, 297 301 {IWL_PCI_DEVICE(0x08B1, 0xC162, iwl7260_n_cfg)}, 302 + {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)}, 303 + {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)}, 298 304 {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)}, 305 + {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)}, 299 306 {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)}, 307 + {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)}, 300 308 {IWL_PCI_DEVICE(0x08B2, 0xC262, iwl7260_n_cfg)}, 301 309 {IWL_PCI_DEVICE(0x08B1, 0xC470, iwl7260_2ac_cfg)}, 310 + {IWL_PCI_DEVICE(0x08B1, 0xC472, iwl7260_2ac_cfg)}, 302 311 {IWL_PCI_DEVICE(0x08B1, 0xC460, iwl7260_2n_cfg)}, 303 312 {IWL_PCI_DEVICE(0x08B1, 0xC462, iwl7260_n_cfg)}, 313 + {IWL_PCI_DEVICE(0x08B1, 0xC570, iwl7260_2ac_cfg)}, 314 + {IWL_PCI_DEVICE(0x08B1, 0xC560, iwl7260_2n_cfg)}, 315 + {IWL_PCI_DEVICE(0x08B2, 0xC370, iwl7260_2ac_cfg)}, 316 + {IWL_PCI_DEVICE(0x08B1, 0xC360, iwl7260_2n_cfg)}, 304 317 {IWL_PCI_DEVICE(0x08B1, 0xC020, iwl7260_2n_cfg)}, 318 + {IWL_PCI_DEVICE(0x08B1, 0xC02A, iwl7260_2n_cfg)}, 305 319 {IWL_PCI_DEVICE(0x08B2, 0xC220, iwl7260_2n_cfg)}, 306 320 {IWL_PCI_DEVICE(0x08B1, 0xC420, iwl7260_2n_cfg)}, 307 321 308 322 /* 3160 Series */ 309 323 {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_2ac_cfg)}, 324 + {IWL_PCI_DEVICE(0x08B3, 0x0072, iwl3160_2ac_cfg)}, 310 325 {IWL_PCI_DEVICE(0x08B3, 0x0170, iwl3160_2ac_cfg)}, 326 + {IWL_PCI_DEVICE(0x08B3, 0x0172, iwl3160_2ac_cfg)}, 311 327 {IWL_PCI_DEVICE(0x08B3, 0x0060, iwl3160_2n_cfg)}, 312 328 {IWL_PCI_DEVICE(0x08B3, 0x0062, iwl3160_n_cfg)}, 313 329 {IWL_PCI_DEVICE(0x08B4, 0x0270, iwl3160_2ac_cfg)}, 330 + {IWL_PCI_DEVICE(0x08B4, 0x0272, iwl3160_2ac_cfg)}, 314 331 {IWL_PCI_DEVICE(0x08B3, 0x0470, iwl3160_2ac_cfg)}, 332 + {IWL_PCI_DEVICE(0x08B3, 0x0472, iwl3160_2ac_cfg)}, 333 + {IWL_PCI_DEVICE(0x08B4, 0x0370, iwl3160_2ac_cfg)}, 315 334 {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_2ac_cfg)}, 335 + {IWL_PCI_DEVICE(0x08B3, 0x8072, iwl3160_2ac_cfg)}, 316 336 {IWL_PCI_DEVICE(0x08B3, 0x8170, iwl3160_2ac_cfg)}, 337 + {IWL_PCI_DEVICE(0x08B3, 0x8172, iwl3160_2ac_cfg)}, 317 338 {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, 318 339 {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, 319 340 {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, 320 341 {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, 342 + {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, 321 343 #endif /* CONFIG_IWLMVM */ 322 344 323 345 {0}
+4 -4
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 1401 1401 spin_lock_init(&trans_pcie->reg_lock); 1402 1402 init_waitqueue_head(&trans_pcie->ucode_write_waitq); 1403 1403 1404 + err = pci_enable_device(pdev); 1405 + if (err) 1406 + goto out_no_pci; 1407 + 1404 1408 if (!cfg->base_params->pcie_l1_allowed) { 1405 1409 /* 1406 1410 * W/A - seems to solve weird behavior. We need to remove this ··· 1415 1411 PCIE_LINK_STATE_L1 | 1416 1412 PCIE_LINK_STATE_CLKPM); 1417 1413 } 1418 - 1419 - err = pci_enable_device(pdev); 1420 - if (err) 1421 - goto out_no_pci; 1422 1414 1423 1415 pci_set_master(pdev); 1424 1416
+2
drivers/net/wireless/iwlwifi/pcie/tx.c
··· 1102 1102 * non-AGG queue. 1103 1103 */ 1104 1104 iwl_clear_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id)); 1105 + 1106 + ssn = trans_pcie->txq[txq_id].q.read_ptr; 1105 1107 } 1106 1108 1107 1109 /* Place first TFD at index corresponding to start sequence number.
+8 -2
drivers/net/wireless/mwifiex/join.c
··· 1422 1422 */ 1423 1423 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) 1424 1424 { 1425 + int ret = 0; 1426 + 1425 1427 if (!priv->media_connected) 1426 1428 return 0; 1427 1429 1428 1430 switch (priv->bss_mode) { 1429 1431 case NL80211_IFTYPE_STATION: 1430 1432 case NL80211_IFTYPE_P2P_CLIENT: 1431 - return mwifiex_deauthenticate_infra(priv, mac); 1433 + ret = mwifiex_deauthenticate_infra(priv, mac); 1434 + if (ret) 1435 + cfg80211_disconnected(priv->netdev, 0, NULL, 0, 1436 + GFP_KERNEL); 1437 + break; 1432 1438 case NL80211_IFTYPE_ADHOC: 1433 1439 return mwifiex_send_cmd_sync(priv, 1434 1440 HostCmd_CMD_802_11_AD_HOC_STOP, ··· 1446 1440 break; 1447 1441 } 1448 1442 1449 - return 0; 1443 + return ret; 1450 1444 } 1451 1445 EXPORT_SYMBOL_GPL(mwifiex_deauthenticate); 1452 1446
+5 -3
drivers/net/wireless/mwifiex/main.c
··· 358 358 } 359 359 } while (true); 360 360 361 - if ((adapter->int_status) || IS_CARD_RX_RCVD(adapter)) 362 - goto process_start; 363 - 364 361 spin_lock_irqsave(&adapter->main_proc_lock, flags); 362 + if ((adapter->int_status) || IS_CARD_RX_RCVD(adapter)) { 363 + spin_unlock_irqrestore(&adapter->main_proc_lock, flags); 364 + goto process_start; 365 + } 366 + 365 367 adapter->mwifiex_processing = false; 366 368 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); 367 369
+2 -1
drivers/net/wireless/mwifiex/sta_event.c
··· 118 118 dev_dbg(adapter->dev, 119 119 "info: successfully disconnected from %pM: reason code %d\n", 120 120 priv->cfg_bssid, reason_code); 121 - if (priv->bss_mode == NL80211_IFTYPE_STATION) { 121 + if (priv->bss_mode == NL80211_IFTYPE_STATION || 122 + priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { 122 123 cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, 123 124 GFP_KERNEL); 124 125 }
+1 -8
drivers/net/wireless/rt2x00/rt2x00pci.c
··· 105 105 goto exit_release_regions; 106 106 } 107 107 108 - pci_enable_msi(pci_dev); 109 - 110 108 hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); 111 109 if (!hw) { 112 110 rt2x00_probe_err("Failed to allocate hardware\n"); 113 111 retval = -ENOMEM; 114 - goto exit_disable_msi; 112 + goto exit_release_regions; 115 113 } 116 114 117 115 pci_set_drvdata(pci_dev, hw); ··· 150 152 exit_free_device: 151 153 ieee80211_free_hw(hw); 152 154 153 - exit_disable_msi: 154 - pci_disable_msi(pci_dev); 155 - 156 155 exit_release_regions: 157 156 pci_release_regions(pci_dev); 158 157 ··· 173 178 rt2x00lib_remove_dev(rt2x00dev); 174 179 rt2x00pci_free_reg(rt2x00dev); 175 180 ieee80211_free_hw(hw); 176 - 177 - pci_disable_msi(pci_dev); 178 181 179 182 /* 180 183 * Free the PCI device data.
+2 -1
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
··· 343 343 (bool)GET_RX_DESC_PAGGR(pdesc)); 344 344 rx_status->mactime = GET_RX_DESC_TSFL(pdesc); 345 345 if (phystatus) { 346 - p_drvinfo = (struct rx_fwinfo_92c *)(pdesc + RTL_RX_DESC_SIZE); 346 + p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + 347 + stats->rx_bufshift); 347 348 rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, 348 349 p_drvinfo); 349 350 }
+4
drivers/net/xen-netback/xenbus.c
··· 39 39 static void connect(struct backend_info *); 40 40 static void backend_create_xenvif(struct backend_info *be); 41 41 static void unregister_hotplug_status_watch(struct backend_info *be); 42 + static void set_backend_state(struct backend_info *be, 43 + enum xenbus_state state); 42 44 43 45 static int netback_remove(struct xenbus_device *dev) 44 46 { 45 47 struct backend_info *be = dev_get_drvdata(&dev->dev); 48 + 49 + set_backend_state(be, XenbusStateClosed); 46 50 47 51 unregister_hotplug_status_watch(be); 48 52 if (be->vif) {
+11 -4
include/linux/filter.h
··· 6 6 7 7 #include <linux/atomic.h> 8 8 #include <linux/compat.h> 9 + #include <linux/workqueue.h> 9 10 #include <uapi/linux/filter.h> 10 11 11 12 #ifdef CONFIG_COMPAT ··· 26 25 { 27 26 atomic_t refcnt; 28 27 unsigned int len; /* Number of filter blocks */ 28 + struct rcu_head rcu; 29 29 unsigned int (*bpf_func)(const struct sk_buff *skb, 30 30 const struct sock_filter *filter); 31 - struct rcu_head rcu; 32 - struct sock_filter insns[0]; 31 + union { 32 + struct sock_filter insns[0]; 33 + struct work_struct work; 34 + }; 33 35 }; 34 36 35 - static inline unsigned int sk_filter_len(const struct sk_filter *fp) 37 + static inline unsigned int sk_filter_size(unsigned int proglen) 36 38 { 37 - return fp->len * sizeof(struct sock_filter) + sizeof(*fp); 39 + return max(sizeof(struct sk_filter), 40 + offsetof(struct sk_filter, insns[proglen])); 38 41 } 39 42 40 43 extern int sk_filter(struct sock *sk, struct sk_buff *skb); ··· 72 67 } 73 68 #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 74 69 #else 70 + #include <linux/slab.h> 75 71 static inline void bpf_jit_compile(struct sk_filter *fp) 76 72 { 77 73 } 78 74 static inline void bpf_jit_free(struct sk_filter *fp) 79 75 { 76 + kfree(fp); 80 77 } 81 78 #define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) 82 79 #endif
+3 -2
include/linux/netdevice.h
··· 2264 2264 } 2265 2265 2266 2266 #ifdef CONFIG_XPS 2267 - extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, 2267 + extern int netif_set_xps_queue(struct net_device *dev, 2268 + const struct cpumask *mask, 2268 2269 u16 index); 2269 2270 #else 2270 2271 static inline int netif_set_xps_queue(struct net_device *dev, 2271 - struct cpumask *mask, 2272 + const struct cpumask *mask, 2272 2273 u16 index) 2273 2274 { 2274 2275 return 0;
+1 -1
include/linux/tc_act/tc_defact.h include/uapi/linux/tc_act/tc_defact.h
··· 6 6 struct tc_defact { 7 7 tc_gen; 8 8 }; 9 - 9 + 10 10 enum { 11 11 TCA_DEF_UNSPEC, 12 12 TCA_DEF_TM,
+1 -1
include/linux/yam.h
··· 77 77 78 78 struct yamdrv_ioctl_mcs { 79 79 int cmd; 80 - int bitrate; 80 + unsigned int bitrate; 81 81 unsigned char bits[YAM_FPGA_SIZE]; 82 82 };
+4 -2
include/net/cipso_ipv4.h
··· 290 290 unsigned char err_offset = 0; 291 291 u8 opt_len = opt[1]; 292 292 u8 opt_iter; 293 + u8 tag_len; 293 294 294 295 if (opt_len < 8) { 295 296 err_offset = 1; ··· 303 302 } 304 303 305 304 for (opt_iter = 6; opt_iter < opt_len;) { 306 - if (opt[opt_iter + 1] > (opt_len - opt_iter)) { 305 + tag_len = opt[opt_iter + 1]; 306 + if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) { 307 307 err_offset = opt_iter + 1; 308 308 goto out; 309 309 } 310 - opt_iter += opt[opt_iter + 1]; 310 + opt_iter += tag_len; 311 311 } 312 312 313 313 out:
+12
include/net/dst.h
··· 479 479 { 480 480 return dst_orig; 481 481 } 482 + 483 + static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 484 + { 485 + return NULL; 486 + } 487 + 482 488 #else 483 489 extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, 484 490 const struct flowi *fl, struct sock *sk, 485 491 int flags); 492 + 493 + /* skb attached with this dst needs transformation if dst->xfrm is valid */ 494 + static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 495 + { 496 + return dst->xfrm; 497 + } 486 498 #endif 487 499 488 500 #endif /* _NET_DST_H */
+2 -4
include/net/ip6_route.h
··· 194 194 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 195 195 } 196 196 197 - static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest) 197 + static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt) 198 198 { 199 - if (rt->rt6i_flags & RTF_GATEWAY) 200 - return &rt->rt6i_gateway; 201 - return dest; 199 + return &rt->rt6i_gateway; 202 200 } 203 201 204 202 #endif
+1 -1
include/net/mac802154.h
··· 133 133 134 134 /* Basic interface to register ieee802154 device */ 135 135 struct ieee802154_dev * 136 - ieee802154_alloc_device(size_t priv_data_lex, struct ieee802154_ops *ops); 136 + ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops); 137 137 void ieee802154_free_device(struct ieee802154_dev *dev); 138 138 int ieee802154_register_device(struct ieee802154_dev *dev); 139 139 void ieee802154_unregister_device(struct ieee802154_dev *dev);
+2 -4
include/net/sock.h
··· 1630 1630 1631 1631 static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1632 1632 { 1633 - unsigned int size = sk_filter_len(fp); 1634 - 1635 - atomic_sub(size, &sk->sk_omem_alloc); 1633 + atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc); 1636 1634 sk_filter_release(fp); 1637 1635 } 1638 1636 1639 1637 static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 1640 1638 { 1641 1639 atomic_inc(&fp->refcnt); 1642 - atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); 1640 + atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc); 1643 1641 } 1644 1642 1645 1643 /*
+1
include/uapi/linux/tc_act/Kbuild
··· 1 1 # UAPI Header export list 2 2 header-y += tc_csum.h 3 + header-y += tc_defact.h 3 4 header-y += tc_gact.h 4 5 header-y += tc_ipt.h 5 6 header-y += tc_mirred.h
+1 -1
net/8021q/vlan_netlink.c
··· 171 171 172 172 return nla_total_size(2) + /* IFLA_VLAN_PROTOCOL */ 173 173 nla_total_size(2) + /* IFLA_VLAN_ID */ 174 - sizeof(struct ifla_vlan_flags) + /* IFLA_VLAN_FLAGS */ 174 + nla_total_size(sizeof(struct ifla_vlan_flags)) + /* IFLA_VLAN_FLAGS */ 175 175 vlan_qos_map_size(vlan->nr_ingress_mappings) + 176 176 vlan_qos_map_size(vlan->nr_egress_mappings); 177 177 }
+3 -2
net/batman-adv/main.c
··· 65 65 batadv_recv_handler_init(); 66 66 67 67 batadv_iv_init(); 68 + batadv_nc_init(); 68 69 69 70 batadv_event_workqueue = create_singlethread_workqueue("bat_events"); 70 71 ··· 143 142 if (ret < 0) 144 143 goto err; 145 144 146 - ret = batadv_nc_init(bat_priv); 145 + ret = batadv_nc_mesh_init(bat_priv); 147 146 if (ret < 0) 148 147 goto err; 149 148 ··· 168 167 batadv_vis_quit(bat_priv); 169 168 170 169 batadv_gw_node_purge(bat_priv); 171 - batadv_nc_free(bat_priv); 170 + batadv_nc_mesh_free(bat_priv); 172 171 batadv_dat_free(bat_priv); 173 172 batadv_bla_free(bat_priv); 174 173
+18 -10
net/batman-adv/network-coding.c
··· 35 35 struct batadv_hard_iface *recv_if); 36 36 37 37 /** 38 + * batadv_nc_init - one-time initialization for network coding 39 + */ 40 + int __init batadv_nc_init(void) 41 + { 42 + int ret; 43 + 44 + /* Register our packet type */ 45 + ret = batadv_recv_handler_register(BATADV_CODED, 46 + batadv_nc_recv_coded_packet); 47 + 48 + return ret; 49 + } 50 + 51 + /** 38 52 * batadv_nc_start_timer - initialise the nc periodic worker 39 53 * @bat_priv: the bat priv with all the soft interface information 40 54 */ ··· 59 45 } 60 46 61 47 /** 62 - * batadv_nc_init - initialise coding hash table and start house keeping 48 + * batadv_nc_mesh_init - initialise coding hash table and start house keeping 63 49 * @bat_priv: the bat priv with all the soft interface information 64 50 */ 65 - int batadv_nc_init(struct batadv_priv *bat_priv) 51 + int batadv_nc_mesh_init(struct batadv_priv *bat_priv) 66 52 { 67 53 bat_priv->nc.timestamp_fwd_flush = jiffies; 68 54 bat_priv->nc.timestamp_sniffed_purge = jiffies; ··· 83 69 84 70 batadv_hash_set_lock_class(bat_priv->nc.coding_hash, 85 71 &batadv_nc_decoding_hash_lock_class_key); 86 - 87 - /* Register our packet type */ 88 - if (batadv_recv_handler_register(BATADV_CODED, 89 - batadv_nc_recv_coded_packet) < 0) 90 - goto err; 91 72 92 73 INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker); 93 74 batadv_nc_start_timer(bat_priv); ··· 1730 1721 } 1731 1722 1732 1723 /** 1733 - * batadv_nc_free - clean up network coding memory 1724 + * batadv_nc_mesh_free - clean up network coding memory 1734 1725 * @bat_priv: the bat priv with all the soft interface information 1735 1726 */ 1736 - void batadv_nc_free(struct batadv_priv *bat_priv) 1727 + void batadv_nc_mesh_free(struct batadv_priv *bat_priv) 1737 1728 { 1738 - batadv_recv_handler_unregister(BATADV_CODED); 1739 1729 cancel_delayed_work_sync(&bat_priv->nc.work); 1740 1730 1741 1731 batadv_nc_purge_paths(bat_priv, bat_priv->nc.coding_hash, NULL);
+10 -4
net/batman-adv/network-coding.h
··· 22 22 23 23 #ifdef CONFIG_BATMAN_ADV_NC 24 24 25 - int batadv_nc_init(struct batadv_priv *bat_priv); 26 - void batadv_nc_free(struct batadv_priv *bat_priv); 25 + int batadv_nc_init(void); 26 + int batadv_nc_mesh_init(struct batadv_priv *bat_priv); 27 + void batadv_nc_mesh_free(struct batadv_priv *bat_priv); 27 28 void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, 28 29 struct batadv_orig_node *orig_node, 29 30 struct batadv_orig_node *orig_neigh_node, ··· 47 46 48 47 #else /* ifdef CONFIG_BATMAN_ADV_NC */ 49 48 50 - static inline int batadv_nc_init(struct batadv_priv *bat_priv) 49 + static inline int batadv_nc_init(void) 51 50 { 52 51 return 0; 53 52 } 54 53 55 - static inline void batadv_nc_free(struct batadv_priv *bat_priv) 54 + static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv) 55 + { 56 + return 0; 57 + } 58 + 59 + static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv) 56 60 { 57 61 return; 58 62 }
+2 -2
net/bridge/br_fdb.c
··· 700 700 701 701 vid = nla_get_u16(tb[NDA_VLAN]); 702 702 703 - if (vid >= VLAN_N_VID) { 703 + if (!vid || vid >= VLAN_VID_MASK) { 704 704 pr_info("bridge: RTM_NEWNEIGH with invalid vlan id %d\n", 705 705 vid); 706 706 return -EINVAL; ··· 794 794 795 795 vid = nla_get_u16(tb[NDA_VLAN]); 796 796 797 - if (vid >= VLAN_N_VID) { 797 + if (!vid || vid >= VLAN_VID_MASK) { 798 798 pr_info("bridge: RTM_NEWNEIGH with invalid vlan id %d\n", 799 799 vid); 800 800 return -EINVAL;
+1 -1
net/bridge/br_mdb.c
··· 453 453 call_rcu_bh(&p->rcu, br_multicast_free_pg); 454 454 err = 0; 455 455 456 - if (!mp->ports && !mp->mglist && mp->timer_armed && 456 + if (!mp->ports && !mp->mglist && 457 457 netif_running(br->dev)) 458 458 mod_timer(&mp->timer, jiffies); 459 459 break;
+26 -12
net/bridge/br_multicast.c
··· 272 272 del_timer(&p->timer); 273 273 call_rcu_bh(&p->rcu, br_multicast_free_pg); 274 274 275 - if (!mp->ports && !mp->mglist && mp->timer_armed && 275 + if (!mp->ports && !mp->mglist && 276 276 netif_running(br->dev)) 277 277 mod_timer(&mp->timer, jiffies); 278 278 ··· 620 620 621 621 mp->br = br; 622 622 mp->addr = *group; 623 - 624 623 setup_timer(&mp->timer, br_multicast_group_expired, 625 624 (unsigned long)mp); 626 625 ··· 659 660 struct net_bridge_mdb_entry *mp; 660 661 struct net_bridge_port_group *p; 661 662 struct net_bridge_port_group __rcu **pp; 663 + unsigned long now = jiffies; 662 664 int err; 663 665 664 666 spin_lock(&br->multicast_lock); ··· 674 674 675 675 if (!port) { 676 676 mp->mglist = true; 677 + mod_timer(&mp->timer, now + br->multicast_membership_interval); 677 678 goto out; 678 679 } 679 680 ··· 682 681 (p = mlock_dereference(*pp, br)) != NULL; 683 682 pp = &p->next) { 684 683 if (p->port == port) 685 - goto out; 684 + goto found; 686 685 if ((unsigned long)p->port < (unsigned long)port) 687 686 break; 688 687 } ··· 693 692 rcu_assign_pointer(*pp, p); 694 693 br_mdb_notify(br->dev, port, group, RTM_NEWMDB); 695 694 695 + found: 696 + mod_timer(&p->timer, now + br->multicast_membership_interval); 696 697 out: 697 698 err = 0; 698 699 ··· 1194 1191 if (!mp) 1195 1192 goto out; 1196 1193 1197 - mod_timer(&mp->timer, now + br->multicast_membership_interval); 1198 - mp->timer_armed = true; 1199 - 1200 1194 max_delay *= br->multicast_last_member_count; 1201 1195 1202 1196 if (mp->mglist && ··· 1269 1269 mp = br_mdb_ip6_get(mlock_dereference(br->mdb, br), group, vid); 1270 1270 if (!mp) 1271 1271 goto out; 1272 - 1273 - mod_timer(&mp->timer, now + br->multicast_membership_interval); 1274 - mp->timer_armed = true; 1275 1272 1276 1273 max_delay *= br->multicast_last_member_count; 1277 1274 if (mp->mglist && ··· 1355 1358 call_rcu_bh(&p->rcu, br_multicast_free_pg); 1356 1359 br_mdb_notify(br->dev, port, group, RTM_DELMDB); 1357 1360 1358 - if (!mp->ports && !mp->mglist && mp->timer_armed && 1361 + if (!mp->ports && !mp->mglist && 1359 1362 netif_running(br->dev)) 1360 1363 mod_timer(&mp->timer, jiffies); 1361 1364 } ··· 1367 1370 br->multicast_last_member_interval; 1368 1371 1369 1372 if (!port) { 1370 - if (mp->mglist && mp->timer_armed && 1373 + if (mp->mglist && 1371 1374 (timer_pending(&mp->timer) ? 1372 1375 time_after(mp->timer.expires, time) : 1373 1376 try_to_del_timer_sync(&mp->timer) >= 0)) { 1374 1377 mod_timer(&mp->timer, time); 1375 1378 } 1379 + 1380 + goto out; 1381 + } 1382 + 1383 + for (p = mlock_dereference(mp->ports, br); 1384 + p != NULL; 1385 + p = mlock_dereference(p->next, br)) { 1386 + if (p->port != port) 1387 + continue; 1388 + 1389 + if (!hlist_unhashed(&p->mglist) && 1390 + (timer_pending(&p->timer) ? 1391 + time_after(p->timer.expires, time) : 1392 + try_to_del_timer_sync(&p->timer) >= 0)) { 1393 + mod_timer(&p->timer, time); 1394 + } 1395 + 1396 + break; 1376 1397 } 1377 1398 out: 1378 1399 spin_unlock(&br->multicast_lock); ··· 1813 1798 hlist_for_each_entry_safe(mp, n, &mdb->mhash[i], 1814 1799 hlist[ver]) { 1815 1800 del_timer(&mp->timer); 1816 - mp->timer_armed = false; 1817 1801 call_rcu_bh(&mp->rcu, br_multicast_free_group); 1818 1802 } 1819 1803 }
+1 -1
net/bridge/br_netlink.c
··· 243 243 244 244 vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]); 245 245 246 - if (vinfo->vid >= VLAN_N_VID) 246 + if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK) 247 247 return -EINVAL; 248 248 249 249 switch (cmd) {
+1 -4
net/bridge/br_private.h
··· 126 126 struct timer_list timer; 127 127 struct br_ip addr; 128 128 bool mglist; 129 - bool timer_armed; 130 129 }; 131 130 132 131 struct net_bridge_mdb_htable ··· 642 643 * vid wasn't set 643 644 */ 644 645 smp_rmb(); 645 - return (v->pvid & VLAN_TAG_PRESENT) ? 646 - (v->pvid & ~VLAN_TAG_PRESENT) : 647 - VLAN_N_VID; 646 + return v->pvid ?: VLAN_N_VID; 648 647 } 649 648 650 649 #else
+1 -1
net/bridge/br_stp_if.c
··· 134 134 135 135 if (br->bridge_forward_delay < BR_MIN_FORWARD_DELAY) 136 136 __br_set_forward_delay(br, BR_MIN_FORWARD_DELAY); 137 - else if (br->bridge_forward_delay < BR_MAX_FORWARD_DELAY) 137 + else if (br->bridge_forward_delay > BR_MAX_FORWARD_DELAY) 138 138 __br_set_forward_delay(br, BR_MAX_FORWARD_DELAY); 139 139 140 140 if (r == 0) {
+66 -57
net/bridge/br_vlan.c
··· 45 45 return 0; 46 46 } 47 47 48 - if (vid) { 49 - if (v->port_idx) { 50 - p = v->parent.port; 51 - br = p->br; 52 - dev = p->dev; 53 - } else { 54 - br = v->parent.br; 55 - dev = br->dev; 56 - } 57 - ops = dev->netdev_ops; 48 + if (v->port_idx) { 49 + p = v->parent.port; 50 + br = p->br; 51 + dev = p->dev; 52 + } else { 53 + br = v->parent.br; 54 + dev = br->dev; 55 + } 56 + ops = dev->netdev_ops; 58 57 59 - if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) { 60 - /* Add VLAN to the device filter if it is supported. 61 - * Stricly speaking, this is not necessary now, since 62 - * devices are made promiscuous by the bridge, but if 63 - * that ever changes this code will allow tagged 64 - * traffic to enter the bridge. 65 - */ 66 - err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q), 67 - vid); 68 - if (err) 69 - return err; 70 - } 58 + if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) { 59 + /* Add VLAN to the device filter if it is supported. 60 + * Stricly speaking, this is not necessary now, since 61 + * devices are made promiscuous by the bridge, but if 62 + * that ever changes this code will allow tagged 63 + * traffic to enter the bridge. 64 + */ 65 + err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q), 66 + vid); 67 + if (err) 68 + return err; 69 + } 71 70 72 - err = br_fdb_insert(br, p, dev->dev_addr, vid); 73 - if (err) { 74 - br_err(br, "failed insert local address into bridge " 75 - "forwarding table\n"); 76 - goto out_filt; 77 - } 78 - 71 + err = br_fdb_insert(br, p, dev->dev_addr, vid); 72 + if (err) { 73 + br_err(br, "failed insert local address into bridge " 74 + "forwarding table\n"); 75 + goto out_filt; 79 76 } 80 77 81 78 set_bit(vid, v->vlan_bitmap); ··· 95 98 __vlan_delete_pvid(v, vid); 96 99 clear_bit(vid, v->untagged_bitmap); 97 100 98 - if (v->port_idx && vid) { 101 + if (v->port_idx) { 99 102 struct net_device *dev = v->parent.port->dev; 100 103 const struct net_device_ops *ops = dev->netdev_ops; 101 104 ··· 189 192 bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, 190 193 struct sk_buff *skb, u16 *vid) 191 194 { 195 + int err; 196 + 192 197 /* If VLAN filtering is disabled on the bridge, all packets are 193 198 * permitted. 194 199 */ ··· 203 204 if (!v) 204 205 return false; 205 206 206 - if (br_vlan_get_tag(skb, vid)) { 207 + err = br_vlan_get_tag(skb, vid); 208 + if (!*vid) { 207 209 u16 pvid = br_get_pvid(v); 208 210 209 - /* Frame did not have a tag. See if pvid is set 210 - * on this port. That tells us which vlan untagged 211 - * traffic belongs to. 211 + /* Frame had a tag with VID 0 or did not have a tag. 212 + * See if pvid is set on this port. That tells us which 213 + * vlan untagged or priority-tagged traffic belongs to. 212 214 */ 213 215 if (pvid == VLAN_N_VID) 214 216 return false; 215 217 216 - /* PVID is set on this port. Any untagged ingress 217 - * frame is considered to belong to this vlan. 218 + /* PVID is set on this port. Any untagged or priority-tagged 219 + * ingress frame is considered to belong to this vlan. 218 220 */ 219 - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid); 221 + *vid = pvid; 222 + if (likely(err)) 223 + /* Untagged Frame. */ 224 + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid); 225 + else 226 + /* Priority-tagged Frame. 227 + * At this point, We know that skb->vlan_tci had 228 + * VLAN_TAG_PRESENT bit and its VID field was 0x000. 229 + * We update only VID field and preserve PCP field. 230 + */ 231 + skb->vlan_tci |= pvid; 232 + 220 233 return true; 221 234 } 222 235 ··· 259 248 return false; 260 249 } 261 250 262 - /* Must be protected by RTNL */ 251 + /* Must be protected by RTNL. 252 + * Must be called with vid in range from 1 to 4094 inclusive. 253 + */ 263 254 int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags) 264 255 { 265 256 struct net_port_vlans *pv = NULL; ··· 291 278 return err; 292 279 } 293 280 294 - /* Must be protected by RTNL */ 281 + /* Must be protected by RTNL. 282 + * Must be called with vid in range from 1 to 4094 inclusive. 283 + */ 295 284 int br_vlan_delete(struct net_bridge *br, u16 vid) 296 285 { 297 286 struct net_port_vlans *pv; ··· 304 289 if (!pv) 305 290 return -EINVAL; 306 291 307 - if (vid) { 308 - /* If the VID !=0 remove fdb for this vid. VID 0 is special 309 - * in that it's the default and is always there in the fdb. 310 - */ 311 - spin_lock_bh(&br->hash_lock); 312 - fdb_delete_by_addr(br, br->dev->dev_addr, vid); 313 - spin_unlock_bh(&br->hash_lock); 314 - } 292 + spin_lock_bh(&br->hash_lock); 293 + fdb_delete_by_addr(br, br->dev->dev_addr, vid); 294 + spin_unlock_bh(&br->hash_lock); 315 295 316 296 __vlan_del(pv, vid); 317 297 return 0; ··· 339 329 return 0; 340 330 } 341 331 342 - /* Must be protected by RTNL */ 332 + /* Must be protected by RTNL. 333 + * Must be called with vid in range from 1 to 4094 inclusive. 334 + */ 343 335 int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags) 344 336 { 345 337 struct net_port_vlans *pv = NULL; ··· 375 363 return err; 376 364 } 377 365 378 - /* Must be protected by RTNL */ 366 + /* Must be protected by RTNL. 367 + * Must be called with vid in range from 1 to 4094 inclusive. 368 + */ 379 369 int nbp_vlan_delete(struct net_bridge_port *port, u16 vid) 380 370 { 381 371 struct net_port_vlans *pv; ··· 388 374 if (!pv) 389 375 return -EINVAL; 390 376 391 - if (vid) { 392 - /* If the VID !=0 remove fdb for this vid. VID 0 is special 393 - * in that it's the default and is always there in the fdb. 394 - */ 395 - spin_lock_bh(&port->br->hash_lock); 396 - fdb_delete_by_addr(port->br, port->dev->dev_addr, vid); 397 - spin_unlock_bh(&port->br->hash_lock); 398 - } 377 + spin_lock_bh(&port->br->hash_lock); 378 + fdb_delete_by_addr(port->br, port->dev->dev_addr, vid); 379 + spin_unlock_bh(&port->br->hash_lock); 399 380 400 381 return __vlan_del(pv, vid); 401 382 }
+2
net/compat.c
··· 71 71 __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || 72 72 __get_user(kmsg->msg_flags, &umsg->msg_flags)) 73 73 return -EFAULT; 74 + if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) 75 + return -EINVAL; 74 76 kmsg->msg_name = compat_ptr(tmp1); 75 77 kmsg->msg_iov = compat_ptr(tmp2); 76 78 kmsg->msg_control = compat_ptr(tmp3);
+2 -1
net/core/dev.c
··· 1917 1917 return new_map; 1918 1918 } 1919 1919 1920 - int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, u16 index) 1920 + int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 1921 + u16 index) 1921 1922 { 1922 1923 struct xps_dev_maps *dev_maps, *new_dev_maps = NULL; 1923 1924 struct xps_map *map, *new_map;
+4 -4
net/core/filter.c
··· 644 644 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); 645 645 646 646 bpf_jit_free(fp); 647 - kfree(fp); 648 647 } 649 648 EXPORT_SYMBOL(sk_filter_release_rcu); 650 649 ··· 682 683 if (fprog->filter == NULL) 683 684 return -EINVAL; 684 685 685 - fp = kmalloc(fsize + sizeof(*fp), GFP_KERNEL); 686 + fp = kmalloc(sk_filter_size(fprog->len), GFP_KERNEL); 686 687 if (!fp) 687 688 return -ENOMEM; 688 689 memcpy(fp->insns, fprog->filter, fsize); ··· 722 723 { 723 724 struct sk_filter *fp, *old_fp; 724 725 unsigned int fsize = sizeof(struct sock_filter) * fprog->len; 726 + unsigned int sk_fsize = sk_filter_size(fprog->len); 725 727 int err; 726 728 727 729 if (sock_flag(sk, SOCK_FILTER_LOCKED)) ··· 732 732 if (fprog->filter == NULL) 733 733 return -EINVAL; 734 734 735 - fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); 735 + fp = sock_kmalloc(sk, sk_fsize, GFP_KERNEL); 736 736 if (!fp) 737 737 return -ENOMEM; 738 738 if (copy_from_user(fp->insns, fprog->filter, fsize)) { 739 - sock_kfree_s(sk, fp, fsize+sizeof(*fp)); 739 + sock_kfree_s(sk, fp, sk_fsize); 740 740 return -EFAULT; 741 741 } 742 742
+2
net/core/secure_seq.c
··· 10 10 11 11 #include <net/secure_seq.h> 12 12 13 + #if IS_ENABLED(CONFIG_IPV6) || IS_ENABLED(CONFIG_INET) 13 14 #define NET_SECRET_SIZE (MD5_MESSAGE_BYTES / 4) 14 15 15 16 static u32 net_secret[NET_SECRET_SIZE] ____cacheline_aligned; ··· 30 29 cmpxchg(&net_secret[--i], 0, tmp); 31 30 } 32 31 } 32 + #endif 33 33 34 34 #ifdef CONFIG_INET 35 35 static u32 seq_scale(u32 seq)
+1
net/core/sock.c
··· 2319 2319 sk->sk_ll_usec = sysctl_net_busy_read; 2320 2320 #endif 2321 2321 2322 + sk->sk_pacing_rate = ~0U; 2322 2323 /* 2323 2324 * Before updating sk_refcnt, we must commit prior changes to memory 2324 2325 * (Documentation/RCU/rculist_nulls.txt for details)
+5
net/ieee802154/6lowpan.c
··· 1372 1372 real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); 1373 1373 if (!real_dev) 1374 1374 return -ENODEV; 1375 + if (real_dev->type != ARPHRD_IEEE802154) 1376 + return -EINVAL; 1375 1377 1376 1378 lowpan_dev_info(dev)->real_dev = real_dev; 1377 1379 lowpan_dev_info(dev)->fragment_tag = 0; ··· 1387 1385 } 1388 1386 1389 1387 entry->ldev = dev; 1388 + 1389 + /* Set the lowpan harware address to the wpan hardware address. */ 1390 + memcpy(dev->dev_addr, real_dev->dev_addr, IEEE802154_ADDR_LEN); 1390 1391 1391 1392 mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); 1392 1393 INIT_LIST_HEAD(&entry->list);
+1 -1
net/ipv4/inet_hashtables.c
··· 287 287 if (unlikely(!INET_TW_MATCH(sk, net, acookie, 288 288 saddr, daddr, ports, 289 289 dif))) { 290 - sock_put(sk); 290 + inet_twsk_put(inet_twsk(sk)); 291 291 goto begintw; 292 292 } 293 293 goto out;
+9 -4
net/ipv4/ip_output.c
··· 772 772 /* initialize protocol header pointer */ 773 773 skb->transport_header = skb->network_header + fragheaderlen; 774 774 775 - skb->ip_summed = CHECKSUM_PARTIAL; 776 775 skb->csum = 0; 777 776 778 - /* specify the length of each IP datagram fragment */ 779 - skb_shinfo(skb)->gso_size = maxfraglen - fragheaderlen; 780 - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 777 + 781 778 __skb_queue_tail(queue, skb); 779 + } else if (skb_is_gso(skb)) { 780 + goto append; 782 781 } 783 782 783 + skb->ip_summed = CHECKSUM_PARTIAL; 784 + /* specify the length of each IP datagram fragment */ 785 + skb_shinfo(skb)->gso_size = maxfraglen - fragheaderlen; 786 + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 787 + 788 + append: 784 789 return skb_append_datato_frags(sk, skb, getfrag, from, 785 790 (length - transhdrlen)); 786 791 }
+11 -3
net/ipv4/ip_vti.c
··· 125 125 iph->saddr, iph->daddr, 0); 126 126 if (tunnel != NULL) { 127 127 struct pcpu_tstats *tstats; 128 + u32 oldmark = skb->mark; 129 + int ret; 128 130 129 - if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) 131 + 132 + /* temporarily mark the skb with the tunnel o_key, to 133 + * only match policies with this mark. 134 + */ 135 + skb->mark = be32_to_cpu(tunnel->parms.o_key); 136 + ret = xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb); 137 + skb->mark = oldmark; 138 + if (!ret) 130 139 return -1; 131 140 132 141 tstats = this_cpu_ptr(tunnel->dev->tstats); ··· 144 135 tstats->rx_bytes += skb->len; 145 136 u64_stats_update_end(&tstats->syncp); 146 137 147 - skb->mark = 0; 148 138 secpath_reset(skb); 149 139 skb->dev = tunnel->dev; 150 140 return 1; ··· 175 167 176 168 memset(&fl4, 0, sizeof(fl4)); 177 169 flowi4_init_output(&fl4, tunnel->parms.link, 178 - be32_to_cpu(tunnel->parms.i_key), RT_TOS(tos), 170 + be32_to_cpu(tunnel->parms.o_key), RT_TOS(tos), 179 171 RT_SCOPE_UNIVERSE, 180 172 IPPROTO_IPIP, 0, 181 173 dst, tiph->saddr, 0, 0);
+1 -1
net/ipv4/route.c
··· 2072 2072 RT_SCOPE_LINK); 2073 2073 goto make_route; 2074 2074 } 2075 - if (fl4->saddr) { 2075 + if (!fl4->saddr) { 2076 2076 if (ipv4_is_multicast(fl4->daddr)) 2077 2077 fl4->saddr = inet_select_addr(dev_out, 0, 2078 2078 fl4->flowi4_scope);
+7 -2
net/ipv4/tcp_input.c
··· 1284 1284 tp->lost_cnt_hint -= tcp_skb_pcount(prev); 1285 1285 } 1286 1286 1287 - TCP_SKB_CB(skb)->tcp_flags |= TCP_SKB_CB(prev)->tcp_flags; 1287 + TCP_SKB_CB(prev)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags; 1288 + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 1289 + TCP_SKB_CB(prev)->end_seq++; 1290 + 1288 1291 if (skb == tcp_highest_sack(sk)) 1289 1292 tcp_advance_highest_sack(sk, skb); 1290 1293 ··· 3291 3288 tcp_init_cwnd_reduction(sk, true); 3292 3289 tcp_set_ca_state(sk, TCP_CA_CWR); 3293 3290 tcp_end_cwnd_reduction(sk); 3294 - tcp_set_ca_state(sk, TCP_CA_Open); 3291 + tcp_try_keep_open(sk); 3295 3292 NET_INC_STATS_BH(sock_net(sk), 3296 3293 LINUX_MIB_TCPLOSSPROBERECOVERY); 3297 3294 } ··· 5711 5708 tcp_rearm_rto(sk); 5712 5709 } else 5713 5710 tcp_init_metrics(sk); 5711 + 5712 + tcp_update_pacing_rate(sk); 5714 5713 5715 5714 /* Prevent spurious tcp_cwnd_restart() on first data packet */ 5716 5715 tp->lsndtime = tcp_time_stamp;
+9 -5
net/ipv4/tcp_output.c
··· 637 637 unsigned int size = 0; 638 638 unsigned int eff_sacks; 639 639 640 + opts->options = 0; 641 + 640 642 #ifdef CONFIG_TCP_MD5SIG 641 643 *md5 = tp->af_specific->md5_lookup(sk, sk); 642 644 if (unlikely(*md5)) { ··· 986 984 static void tcp_set_skb_tso_segs(const struct sock *sk, struct sk_buff *skb, 987 985 unsigned int mss_now) 988 986 { 989 - if (skb->len <= mss_now || !sk_can_gso(sk) || 990 - skb->ip_summed == CHECKSUM_NONE) { 987 + /* Make sure we own this skb before messing gso_size/gso_segs */ 988 + WARN_ON_ONCE(skb_cloned(skb)); 989 + 990 + if (skb->len <= mss_now || skb->ip_summed == CHECKSUM_NONE) { 991 991 /* Avoid the costly divide in the normal 992 992 * non-TSO case. 993 993 */ ··· 1069 1065 if (nsize < 0) 1070 1066 nsize = 0; 1071 1067 1072 - if (skb_cloned(skb) && 1073 - skb_is_nonlinear(skb) && 1074 - pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 1068 + if (skb_unclone(skb, GFP_ATOMIC)) 1075 1069 return -ENOMEM; 1076 1070 1077 1071 /* Get a new skb... force flag on. */ ··· 2344 2342 int oldpcount = tcp_skb_pcount(skb); 2345 2343 2346 2344 if (unlikely(oldpcount > 1)) { 2345 + if (skb_unclone(skb, GFP_ATOMIC)) 2346 + return -ENOMEM; 2347 2347 tcp_init_tso_segs(sk, skb, cur_mss); 2348 2348 tcp_adjust_pcount(sk, skb, oldpcount - tcp_skb_pcount(skb)); 2349 2349 }
+1
net/ipv4/xfrm4_policy.c
··· 107 107 108 108 memset(fl4, 0, sizeof(struct flowi4)); 109 109 fl4->flowi4_mark = skb->mark; 110 + fl4->flowi4_oif = skb_dst(skb)->dev->ifindex; 110 111 111 112 if (!ip_is_fragment(iph)) { 112 113 switch (iph->protocol) {
+1 -2
net/ipv6/ah6.c
··· 618 618 struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); 619 619 struct xfrm_state *x; 620 620 621 - if (type != ICMPV6_DEST_UNREACH && 622 - type != ICMPV6_PKT_TOOBIG && 621 + if (type != ICMPV6_PKT_TOOBIG && 623 622 type != NDISC_REDIRECT) 624 623 return; 625 624
+1 -2
net/ipv6/esp6.c
··· 436 436 struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset); 437 437 struct xfrm_state *x; 438 438 439 - if (type != ICMPV6_DEST_UNREACH && 440 - type != ICMPV6_PKT_TOOBIG && 439 + if (type != ICMPV6_PKT_TOOBIG && 441 440 type != NDISC_REDIRECT) 442 441 return; 443 442
+1 -1
net/ipv6/inet6_hashtables.c
··· 116 116 } 117 117 if (unlikely(!INET6_TW_MATCH(sk, net, saddr, daddr, 118 118 ports, dif))) { 119 - sock_put(sk); 119 + inet_twsk_put(inet_twsk(sk)); 120 120 goto begintw; 121 121 } 122 122 goto out;
+2 -4
net/ipv6/ip6_gre.c
··· 976 976 if (t->parms.o_flags&GRE_SEQ) 977 977 addend += 4; 978 978 } 979 + t->hlen = addend; 979 980 980 981 if (p->flags & IP6_TNL_F_CAP_XMIT) { 981 982 int strict = (ipv6_addr_type(&p->raddr) & ··· 1003 1002 } 1004 1003 ip6_rt_put(rt); 1005 1004 } 1006 - 1007 - t->hlen = addend; 1008 1005 } 1009 1006 1010 1007 static int ip6gre_tnl_change(struct ip6_tnl *t, ··· 1172 1173 1173 1174 static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu) 1174 1175 { 1175 - struct ip6_tnl *tunnel = netdev_priv(dev); 1176 1176 if (new_mtu < 68 || 1177 - new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen) 1177 + new_mtu > 0xFFF8 - dev->hard_header_len) 1178 1178 return -EINVAL; 1179 1179 dev->mtu = new_mtu; 1180 1180 return 0;
+16 -13
net/ipv6/ip6_output.c
··· 105 105 } 106 106 107 107 rcu_read_lock_bh(); 108 - nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr); 108 + nexthop = rt6_nexthop((struct rt6_info *)dst); 109 109 neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop); 110 110 if (unlikely(!neigh)) 111 111 neigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false); ··· 874 874 */ 875 875 rt = (struct rt6_info *) *dst; 876 876 rcu_read_lock_bh(); 877 - n = __ipv6_neigh_lookup_noref(rt->dst.dev, rt6_nexthop(rt, &fl6->daddr)); 877 + n = __ipv6_neigh_lookup_noref(rt->dst.dev, rt6_nexthop(rt)); 878 878 err = n && !(n->nud_state & NUD_VALID) ? -EINVAL : 0; 879 879 rcu_read_unlock_bh(); 880 880 ··· 1008 1008 1009 1009 { 1010 1010 struct sk_buff *skb; 1011 + struct frag_hdr fhdr; 1011 1012 int err; 1012 1013 1013 1014 /* There is support for UDP large send offload by network ··· 1016 1015 * udp datagram 1017 1016 */ 1018 1017 if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) { 1019 - struct frag_hdr fhdr; 1020 - 1021 1018 skb = sock_alloc_send_skb(sk, 1022 1019 hh_len + fragheaderlen + transhdrlen + 20, 1023 1020 (flags & MSG_DONTWAIT), &err); ··· 1035 1036 skb->transport_header = skb->network_header + fragheaderlen; 1036 1037 1037 1038 skb->protocol = htons(ETH_P_IPV6); 1038 - skb->ip_summed = CHECKSUM_PARTIAL; 1039 1039 skb->csum = 0; 1040 1040 1041 - /* Specify the length of each IPv6 datagram fragment. 1042 - * It has to be a multiple of 8. 1043 - */ 1044 - skb_shinfo(skb)->gso_size = (mtu - fragheaderlen - 1045 - sizeof(struct frag_hdr)) & ~7; 1046 - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 1047 - ipv6_select_ident(&fhdr, rt); 1048 - skb_shinfo(skb)->ip6_frag_id = fhdr.identification; 1049 1041 __skb_queue_tail(&sk->sk_write_queue, skb); 1042 + } else if (skb_is_gso(skb)) { 1043 + goto append; 1050 1044 } 1051 1045 1046 + skb->ip_summed = CHECKSUM_PARTIAL; 1047 + /* Specify the length of each IPv6 datagram fragment. 1048 + * It has to be a multiple of 8. 1049 + */ 1050 + skb_shinfo(skb)->gso_size = (mtu - fragheaderlen - 1051 + sizeof(struct frag_hdr)) & ~7; 1052 + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 1053 + ipv6_select_ident(&fhdr, rt); 1054 + skb_shinfo(skb)->ip6_frag_id = fhdr.identification; 1055 + 1056 + append: 1052 1057 return skb_append_datato_frags(sk, skb, getfrag, from, 1053 1058 (length - transhdrlen)); 1054 1059 }
+10 -2
net/ipv6/ip6_tunnel.c
··· 1430 1430 static int 1431 1431 ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) 1432 1432 { 1433 - if (new_mtu < IPV6_MIN_MTU) { 1434 - return -EINVAL; 1433 + struct ip6_tnl *tnl = netdev_priv(dev); 1434 + 1435 + if (tnl->parms.proto == IPPROTO_IPIP) { 1436 + if (new_mtu < 68) 1437 + return -EINVAL; 1438 + } else { 1439 + if (new_mtu < IPV6_MIN_MTU) 1440 + return -EINVAL; 1435 1441 } 1442 + if (new_mtu > 0xFFF8 - dev->hard_header_len) 1443 + return -EINVAL; 1436 1444 dev->mtu = new_mtu; 1437 1445 return 0; 1438 1446 }
+1 -2
net/ipv6/ipcomp6.c
··· 64 64 (struct ip_comp_hdr *)(skb->data + offset); 65 65 struct xfrm_state *x; 66 66 67 - if (type != ICMPV6_DEST_UNREACH && 68 - type != ICMPV6_PKT_TOOBIG && 67 + if (type != ICMPV6_PKT_TOOBIG && 69 68 type != NDISC_REDIRECT) 70 69 return; 71 70
+38 -10
net/ipv6/route.c
··· 476 476 } 477 477 478 478 #ifdef CONFIG_IPV6_ROUTER_PREF 479 + struct __rt6_probe_work { 480 + struct work_struct work; 481 + struct in6_addr target; 482 + struct net_device *dev; 483 + }; 484 + 485 + static void rt6_probe_deferred(struct work_struct *w) 486 + { 487 + struct in6_addr mcaddr; 488 + struct __rt6_probe_work *work = 489 + container_of(w, struct __rt6_probe_work, work); 490 + 491 + addrconf_addr_solict_mult(&work->target, &mcaddr); 492 + ndisc_send_ns(work->dev, NULL, &work->target, &mcaddr, NULL); 493 + dev_put(work->dev); 494 + kfree(w); 495 + } 496 + 479 497 static void rt6_probe(struct rt6_info *rt) 480 498 { 481 499 struct neighbour *neigh; ··· 517 499 518 500 if (!neigh || 519 501 time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) { 520 - struct in6_addr mcaddr; 521 - struct in6_addr *target; 502 + struct __rt6_probe_work *work; 522 503 523 - if (neigh) { 504 + work = kmalloc(sizeof(*work), GFP_ATOMIC); 505 + 506 + if (neigh && work) 524 507 neigh->updated = jiffies; 525 - write_unlock(&neigh->lock); 526 - } 527 508 528 - target = (struct in6_addr *)&rt->rt6i_gateway; 529 - addrconf_addr_solict_mult(target, &mcaddr); 530 - ndisc_send_ns(rt->dst.dev, NULL, target, &mcaddr, NULL); 509 + if (neigh) 510 + write_unlock(&neigh->lock); 511 + 512 + if (work) { 513 + INIT_WORK(&work->work, rt6_probe_deferred); 514 + work->target = rt->rt6i_gateway; 515 + dev_hold(rt->dst.dev); 516 + work->dev = rt->dst.dev; 517 + schedule_work(&work->work); 518 + } 531 519 } else { 532 520 out: 533 521 write_unlock(&neigh->lock); ··· 875 851 if (ort->rt6i_dst.plen != 128 && 876 852 ipv6_addr_equal(&ort->rt6i_dst.addr, daddr)) 877 853 rt->rt6i_flags |= RTF_ANYCAST; 878 - rt->rt6i_gateway = *daddr; 879 854 } 880 855 881 856 rt->rt6i_flags |= RTF_CACHE; ··· 1361 1338 rt->dst.flags |= DST_HOST; 1362 1339 rt->dst.output = ip6_output; 1363 1340 atomic_set(&rt->dst.__refcnt, 1); 1341 + rt->rt6i_gateway = fl6->daddr; 1364 1342 rt->rt6i_dst.addr = fl6->daddr; 1365 1343 rt->rt6i_dst.plen = 128; 1366 1344 rt->rt6i_idev = idev; ··· 1897 1873 in6_dev_hold(rt->rt6i_idev); 1898 1874 rt->dst.lastuse = jiffies; 1899 1875 1900 - rt->rt6i_gateway = ort->rt6i_gateway; 1876 + if (ort->rt6i_flags & RTF_GATEWAY) 1877 + rt->rt6i_gateway = ort->rt6i_gateway; 1878 + else 1879 + rt->rt6i_gateway = *dest; 1901 1880 rt->rt6i_flags = ort->rt6i_flags; 1902 1881 if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == 1903 1882 (RTF_DEFAULT | RTF_ADDRCONF)) ··· 2187 2160 else 2188 2161 rt->rt6i_flags |= RTF_LOCAL; 2189 2162 2163 + rt->rt6i_gateway = *addr; 2190 2164 rt->rt6i_dst.addr = *addr; 2191 2165 rt->rt6i_dst.plen = 128; 2192 2166 rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL);
+2 -3
net/ipv6/udp.c
··· 1225 1225 if (tclass < 0) 1226 1226 tclass = np->tclass; 1227 1227 1228 - if (dontfrag < 0) 1229 - dontfrag = np->dontfrag; 1230 - 1231 1228 if (msg->msg_flags&MSG_CONFIRM) 1232 1229 goto do_confirm; 1233 1230 back_from_confirm: ··· 1243 1246 up->pending = AF_INET6; 1244 1247 1245 1248 do_append_data: 1249 + if (dontfrag < 0) 1250 + dontfrag = np->dontfrag; 1246 1251 up->len += ulen; 1247 1252 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; 1248 1253 err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,
+1
net/ipv6/xfrm6_policy.c
··· 138 138 139 139 memset(fl6, 0, sizeof(struct flowi6)); 140 140 fl6->flowi6_mark = skb->mark; 141 + fl6->flowi6_oif = skb_dst(skb)->dev->ifindex; 141 142 142 143 fl6->daddr = reverse ? hdr->saddr : hdr->daddr; 143 144 fl6->saddr = reverse ? hdr->daddr : hdr->saddr;
+2 -1
net/key/af_key.c
··· 1098 1098 1099 1099 x->id.proto = proto; 1100 1100 x->id.spi = sa->sadb_sa_spi; 1101 - x->props.replay_window = sa->sadb_sa_replay; 1101 + x->props.replay_window = min_t(unsigned int, sa->sadb_sa_replay, 1102 + (sizeof(x->replay.bitmap) * 8)); 1102 1103 if (sa->sadb_sa_flags & SADB_SAFLAGS_NOECN) 1103 1104 x->props.flags |= XFRM_STATE_NOECN; 1104 1105 if (sa->sadb_sa_flags & SADB_SAFLAGS_DECAP_DSCP)
+29 -7
net/l2tp/l2tp_core.c
··· 115 115 static void l2tp_session_set_header_len(struct l2tp_session *session, int version); 116 116 static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); 117 117 118 + static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) 119 + { 120 + return sk->sk_user_data; 121 + } 122 + 118 123 static inline struct l2tp_net *l2tp_pernet(struct net *net) 119 124 { 120 125 BUG_ON(!net); ··· 509 504 return 0; 510 505 511 506 #if IS_ENABLED(CONFIG_IPV6) 512 - if (sk->sk_family == PF_INET6) { 507 + if (sk->sk_family == PF_INET6 && !l2tp_tunnel(sk)->v4mapped) { 513 508 if (!uh->check) { 514 509 LIMIT_NETDEBUG(KERN_INFO "L2TP: IPv6: checksum is 0\n"); 515 510 return 1; ··· 1133 1128 /* Queue the packet to IP for output */ 1134 1129 skb->local_df = 1; 1135 1130 #if IS_ENABLED(CONFIG_IPV6) 1136 - if (skb->sk->sk_family == PF_INET6) 1131 + if (skb->sk->sk_family == PF_INET6 && !tunnel->v4mapped) 1137 1132 error = inet6_csk_xmit(skb, NULL); 1138 1133 else 1139 1134 #endif ··· 1260 1255 1261 1256 /* Calculate UDP checksum if configured to do so */ 1262 1257 #if IS_ENABLED(CONFIG_IPV6) 1263 - if (sk->sk_family == PF_INET6) 1258 + if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) 1264 1259 l2tp_xmit_ipv6_csum(sk, skb, udp_len); 1265 1260 else 1266 1261 #endif ··· 1309 1304 */ 1310 1305 static void l2tp_tunnel_destruct(struct sock *sk) 1311 1306 { 1312 - struct l2tp_tunnel *tunnel; 1307 + struct l2tp_tunnel *tunnel = l2tp_tunnel(sk); 1313 1308 struct l2tp_net *pn; 1314 1309 1315 - tunnel = sk->sk_user_data; 1316 1310 if (tunnel == NULL) 1317 1311 goto end; 1318 1312 ··· 1679 1675 } 1680 1676 1681 1677 /* Check if this socket has already been prepped */ 1682 - tunnel = (struct l2tp_tunnel *)sk->sk_user_data; 1678 + tunnel = l2tp_tunnel(sk); 1683 1679 if (tunnel != NULL) { 1684 1680 /* This socket has already been prepped */ 1685 1681 err = -EBUSY; ··· 1708 1704 if (cfg != NULL) 1709 1705 tunnel->debug = cfg->debug; 1710 1706 1707 + #if IS_ENABLED(CONFIG_IPV6) 1708 + if (sk->sk_family == PF_INET6) { 1709 + struct ipv6_pinfo *np = inet6_sk(sk); 1710 + 1711 + if (ipv6_addr_v4mapped(&np->saddr) && 1712 + ipv6_addr_v4mapped(&np->daddr)) { 1713 + struct inet_sock *inet = inet_sk(sk); 1714 + 1715 + tunnel->v4mapped = true; 1716 + inet->inet_saddr = np->saddr.s6_addr32[3]; 1717 + inet->inet_rcv_saddr = np->rcv_saddr.s6_addr32[3]; 1718 + inet->inet_daddr = np->daddr.s6_addr32[3]; 1719 + } else { 1720 + tunnel->v4mapped = false; 1721 + } 1722 + } 1723 + #endif 1724 + 1711 1725 /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ 1712 1726 tunnel->encap = encap; 1713 1727 if (encap == L2TP_ENCAPTYPE_UDP) { ··· 1734 1712 udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; 1735 1713 udp_sk(sk)->encap_destroy = l2tp_udp_encap_destroy; 1736 1714 #if IS_ENABLED(CONFIG_IPV6) 1737 - if (sk->sk_family == PF_INET6) 1715 + if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) 1738 1716 udpv6_encap_enable(); 1739 1717 else 1740 1718 #endif
+3
net/l2tp/l2tp_core.h
··· 194 194 struct sock *sock; /* Parent socket */ 195 195 int fd; /* Parent fd, if tunnel socket 196 196 * was created by userspace */ 197 + #if IS_ENABLED(CONFIG_IPV6) 198 + bool v4mapped; 199 + #endif 197 200 198 201 struct work_struct del_work; 199 202
+4
net/l2tp/l2tp_ppp.c
··· 353 353 goto error_put_sess_tun; 354 354 } 355 355 356 + local_bh_disable(); 356 357 l2tp_xmit_skb(session, skb, session->hdr_len); 358 + local_bh_enable(); 357 359 358 360 sock_put(ps->tunnel_sock); 359 361 sock_put(sk); ··· 424 422 skb->data[0] = ppph[0]; 425 423 skb->data[1] = ppph[1]; 426 424 425 + local_bh_disable(); 427 426 l2tp_xmit_skb(session, skb, session->hdr_len); 427 + local_bh_enable(); 428 428 429 429 sock_put(sk_tun); 430 430 sock_put(sk);
+1 -1
net/mac80211/cfg.c
··· 3518 3518 return -EINVAL; 3519 3519 } 3520 3520 band = chanctx_conf->def.chan->band; 3521 - sta = sta_info_get(sdata, peer); 3521 + sta = sta_info_get_bss(sdata, peer); 3522 3522 if (sta) { 3523 3523 qos = test_sta_flag(sta, WLAN_STA_WME); 3524 3524 } else {
+3
net/mac80211/ieee80211_i.h
··· 893 893 * that the scan completed. 894 894 * @SCAN_ABORTED: Set for our scan work function when the driver reported 895 895 * a scan complete for an aborted scan. 896 + * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being 897 + * cancelled. 896 898 */ 897 899 enum { 898 900 SCAN_SW_SCANNING, ··· 902 900 SCAN_ONCHANNEL_SCANNING, 903 901 SCAN_COMPLETED, 904 902 SCAN_ABORTED, 903 + SCAN_HW_CANCELLED, 905 904 }; 906 905 907 906 /**
+2
net/mac80211/offchannel.c
··· 394 394 395 395 if (started) 396 396 ieee80211_start_next_roc(local); 397 + else if (list_empty(&local->roc_list)) 398 + ieee80211_run_deferred_scan(local); 397 399 } 398 400 399 401 out_unlock:
+3
net/mac80211/rx.c
··· 3056 3056 case NL80211_IFTYPE_ADHOC: 3057 3057 if (!bssid) 3058 3058 return 0; 3059 + if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || 3060 + ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) 3061 + return 0; 3059 3062 if (ieee80211_is_beacon(hdr->frame_control)) { 3060 3063 return 1; 3061 3064 } else if (!ieee80211_bssid_match(bssid, sdata->u.ibss.bssid)) {
+19
net/mac80211/scan.c
··· 238 238 enum ieee80211_band band; 239 239 int i, ielen, n_chans; 240 240 241 + if (test_bit(SCAN_HW_CANCELLED, &local->scanning)) 242 + return false; 243 + 241 244 do { 242 245 if (local->hw_scan_band == IEEE80211_NUM_BANDS) 243 246 return false; ··· 943 940 if (!local->scan_req) 944 941 goto out; 945 942 943 + /* 944 + * We have a scan running and the driver already reported completion, 945 + * but the worker hasn't run yet or is stuck on the mutex - mark it as 946 + * cancelled. 947 + */ 948 + if (test_bit(SCAN_HW_SCANNING, &local->scanning) && 949 + test_bit(SCAN_COMPLETED, &local->scanning)) { 950 + set_bit(SCAN_HW_CANCELLED, &local->scanning); 951 + goto out; 952 + } 953 + 946 954 if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { 955 + /* 956 + * Make sure that __ieee80211_scan_completed doesn't trigger a 957 + * scan on another band. 958 + */ 959 + set_bit(SCAN_HW_CANCELLED, &local->scanning); 947 960 if (local->ops->cancel_hw_scan) 948 961 drv_cancel_hw_scan(local, 949 962 rcu_dereference_protected(local->scan_sdata,
+3
net/mac80211/status.c
··· 180 180 struct ieee80211_local *local = sta->local; 181 181 struct ieee80211_sub_if_data *sdata = sta->sdata; 182 182 183 + if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 184 + sta->last_rx = jiffies; 185 + 183 186 if (ieee80211_is_data_qos(mgmt->frame_control)) { 184 187 struct ieee80211_hdr *hdr = (void *) skb->data; 185 188 u8 *qc = ieee80211_get_qos_ctl(hdr);
+2 -1
net/mac80211/tx.c
··· 1120 1120 tx->sta = rcu_dereference(sdata->u.vlan.sta); 1121 1121 if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) 1122 1122 return TX_DROP; 1123 - } else if (info->flags & IEEE80211_TX_CTL_INJECTED || 1123 + } else if (info->flags & (IEEE80211_TX_CTL_INJECTED | 1124 + IEEE80211_TX_INTFL_NL80211_FRAME_TX) || 1124 1125 tx->sdata->control_port_protocol == tx->skb->protocol) { 1125 1126 tx->sta = sta_info_get_bss(sdata, hdr->addr1); 1126 1127 }
+5 -4
net/mac80211/util.c
··· 2103 2103 { 2104 2104 struct ieee80211_local *local = sdata->local; 2105 2105 struct ieee80211_supported_band *sband; 2106 - int rate, skip, shift; 2106 + int rate, shift; 2107 2107 u8 i, exrates, *pos; 2108 2108 u32 basic_rates = sdata->vif.bss_conf.basic_rates; 2109 2109 u32 rate_flags; ··· 2131 2131 pos = skb_put(skb, exrates + 2); 2132 2132 *pos++ = WLAN_EID_EXT_SUPP_RATES; 2133 2133 *pos++ = exrates; 2134 - skip = 0; 2135 2134 for (i = 8; i < sband->n_bitrates; i++) { 2136 2135 u8 basic = 0; 2137 2136 if ((rate_flags & sband->bitrates[i].flags) 2138 2137 != rate_flags) 2139 - continue; 2140 - if (skip++ < 8) 2141 2138 continue; 2142 2139 if (need_basic && basic_rates & BIT(i)) 2143 2140 basic = 0x80; ··· 2238 2241 } 2239 2242 2240 2243 rate = cfg80211_calculate_bitrate(&ri); 2244 + if (WARN_ONCE(!rate, 2245 + "Invalid bitrate: flags=0x%x, idx=%d, vht_nss=%d\n", 2246 + status->flag, status->rate_idx, status->vht_nss)) 2247 + return 0; 2241 2248 2242 2249 /* rewind from end of MPDU */ 2243 2250 if (status->flag & RX_FLAG_MACTIME_END)
+2 -2
net/netfilter/nf_conntrack_h323_main.c
··· 778 778 flowi6_to_flowi(&fl1), false)) { 779 779 if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, 780 780 flowi6_to_flowi(&fl2), false)) { 781 - if (!memcmp(&rt1->rt6i_gateway, &rt2->rt6i_gateway, 782 - sizeof(rt1->rt6i_gateway)) && 781 + if (ipv6_addr_equal(rt6_nexthop(rt1), 782 + rt6_nexthop(rt2)) && 783 783 rt1->dst.dev == rt2->dst.dev) 784 784 ret = 1; 785 785 dst_release(&rt2->dst);
+10 -12
net/sched/sch_fq.c
··· 472 472 if (f->credit > 0 || !q->rate_enable) 473 473 goto out; 474 474 475 - if (skb->sk && skb->sk->sk_state != TCP_TIME_WAIT) { 476 - rate = skb->sk->sk_pacing_rate ?: q->flow_default_rate; 475 + rate = q->flow_max_rate; 476 + if (skb->sk && skb->sk->sk_state != TCP_TIME_WAIT) 477 + rate = min(skb->sk->sk_pacing_rate, rate); 477 478 478 - rate = min(rate, q->flow_max_rate); 479 - } else { 480 - rate = q->flow_max_rate; 481 - if (rate == ~0U) 482 - goto out; 483 - } 484 - if (rate) { 479 + if (rate != ~0U) { 485 480 u32 plen = max(qdisc_pkt_len(skb), q->quantum); 486 481 u64 len = (u64)plen * NSEC_PER_SEC; 487 482 488 - do_div(len, rate); 483 + if (likely(rate)) 484 + do_div(len, rate); 489 485 /* Since socket rate can change later, 490 486 * clamp the delay to 125 ms. 491 487 * TODO: maybe segment the too big skb, as in commit ··· 652 656 q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); 653 657 654 658 if (tb[TCA_FQ_INITIAL_QUANTUM]) 655 - q->quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); 659 + q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); 656 660 657 661 if (tb[TCA_FQ_FLOW_DEFAULT_RATE]) 658 662 q->flow_default_rate = nla_get_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]); ··· 731 735 if (opts == NULL) 732 736 goto nla_put_failure; 733 737 738 + /* TCA_FQ_FLOW_DEFAULT_RATE is not used anymore, 739 + * do not bother giving its value 740 + */ 734 741 if (nla_put_u32(skb, TCA_FQ_PLIMIT, sch->limit) || 735 742 nla_put_u32(skb, TCA_FQ_FLOW_PLIMIT, q->flow_plimit) || 736 743 nla_put_u32(skb, TCA_FQ_QUANTUM, q->quantum) || 737 744 nla_put_u32(skb, TCA_FQ_INITIAL_QUANTUM, q->initial_quantum) || 738 745 nla_put_u32(skb, TCA_FQ_RATE_ENABLE, q->rate_enable) || 739 - nla_put_u32(skb, TCA_FQ_FLOW_DEFAULT_RATE, q->flow_default_rate) || 740 746 nla_put_u32(skb, TCA_FQ_FLOW_MAX_RATE, q->flow_max_rate) || 741 747 nla_put_u32(skb, TCA_FQ_BUCKETS_LOG, q->fq_trees_log)) 742 748 goto nla_put_failure;
+17
net/sched/sch_netem.c
··· 358 358 return PSCHED_NS2TICKS(ticks); 359 359 } 360 360 361 + static void tfifo_reset(struct Qdisc *sch) 362 + { 363 + struct netem_sched_data *q = qdisc_priv(sch); 364 + struct rb_node *p; 365 + 366 + while ((p = rb_first(&q->t_root))) { 367 + struct sk_buff *skb = netem_rb_to_skb(p); 368 + 369 + rb_erase(p, &q->t_root); 370 + skb->next = NULL; 371 + skb->prev = NULL; 372 + kfree_skb(skb); 373 + } 374 + } 375 + 361 376 static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) 362 377 { 363 378 struct netem_sched_data *q = qdisc_priv(sch); ··· 535 520 skb->next = NULL; 536 521 skb->prev = NULL; 537 522 len = qdisc_pkt_len(skb); 523 + sch->qstats.backlog -= len; 538 524 kfree_skb(skb); 539 525 } 540 526 } ··· 625 609 struct netem_sched_data *q = qdisc_priv(sch); 626 610 627 611 qdisc_reset_queue(sch); 612 + tfifo_reset(sch); 628 613 if (q->qdisc) 629 614 qdisc_reset(q->qdisc); 630 615 qdisc_watchdog_cancel(&q->watchdog);
+2 -1
net/sctp/output.c
··· 536 536 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 537 537 */ 538 538 if (!sctp_checksum_disable) { 539 - if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) { 539 + if (!(dst->dev->features & NETIF_F_SCTP_CSUM) || 540 + (dst_xfrm(dst) != NULL) || packet->ipfragok) { 540 541 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 541 542 542 543 /* 3) Put the resultant value into the checksum field in the
+20 -4
net/socket.c
··· 1964 1964 unsigned int name_len; 1965 1965 }; 1966 1966 1967 + static int copy_msghdr_from_user(struct msghdr *kmsg, 1968 + struct msghdr __user *umsg) 1969 + { 1970 + if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) 1971 + return -EFAULT; 1972 + if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) 1973 + return -EINVAL; 1974 + return 0; 1975 + } 1976 + 1967 1977 static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg, 1968 1978 struct msghdr *msg_sys, unsigned int flags, 1969 1979 struct used_address *used_address) ··· 1992 1982 if (MSG_CMSG_COMPAT & flags) { 1993 1983 if (get_compat_msghdr(msg_sys, msg_compat)) 1994 1984 return -EFAULT; 1995 - } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) 1996 - return -EFAULT; 1985 + } else { 1986 + err = copy_msghdr_from_user(msg_sys, msg); 1987 + if (err) 1988 + return err; 1989 + } 1997 1990 1998 1991 if (msg_sys->msg_iovlen > UIO_FASTIOV) { 1999 1992 err = -EMSGSIZE; ··· 2204 2191 if (MSG_CMSG_COMPAT & flags) { 2205 2192 if (get_compat_msghdr(msg_sys, msg_compat)) 2206 2193 return -EFAULT; 2207 - } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) 2208 - return -EFAULT; 2194 + } else { 2195 + err = copy_msghdr_from_user(msg_sys, msg); 2196 + if (err) 2197 + return err; 2198 + } 2209 2199 2210 2200 if (msg_sys->msg_iovlen > UIO_FASTIOV) { 2211 2201 err = -EMSGSIZE;
+10
net/unix/af_unix.c
··· 1246 1246 return 0; 1247 1247 } 1248 1248 1249 + static void unix_sock_inherit_flags(const struct socket *old, 1250 + struct socket *new) 1251 + { 1252 + if (test_bit(SOCK_PASSCRED, &old->flags)) 1253 + set_bit(SOCK_PASSCRED, &new->flags); 1254 + if (test_bit(SOCK_PASSSEC, &old->flags)) 1255 + set_bit(SOCK_PASSSEC, &new->flags); 1256 + } 1257 + 1249 1258 static int unix_accept(struct socket *sock, struct socket *newsock, int flags) 1250 1259 { 1251 1260 struct sock *sk = sock->sk; ··· 1289 1280 /* attach accepted sock to socket */ 1290 1281 unix_state_lock(tsk); 1291 1282 newsock->state = SS_CONNECTED; 1283 + unix_sock_inherit_flags(sock, newsock); 1292 1284 sock_graft(tsk, newsock); 1293 1285 unix_state_unlock(tsk); 1294 1286 return 0;
+1
net/unix/diag.c
··· 124 124 rep->udiag_family = AF_UNIX; 125 125 rep->udiag_type = sk->sk_type; 126 126 rep->udiag_state = sk->sk_state; 127 + rep->pad = 0; 127 128 rep->udiag_ino = sk_ino; 128 129 sock_diag_save_cookie(sk, rep->udiag_cookie); 129 130
+13 -10
net/wireless/core.c
··· 566 566 /* check and set up bitrates */ 567 567 ieee80211_set_bitrate_flags(wiphy); 568 568 569 - 569 + rtnl_lock(); 570 570 res = device_add(&rdev->wiphy.dev); 571 - if (res) 572 - return res; 573 - 574 - res = rfkill_register(rdev->rfkill); 575 571 if (res) { 576 - device_del(&rdev->wiphy.dev); 572 + rtnl_unlock(); 577 573 return res; 578 574 } 579 575 580 - rtnl_lock(); 581 576 /* set up regulatory info */ 582 577 wiphy_regulatory_register(wiphy); 583 578 ··· 601 606 602 607 rdev->wiphy.registered = true; 603 608 rtnl_unlock(); 609 + 610 + res = rfkill_register(rdev->rfkill); 611 + if (res) { 612 + rfkill_destroy(rdev->rfkill); 613 + rdev->rfkill = NULL; 614 + wiphy_unregister(&rdev->wiphy); 615 + return res; 616 + } 617 + 604 618 return 0; 605 619 } 606 620 EXPORT_SYMBOL(wiphy_register); ··· 644 640 rtnl_unlock(); 645 641 __count == 0; })); 646 642 647 - rfkill_unregister(rdev->rfkill); 643 + if (rdev->rfkill) 644 + rfkill_unregister(rdev->rfkill); 648 645 649 646 rtnl_lock(); 650 647 rdev->wiphy.registered = false; ··· 958 953 case NETDEV_PRE_UP: 959 954 if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) 960 955 return notifier_from_errno(-EOPNOTSUPP); 961 - if (rfkill_blocked(rdev->rfkill)) 962 - return notifier_from_errno(-ERFKILL); 963 956 ret = cfg80211_can_add_interface(rdev, wdev->iftype); 964 957 if (ret) 965 958 return notifier_from_errno(ret);
+3
net/wireless/core.h
··· 411 411 cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, 412 412 enum nl80211_iftype iftype) 413 413 { 414 + if (rfkill_blocked(rdev->rfkill)) 415 + return -ERFKILL; 416 + 414 417 return cfg80211_can_change_interface(rdev, NULL, iftype); 415 418 } 416 419
+3
net/wireless/ibss.c
··· 263 263 if (chan->flags & IEEE80211_CHAN_DISABLED) 264 264 continue; 265 265 wdev->wext.ibss.chandef.chan = chan; 266 + wdev->wext.ibss.chandef.center_freq1 = 267 + chan->center_freq; 266 268 break; 267 269 } 268 270 ··· 349 347 if (chan) { 350 348 wdev->wext.ibss.chandef.chan = chan; 351 349 wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; 350 + wdev->wext.ibss.chandef.center_freq1 = freq; 352 351 wdev->wext.ibss.channel_fixed = true; 353 352 } else { 354 353 /* cfg80211_ibss_wext_join will pick one if needed */
+2 -2
net/wireless/nl80211.c
··· 2421 2421 change = true; 2422 2422 } 2423 2423 2424 - if (flags && (*flags & NL80211_MNTR_FLAG_ACTIVE) && 2424 + if (flags && (*flags & MONITOR_FLAG_ACTIVE) && 2425 2425 !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) 2426 2426 return -EOPNOTSUPP; 2427 2427 ··· 2483 2483 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, 2484 2484 &flags); 2485 2485 2486 - if (!err && (flags & NL80211_MNTR_FLAG_ACTIVE) && 2486 + if (!err && (flags & MONITOR_FLAG_ACTIVE) && 2487 2487 !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) 2488 2488 return -EOPNOTSUPP; 2489 2489
+6 -1
net/wireless/radiotap.c
··· 97 97 struct ieee80211_radiotap_header *radiotap_header, 98 98 int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns) 99 99 { 100 + /* check the radiotap header can actually be present */ 101 + if (max_length < sizeof(struct ieee80211_radiotap_header)) 102 + return -EINVAL; 103 + 100 104 /* Linux only supports version 0 radiotap format */ 101 105 if (radiotap_header->it_version) 102 106 return -EINVAL; ··· 135 131 */ 136 132 137 133 if ((unsigned long)iterator->_arg - 138 - (unsigned long)iterator->_rtheader > 134 + (unsigned long)iterator->_rtheader + 135 + sizeof(uint32_t) > 139 136 (unsigned long)iterator->_max_length) 140 137 return -EINVAL; 141 138 }
+21 -7
net/xfrm/xfrm_policy.c
··· 334 334 335 335 atomic_inc(&policy->genid); 336 336 337 - del_timer(&policy->polq.hold_timer); 337 + if (del_timer(&policy->polq.hold_timer)) 338 + xfrm_pol_put(policy); 338 339 xfrm_queue_purge(&policy->polq.hold_queue); 339 340 340 341 if (del_timer(&policy->timer)) ··· 590 589 591 590 spin_lock_bh(&pq->hold_queue.lock); 592 591 skb_queue_splice_init(&pq->hold_queue, &list); 593 - del_timer(&pq->hold_timer); 592 + if (del_timer(&pq->hold_timer)) 593 + xfrm_pol_put(old); 594 594 spin_unlock_bh(&pq->hold_queue.lock); 595 595 596 596 if (skb_queue_empty(&list)) ··· 602 600 spin_lock_bh(&pq->hold_queue.lock); 603 601 skb_queue_splice(&list, &pq->hold_queue); 604 602 pq->timeout = XFRM_QUEUE_TMO_MIN; 605 - mod_timer(&pq->hold_timer, jiffies); 603 + if (!mod_timer(&pq->hold_timer, jiffies)) 604 + xfrm_pol_hold(new); 606 605 spin_unlock_bh(&pq->hold_queue.lock); 607 606 } 608 607 ··· 1772 1769 1773 1770 spin_lock(&pq->hold_queue.lock); 1774 1771 skb = skb_peek(&pq->hold_queue); 1772 + if (!skb) { 1773 + spin_unlock(&pq->hold_queue.lock); 1774 + goto out; 1775 + } 1775 1776 dst = skb_dst(skb); 1776 1777 sk = skb->sk; 1777 1778 xfrm_decode_session(skb, &fl, dst->ops->family); ··· 1794 1787 goto purge_queue; 1795 1788 1796 1789 pq->timeout = pq->timeout << 1; 1797 - mod_timer(&pq->hold_timer, jiffies + pq->timeout); 1798 - return; 1790 + if (!mod_timer(&pq->hold_timer, jiffies + pq->timeout)) 1791 + xfrm_pol_hold(pol); 1792 + goto out; 1799 1793 } 1800 1794 1801 1795 dst_release(dst); ··· 1827 1819 err = dst_output(skb); 1828 1820 } 1829 1821 1822 + out: 1823 + xfrm_pol_put(pol); 1830 1824 return; 1831 1825 1832 1826 purge_queue: 1833 1827 pq->timeout = 0; 1834 1828 xfrm_queue_purge(&pq->hold_queue); 1829 + xfrm_pol_put(pol); 1835 1830 } 1836 1831 1837 1832 static int xdst_queue_output(struct sk_buff *skb) ··· 1842 1831 unsigned long sched_next; 1843 1832 struct dst_entry *dst = skb_dst(skb); 1844 1833 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; 1845 - struct xfrm_policy_queue *pq = &xdst->pols[0]->polq; 1834 + struct xfrm_policy *pol = xdst->pols[0]; 1835 + struct xfrm_policy_queue *pq = &pol->polq; 1846 1836 1847 1837 if (pq->hold_queue.qlen > XFRM_MAX_QUEUE_LEN) { 1848 1838 kfree_skb(skb); ··· 1862 1850 if (del_timer(&pq->hold_timer)) { 1863 1851 if (time_before(pq->hold_timer.expires, sched_next)) 1864 1852 sched_next = pq->hold_timer.expires; 1853 + xfrm_pol_put(pol); 1865 1854 } 1866 1855 1867 1856 __skb_queue_tail(&pq->hold_queue, skb); 1868 - mod_timer(&pq->hold_timer, sched_next); 1857 + if (!mod_timer(&pq->hold_timer, sched_next)) 1858 + xfrm_pol_hold(pol); 1869 1859 1870 1860 spin_unlock_bh(&pq->hold_queue.lock); 1871 1861
+29 -27
net/xfrm/xfrm_replay.c
··· 61 61 62 62 switch (event) { 63 63 case XFRM_REPLAY_UPDATE: 64 - if (x->replay_maxdiff && 65 - (x->replay.seq - x->preplay.seq < x->replay_maxdiff) && 66 - (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff)) { 64 + if (!x->replay_maxdiff || 65 + ((x->replay.seq - x->preplay.seq < x->replay_maxdiff) && 66 + (x->replay.oseq - x->preplay.oseq < x->replay_maxdiff))) { 67 67 if (x->xflags & XFRM_TIME_DEFER) 68 68 event = XFRM_REPLAY_TIMEOUT; 69 69 else ··· 129 129 return 0; 130 130 131 131 diff = x->replay.seq - seq; 132 - if (diff >= min_t(unsigned int, x->props.replay_window, 133 - sizeof(x->replay.bitmap) * 8)) { 132 + if (diff >= x->props.replay_window) { 134 133 x->stats.replay_window++; 135 134 goto err; 136 135 } ··· 301 302 302 303 switch (event) { 303 304 case XFRM_REPLAY_UPDATE: 304 - if (x->replay_maxdiff && 305 - (replay_esn->seq - preplay_esn->seq < x->replay_maxdiff) && 306 - (replay_esn->oseq - preplay_esn->oseq < x->replay_maxdiff)) { 305 + if (!x->replay_maxdiff || 306 + ((replay_esn->seq - preplay_esn->seq < x->replay_maxdiff) && 307 + (replay_esn->oseq - preplay_esn->oseq 308 + < x->replay_maxdiff))) { 307 309 if (x->xflags & XFRM_TIME_DEFER) 308 310 event = XFRM_REPLAY_TIMEOUT; 309 311 else ··· 353 353 354 354 switch (event) { 355 355 case XFRM_REPLAY_UPDATE: 356 - if (!x->replay_maxdiff) 357 - break; 358 - 359 - if (replay_esn->seq_hi == preplay_esn->seq_hi) 360 - seq_diff = replay_esn->seq - preplay_esn->seq; 361 - else 362 - seq_diff = ~preplay_esn->seq + replay_esn->seq + 1; 363 - 364 - if (replay_esn->oseq_hi == preplay_esn->oseq_hi) 365 - oseq_diff = replay_esn->oseq - preplay_esn->oseq; 366 - else 367 - oseq_diff = ~preplay_esn->oseq + replay_esn->oseq + 1; 368 - 369 - if (seq_diff < x->replay_maxdiff && 370 - oseq_diff < x->replay_maxdiff) { 371 - 372 - if (x->xflags & XFRM_TIME_DEFER) 373 - event = XFRM_REPLAY_TIMEOUT; 356 + if (x->replay_maxdiff) { 357 + if (replay_esn->seq_hi == preplay_esn->seq_hi) 358 + seq_diff = replay_esn->seq - preplay_esn->seq; 374 359 else 375 - return; 360 + seq_diff = ~preplay_esn->seq + replay_esn->seq 361 + + 1; 362 + 363 + if (replay_esn->oseq_hi == preplay_esn->oseq_hi) 364 + oseq_diff = replay_esn->oseq 365 + - preplay_esn->oseq; 366 + else 367 + oseq_diff = ~preplay_esn->oseq 368 + + replay_esn->oseq + 1; 369 + 370 + if (seq_diff >= x->replay_maxdiff || 371 + oseq_diff >= x->replay_maxdiff) 372 + break; 376 373 } 374 + 375 + if (x->xflags & XFRM_TIME_DEFER) 376 + event = XFRM_REPLAY_TIMEOUT; 377 + else 378 + return; 377 379 378 380 break; 379 381
+3 -2
net/xfrm/xfrm_user.c
··· 446 446 memcpy(&x->sel, &p->sel, sizeof(x->sel)); 447 447 memcpy(&x->lft, &p->lft, sizeof(x->lft)); 448 448 x->props.mode = p->mode; 449 - x->props.replay_window = p->replay_window; 449 + x->props.replay_window = min_t(unsigned int, p->replay_window, 450 + sizeof(x->replay.bitmap) * 8); 450 451 x->props.reqid = p->reqid; 451 452 x->props.family = p->family; 452 453 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); ··· 1857 1856 if (x->km.state != XFRM_STATE_VALID) 1858 1857 goto out; 1859 1858 1860 - err = xfrm_replay_verify_len(x->replay_esn, rp); 1859 + err = xfrm_replay_verify_len(x->replay_esn, re); 1861 1860 if (err) 1862 1861 goto out; 1863 1862