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

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

Conflicts:
include/linux/netdevice.h
net/core/sock.c

Trivial merge issues.

Removal of "extern" for functions declaration in netdevice.h
at the same time "const" was added to an argument.

Two parallel line additions in net/core/sock.c

Signed-off-by: David S. Miller <davem@davemloft.net>

+474 -206
+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
··· 1785 1785 1786 1786 BONDING DRIVER 1787 1787 M: Jay Vosburgh <fubar@us.ibm.com> 1788 + M: Veaceslav Falico <vfalico@redhat.com> 1788 1789 M: Andy Gospodarek <andy@greyhouse.net> 1789 1790 L: netdev@vger.kernel.org 1790 1791 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 }
+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 }
+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);
+2
drivers/net/ethernet/intel/igb/igb_ethtool.c
··· 2657 2657 (hw->phy.media_type != e1000_media_type_copper)) 2658 2658 return -EOPNOTSUPP; 2659 2659 2660 + memset(&eee_curr, 0, sizeof(struct ethtool_eee)); 2661 + 2660 2662 ret_val = igb_get_eee(netdev, &eee_curr); 2661 2663 if (ret_val) 2662 2664 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
+4 -1
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);
+4
drivers/net/ethernet/renesas/sh_eth.c
··· 620 620 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | 621 621 EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE | 622 622 EESR_TDE | EESR_ECI, 623 + .fdr_value = 0x0000070f, 624 + .rmcr_value = 0x00000001, 623 625 624 626 .apr = 1, 625 627 .mpr = 1, 626 628 .tpauser = 1, 627 629 .bculr = 1, 628 630 .hw_swap = 1, 631 + .rpadir = 1, 632 + .rpadir_value = 2 << 16, 629 633 .no_trimd = 1, 630 634 .no_ade = 1, 631 635 .tsu = 1,
+63 -20
drivers/net/ethernet/sfc/ef10.c
··· 754 754 EF10_DMA_STAT(rx_align_error, RX_ALIGN_ERROR_PKTS), 755 755 EF10_DMA_STAT(rx_length_error, RX_LENGTH_ERROR_PKTS), 756 756 EF10_DMA_STAT(rx_nodesc_drops, RX_NODESC_DROPS), 757 + EF10_DMA_STAT(rx_pm_trunc_bb_overflow, PM_TRUNC_BB_OVERFLOW), 758 + EF10_DMA_STAT(rx_pm_discard_bb_overflow, PM_DISCARD_BB_OVERFLOW), 759 + EF10_DMA_STAT(rx_pm_trunc_vfifo_full, PM_TRUNC_VFIFO_FULL), 760 + EF10_DMA_STAT(rx_pm_discard_vfifo_full, PM_DISCARD_VFIFO_FULL), 761 + EF10_DMA_STAT(rx_pm_trunc_qbb, PM_TRUNC_QBB), 762 + EF10_DMA_STAT(rx_pm_discard_qbb, PM_DISCARD_QBB), 763 + EF10_DMA_STAT(rx_pm_discard_mapping, PM_DISCARD_MAPPING), 764 + EF10_DMA_STAT(rx_dp_q_disabled_packets, RXDP_Q_DISABLED_PKTS), 765 + EF10_DMA_STAT(rx_dp_di_dropped_packets, RXDP_DI_DROPPED_PKTS), 766 + EF10_DMA_STAT(rx_dp_streaming_packets, RXDP_STREAMING_PKTS), 767 + EF10_DMA_STAT(rx_dp_emerg_fetch, RXDP_EMERGENCY_FETCH_CONDITIONS), 768 + EF10_DMA_STAT(rx_dp_emerg_wait, RXDP_EMERGENCY_WAIT_CONDITIONS), 757 769 }; 758 770 759 771 #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_tx_bytes) | \ ··· 820 808 #define HUNT_40G_EXTRA_STAT_MASK ((1ULL << EF10_STAT_rx_align_error) | \ 821 809 (1ULL << EF10_STAT_rx_length_error)) 822 810 823 - #if BITS_PER_LONG == 64 824 - #define STAT_MASK_BITMAP(bits) (bits) 825 - #else 826 - #define STAT_MASK_BITMAP(bits) (bits) & 0xffffffff, (bits) >> 32 827 - #endif 811 + /* These statistics are only provided if the firmware supports the 812 + * capability PM_AND_RXDP_COUNTERS. 813 + */ 814 + #define HUNT_PM_AND_RXDP_STAT_MASK ( \ 815 + (1ULL << EF10_STAT_rx_pm_trunc_bb_overflow) | \ 816 + (1ULL << EF10_STAT_rx_pm_discard_bb_overflow) | \ 817 + (1ULL << EF10_STAT_rx_pm_trunc_vfifo_full) | \ 818 + (1ULL << EF10_STAT_rx_pm_discard_vfifo_full) | \ 819 + (1ULL << EF10_STAT_rx_pm_trunc_qbb) | \ 820 + (1ULL << EF10_STAT_rx_pm_discard_qbb) | \ 821 + (1ULL << EF10_STAT_rx_pm_discard_mapping) | \ 822 + (1ULL << EF10_STAT_rx_dp_q_disabled_packets) | \ 823 + (1ULL << EF10_STAT_rx_dp_di_dropped_packets) | \ 824 + (1ULL << EF10_STAT_rx_dp_streaming_packets) | \ 825 + (1ULL << EF10_STAT_rx_dp_emerg_fetch) | \ 826 + (1ULL << EF10_STAT_rx_dp_emerg_wait)) 828 827 829 - static const unsigned long *efx_ef10_stat_mask(struct efx_nic *efx) 828 + static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) 830 829 { 831 - static const unsigned long hunt_40g_stat_mask[] = { 832 - STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | 833 - HUNT_40G_EXTRA_STAT_MASK) 834 - }; 835 - static const unsigned long hunt_10g_only_stat_mask[] = { 836 - STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | 837 - HUNT_10G_ONLY_STAT_MASK) 838 - }; 830 + u64 raw_mask = HUNT_COMMON_STAT_MASK; 839 831 u32 port_caps = efx_mcdi_phy_get_caps(efx); 832 + struct efx_ef10_nic_data *nic_data = efx->nic_data; 840 833 841 834 if (port_caps & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) 842 - return hunt_40g_stat_mask; 835 + raw_mask |= HUNT_40G_EXTRA_STAT_MASK; 843 836 else 844 - return hunt_10g_only_stat_mask; 837 + raw_mask |= HUNT_10G_ONLY_STAT_MASK; 838 + 839 + if (nic_data->datapath_caps & 840 + (1 << MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN)) 841 + raw_mask |= HUNT_PM_AND_RXDP_STAT_MASK; 842 + 843 + return raw_mask; 844 + } 845 + 846 + static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) 847 + { 848 + u64 raw_mask = efx_ef10_raw_stat_mask(efx); 849 + 850 + #if BITS_PER_LONG == 64 851 + mask[0] = raw_mask; 852 + #else 853 + mask[0] = raw_mask & 0xffffffff; 854 + mask[1] = raw_mask >> 32; 855 + #endif 845 856 } 846 857 847 858 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) 848 859 { 860 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 861 + 862 + efx_ef10_get_stat_mask(efx, mask); 849 863 return efx_nic_describe_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, 850 - efx_ef10_stat_mask(efx), names); 864 + mask, names); 851 865 } 852 866 853 867 static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) 854 868 { 855 869 struct efx_ef10_nic_data *nic_data = efx->nic_data; 856 - const unsigned long *stats_mask = efx_ef10_stat_mask(efx); 870 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 857 871 __le64 generation_start, generation_end; 858 872 u64 *stats = nic_data->stats; 859 873 __le64 *dma_stats; 874 + 875 + efx_ef10_get_stat_mask(efx, mask); 860 876 861 877 dma_stats = efx->stats_buffer.addr; 862 878 nic_data = efx->nic_data; ··· 893 853 if (generation_end == EFX_MC_STATS_GENERATION_INVALID) 894 854 return 0; 895 855 rmb(); 896 - efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, stats_mask, 856 + efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, mask, 897 857 stats, efx->stats_buffer.addr, false); 858 + rmb(); 898 859 generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; 899 860 if (generation_end != generation_start) 900 861 return -EAGAIN; ··· 914 873 static size_t efx_ef10_update_stats(struct efx_nic *efx, u64 *full_stats, 915 874 struct rtnl_link_stats64 *core_stats) 916 875 { 917 - const unsigned long *mask = efx_ef10_stat_mask(efx); 876 + DECLARE_BITMAP(mask, EF10_STAT_COUNT); 918 877 struct efx_ef10_nic_data *nic_data = efx->nic_data; 919 878 u64 *stats = nic_data->stats; 920 879 size_t stats_count = 0, index; 921 880 int retry; 881 + 882 + efx_ef10_get_stat_mask(efx, mask); 922 883 923 884 /* If we're unlucky enough to read statistics during the DMA, wait 924 885 * 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
··· 480 480 * @count: Length of the @desc array 481 481 * @mask: Bitmask of which elements of @desc are enabled 482 482 * @stats: Buffer to update with the converted statistics. The length 483 - * of this array must be at least the number of set bits in the 484 - * first @count bits of @mask. 483 + * of this array must be at least @count. 485 484 * @dma_buf: DMA buffer containing hardware statistics 486 485 * @accumulate: If set, the converted values will be added rather than 487 486 * directly stored to the corresponding elements of @stats ··· 513 514 } 514 515 515 516 if (accumulate) 516 - *stats += val; 517 + stats[index] += val; 517 518 else 518 - *stats = val; 519 + stats[index] = val; 519 520 } 520 - 521 - ++stats; 522 521 } 523 522 }
+12
drivers/net/ethernet/sfc/nic.h
··· 402 402 EF10_STAT_rx_align_error, 403 403 EF10_STAT_rx_length_error, 404 404 EF10_STAT_rx_nodesc_drops, 405 + EF10_STAT_rx_pm_trunc_bb_overflow, 406 + EF10_STAT_rx_pm_discard_bb_overflow, 407 + EF10_STAT_rx_pm_trunc_vfifo_full, 408 + EF10_STAT_rx_pm_discard_vfifo_full, 409 + EF10_STAT_rx_pm_trunc_qbb, 410 + EF10_STAT_rx_pm_discard_qbb, 411 + EF10_STAT_rx_pm_discard_mapping, 412 + EF10_STAT_rx_dp_q_disabled_packets, 413 + EF10_STAT_rx_dp_di_dropped_packets, 414 + EF10_STAT_rx_dp_streaming_packets, 415 + EF10_STAT_rx_dp_emerg_fetch, 416 + EF10_STAT_rx_dp_emerg_wait, 405 417 EF10_STAT_COUNT 406 418 }; 407 419
+7 -3
drivers/net/ethernet/ti/cpsw.c
··· 1766 1766 } 1767 1767 data->mac_control = prop; 1768 1768 1769 - if (!of_property_read_u32(node, "dual_emac", &prop)) 1770 - data->dual_emac = prop; 1769 + if (of_property_read_bool(node, "dual_emac")) 1770 + data->dual_emac = 1; 1771 1771 1772 1772 /* 1773 1773 * Populate all the child nodes here... ··· 1777 1777 if (ret) 1778 1778 pr_warn("Doesn't have any child node\n"); 1779 1779 1780 - for_each_node_by_name(slave_node, "slave") { 1780 + for_each_child_of_node(node, slave_node) { 1781 1781 struct cpsw_slave_data *slave_data = data->slave_data + i; 1782 1782 const void *mac_addr = NULL; 1783 1783 u32 phyid; ··· 1785 1785 const __be32 *parp; 1786 1786 struct device_node *mdio_node; 1787 1787 struct platform_device *mdio; 1788 + 1789 + /* This is no slave child node, continue */ 1790 + if (strcmp(slave_node->name, "slave")) 1791 + continue; 1788 1792 1789 1793 parp = of_get_property(slave_node, "phy_id", &lenp); 1790 1794 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
+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 }
+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;
+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
+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.
+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
+2 -2
include/linux/netdevice.h
··· 2273 2273 } 2274 2274 2275 2275 #ifdef CONFIG_XPS 2276 - int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, 2276 + int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2277 2277 u16 index); 2278 2278 #else 2279 2279 static inline int netif_set_xps_queue(struct net_device *dev, 2280 - struct cpumask *mask, 2280 + const struct cpumask *mask, 2281 2281 u16 index) 2282 2282 { 2283 2283 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,
+2 -4
include/net/sock.h
··· 1612 1612 1613 1613 static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1614 1614 { 1615 - unsigned int size = sk_filter_len(fp); 1616 - 1617 - atomic_sub(size, &sk->sk_omem_alloc); 1615 + atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc); 1618 1616 sk_filter_release(fp); 1619 1617 } 1620 1618 1621 1619 static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 1622 1620 { 1623 1621 atomic_inc(&fp->refcnt); 1624 - atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); 1622 + atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc); 1625 1623 } 1626 1624 1627 1625 /*
+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
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
··· 1916 1916 return new_map; 1917 1917 } 1918 1918 1919 - int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, u16 index) 1919 + int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 1920 + u16 index) 1920 1921 { 1921 1922 struct xps_dev_maps *dev_maps, *new_dev_maps = NULL; 1922 1923 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
+1
net/core/sock.c
··· 2331 2331 #endif 2332 2332 2333 2333 sk->sk_max_pacing_rate = ~0U; 2334 + sk->sk_pacing_rate = ~0U; 2334 2335 /* 2335 2336 * Before updating sk_refcnt, we must commit prior changes to memory 2336 2337 * (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;
+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);
+4 -1
net/ipv4/tcp_input.c
··· 1326 1326 tp->lost_cnt_hint -= tcp_skb_pcount(prev); 1327 1327 } 1328 1328 1329 - TCP_SKB_CB(skb)->tcp_flags |= TCP_SKB_CB(prev)->tcp_flags; 1329 + TCP_SKB_CB(prev)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags; 1330 + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 1331 + TCP_SKB_CB(prev)->end_seq++; 1332 + 1330 1333 if (skb == tcp_highest_sack(sk)) 1331 1334 tcp_advance_highest_sack(sk, skb); 1332 1335
+2
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)) {
+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;
+1 -2
net/ipv6/ip6_gre.c
··· 1173 1173 1174 1174 static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu) 1175 1175 { 1176 - struct ip6_tnl *tunnel = netdev_priv(dev); 1177 1176 if (new_mtu < 68 || 1178 - new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen) 1177 + new_mtu > 0xFFF8 - dev->hard_header_len) 1179 1178 return -EINVAL; 1180 1179 dev->mtu = new_mtu; 1181 1180 return 0;
+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 }
+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
+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)) {
+1 -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;
+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;
+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;
+2 -2
net/sysctl_net.c
··· 47 47 48 48 /* Allow network administrator to have same access as root. */ 49 49 if (ns_capable(net->user_ns, CAP_NET_ADMIN) || 50 - uid_eq(root_uid, current_uid())) { 50 + uid_eq(root_uid, current_euid())) { 51 51 int mode = (table->mode >> 6) & 7; 52 52 return (mode << 6) | (mode << 3) | mode; 53 53 } 54 54 /* Allow netns root group to have the same access as the root group */ 55 - if (gid_eq(root_gid, current_gid())) { 55 + if (in_egroup_p(root_gid)) { 56 56 int mode = (table->mode >> 3) & 7; 57 57 return (mode << 3) | mode; 58 58 }
+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 -8
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;
+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