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:
"A couple interesting SKB fragment handling fixes, plus the usual small
bits here and there:

1) Fix 64-bit divide build failure on 32-bit platforms in mlx5, from
Tim Gardner.

2) Get rid of a stupid reimplementation on "%*phC" in our sysfs MAC
address printing helper.

3) Fix NETIF_F_SG capability advertisement in hyperv driver, if the
device can't do checksumming offloads then it shouldn't say it can
do SG either. From Haiyang Zhang.

4) bgmac needs to depend on PHYLIB, from Hauke Mehrtens.

5) Don't leak DMA mappings on mapping failures, from Neil Horman.

6) We need to reset the transport header of SKBs in ipv4 before we
attempt to perform early socket demux, just like ipv6 does. From
Eric Dumazet.

7) Add missing locking on vxlan device removal, from Stephen
Hemminger.

8) xen-netfront has to make two passes over an SKB to prepare it for
transfer. One pass calculates the number of slots needed, the
second massages the SKB and fills the slots. Unfortunately, the
first pass doesn't calculate the number of slots properly so we
can end up trying to build a MAX_SKB_FRAGS + 1 SKB which doesn't
work out so well. Fix from Jan Beulich with help and discussion
with several others.

9) Fix a similar problem in tun and macvtap, which have to split up
scatter-gather elements at PAGE_SIZE boundaries. Don't do
zerocopy if it would result in a > MAX_SKB_FRAGS skb. Fixes from
Jason Wang.

10) On receive, once we've decoded the VLAN state completely, clear
skb->vlan_tci. Otherwise demuxed tunnels underneath can trigger
the VLAN code again, corrupting the packet. Fix from Eric
Dumazet"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
vlan: fix a race in egress prio management
vlan: mask vlan prio bits
macvtap: do not zerocopy if iov needs more pages than MAX_SKB_FRAGS
tuntap: do not zerocopy if iov needs more pages than MAX_SKB_FRAGS
pkt_sched: sch_qfq: remove a source of high packet delay/jitter
xen-netfront: pull on receive skb may need to happen earlier
vxlan: add necessary locking on device removal
hyperv: Fix the NETIF_F_SG flag setting in netvsc
net: Fix sysfs_format_mac() code duplication.
be2net: Fix to avoid hardware workaround when not needed
macvtap: do not assume 802.1Q when send vlan packets
macvtap: fix the missing ret value of TUNSETQUEUE
ipv4: set transport header earlier
mlx5 core: Fix __udivdi3 when compiling for 32 bit arches
bgmac: add dependency to phylib
net/irda: fixed style issues in irlan_eth
ethtool: fixed trailing statements in ethtool
ndisc: bool initializations should use true and false
atl1e: unmap partially mapped skb on dma error and free skb

+248 -164
+23 -1
drivers/net/ethernet/atheros/atl1e/atl1e_main.c
··· 1678 1678 u16 f; 1679 1679 int segment; 1680 1680 int ring_start = adapter->tx_ring.next_to_use; 1681 + int ring_end; 1681 1682 1682 1683 nr_frags = skb_shinfo(skb)->nr_frags; 1683 1684 segment = (tpd->word3 >> TPD_SEGMENT_EN_SHIFT) & TPD_SEGMENT_EN_MASK; ··· 1722 1721 map_len, PCI_DMA_TODEVICE); 1723 1722 1724 1723 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) { 1724 + /* We need to unwind the mappings we've done */ 1725 + ring_end = adapter->tx_ring.next_to_use; 1726 + adapter->tx_ring.next_to_use = ring_start; 1727 + while (adapter->tx_ring.next_to_use != ring_end) { 1728 + tpd = atl1e_get_tpd(adapter); 1729 + tx_buffer = atl1e_get_tx_buffer(adapter, tpd); 1730 + pci_unmap_single(adapter->pdev, tx_buffer->dma, 1731 + tx_buffer->length, PCI_DMA_TODEVICE); 1732 + } 1725 1733 /* Reset the tx rings next pointer */ 1726 1734 adapter->tx_ring.next_to_use = ring_start; 1727 1735 return -ENOSPC; ··· 1773 1763 DMA_TO_DEVICE); 1774 1764 1775 1765 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) { 1766 + /* We need to unwind the mappings we've done */ 1767 + ring_end = adapter->tx_ring.next_to_use; 1768 + adapter->tx_ring.next_to_use = ring_start; 1769 + while (adapter->tx_ring.next_to_use != ring_end) { 1770 + tpd = atl1e_get_tpd(adapter); 1771 + tx_buffer = atl1e_get_tx_buffer(adapter, tpd); 1772 + dma_unmap_page(&adapter->pdev->dev, tx_buffer->dma, 1773 + tx_buffer->length, DMA_TO_DEVICE); 1774 + } 1775 + 1776 1776 /* Reset the ring next to use pointer */ 1777 1777 adapter->tx_ring.next_to_use = ring_start; 1778 1778 return -ENOSPC; ··· 1873 1853 return NETDEV_TX_OK; 1874 1854 } 1875 1855 1876 - if (atl1e_tx_map(adapter, skb, tpd)) 1856 + if (atl1e_tx_map(adapter, skb, tpd)) { 1857 + dev_kfree_skb_any(skb); 1877 1858 goto out; 1859 + } 1878 1860 1879 1861 atl1e_tx_queue(adapter, tpd_req, tpd); 1880 1862
+1
drivers/net/ethernet/broadcom/Kconfig
··· 131 131 config BGMAC 132 132 tristate "BCMA bus GBit core support" 133 133 depends on BCMA_HOST_SOC && HAS_DMA 134 + select PHYLIB 134 135 ---help--- 135 136 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. 136 137 They can be found on BCM47xx SoCs and provide gigabit ethernet.
+10 -4
drivers/net/ethernet/emulex/benet/be_main.c
··· 782 782 783 783 if (vlan_tx_tag_present(skb)) 784 784 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 785 - else if (qnq_async_evt_rcvd(adapter) && adapter->pvid) 786 - vlan_tag = adapter->pvid; 785 + 786 + if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { 787 + if (!vlan_tag) 788 + vlan_tag = adapter->pvid; 789 + /* f/w workaround to set skip_hw_vlan = 1, informs the F/W to 790 + * skip VLAN insertion 791 + */ 792 + if (skip_hw_vlan) 793 + *skip_hw_vlan = true; 794 + } 787 795 788 796 if (vlan_tag) { 789 797 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 790 798 if (unlikely(!skb)) 791 799 return skb; 792 800 skb->vlan_tci = 0; 793 - if (skip_hw_vlan) 794 - *skip_hw_vlan = true; 795 801 } 796 802 797 803 /* Insert the outer VLAN, if any */
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
··· 156 156 stats = filp->private_data; 157 157 spin_lock(&stats->lock); 158 158 if (stats->n) 159 - field = stats->sum / stats->n; 159 + field = div64_u64(stats->sum, stats->n); 160 160 spin_unlock(&stats->lock); 161 161 ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field); 162 162 if (ret > 0) {
+2 -2
drivers/net/hyperv/netvsc_drv.c
··· 431 431 net->netdev_ops = &device_ops; 432 432 433 433 /* TODO: Add GSO and Checksum offload */ 434 - net->hw_features = NETIF_F_SG; 435 - net->features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX; 434 + net->hw_features = 0; 435 + net->features = NETIF_F_HW_VLAN_CTAG_TX; 436 436 437 437 SET_ETHTOOL_OPS(net, &ethtool_ops); 438 438 SET_NETDEV_DEV(net, &dev->device);
+39 -26
drivers/net/macvtap.c
··· 698 698 return 0; 699 699 } 700 700 701 + static unsigned long iov_pages(const struct iovec *iv, int offset, 702 + unsigned long nr_segs) 703 + { 704 + unsigned long seg, base; 705 + int pages = 0, len, size; 706 + 707 + while (nr_segs && (offset >= iv->iov_len)) { 708 + offset -= iv->iov_len; 709 + ++iv; 710 + --nr_segs; 711 + } 712 + 713 + for (seg = 0; seg < nr_segs; seg++) { 714 + base = (unsigned long)iv[seg].iov_base + offset; 715 + len = iv[seg].iov_len - offset; 716 + size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT; 717 + pages += size; 718 + offset = 0; 719 + } 720 + 721 + return pages; 722 + } 701 723 702 724 /* Get packet from user space buffer */ 703 725 static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, ··· 766 744 if (unlikely(count > UIO_MAXIOV)) 767 745 goto err; 768 746 769 - if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) 770 - zerocopy = true; 771 - 772 - if (zerocopy) { 773 - /* Userspace may produce vectors with count greater than 774 - * MAX_SKB_FRAGS, so we need to linearize parts of the skb 775 - * to let the rest of data to be fit in the frags. 776 - */ 777 - if (count > MAX_SKB_FRAGS) { 778 - copylen = iov_length(iv, count - MAX_SKB_FRAGS); 779 - if (copylen < vnet_hdr_len) 780 - copylen = 0; 781 - else 782 - copylen -= vnet_hdr_len; 783 - } 784 - /* There are 256 bytes to be copied in skb, so there is enough 785 - * room for skb expand head in case it is used. 786 - * The rest buffer is mapped from userspace. 787 - */ 788 - if (copylen < vnet_hdr.hdr_len) 789 - copylen = vnet_hdr.hdr_len; 790 - if (!copylen) 791 - copylen = GOODCOPY_LEN; 747 + if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) { 748 + copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN; 792 749 linear = copylen; 793 - } else { 750 + if (iov_pages(iv, vnet_hdr_len + copylen, count) 751 + <= MAX_SKB_FRAGS) 752 + zerocopy = true; 753 + } 754 + 755 + if (!zerocopy) { 794 756 copylen = len; 795 757 linear = vnet_hdr.hdr_len; 796 758 } ··· 786 780 787 781 if (zerocopy) 788 782 err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count); 789 - else 783 + else { 790 784 err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len, 791 785 len); 786 + if (!err && m && m->msg_control) { 787 + struct ubuf_info *uarg = m->msg_control; 788 + uarg->callback(uarg, false); 789 + } 790 + } 791 + 792 792 if (err) 793 793 goto err_kfree; 794 794 ··· 885 873 __be16 h_vlan_proto; 886 874 __be16 h_vlan_TCI; 887 875 } veth; 888 - veth.h_vlan_proto = htons(ETH_P_8021Q); 876 + veth.h_vlan_proto = skb->vlan_proto; 889 877 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); 890 878 891 879 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); ··· 1119 1107 rtnl_lock(); 1120 1108 ret = macvtap_ioctl_set_queue(file, u); 1121 1109 rtnl_unlock(); 1110 + return ret; 1122 1111 1123 1112 case TUNGETFEATURES: 1124 1113 if (put_user(IFF_TAP | IFF_NO_PI | IFF_VNET_HDR |
+38 -24
drivers/net/tun.c
··· 1035 1035 return 0; 1036 1036 } 1037 1037 1038 + static unsigned long iov_pages(const struct iovec *iv, int offset, 1039 + unsigned long nr_segs) 1040 + { 1041 + unsigned long seg, base; 1042 + int pages = 0, len, size; 1043 + 1044 + while (nr_segs && (offset >= iv->iov_len)) { 1045 + offset -= iv->iov_len; 1046 + ++iv; 1047 + --nr_segs; 1048 + } 1049 + 1050 + for (seg = 0; seg < nr_segs; seg++) { 1051 + base = (unsigned long)iv[seg].iov_base + offset; 1052 + len = iv[seg].iov_len - offset; 1053 + size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT; 1054 + pages += size; 1055 + offset = 0; 1056 + } 1057 + 1058 + return pages; 1059 + } 1060 + 1038 1061 /* Get packet from user space buffer */ 1039 1062 static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, 1040 1063 void *msg_control, const struct iovec *iv, ··· 1105 1082 return -EINVAL; 1106 1083 } 1107 1084 1108 - if (msg_control) 1109 - zerocopy = true; 1110 - 1111 - if (zerocopy) { 1112 - /* Userspace may produce vectors with count greater than 1113 - * MAX_SKB_FRAGS, so we need to linearize parts of the skb 1114 - * to let the rest of data to be fit in the frags. 1115 - */ 1116 - if (count > MAX_SKB_FRAGS) { 1117 - copylen = iov_length(iv, count - MAX_SKB_FRAGS); 1118 - if (copylen < offset) 1119 - copylen = 0; 1120 - else 1121 - copylen -= offset; 1122 - } else 1123 - copylen = 0; 1124 - /* There are 256 bytes to be copied in skb, so there is enough 1125 - * room for skb expand head in case it is used. 1085 + if (msg_control) { 1086 + /* There are 256 bytes to be copied in skb, so there is 1087 + * enough room for skb expand head in case it is used. 1126 1088 * The rest of the buffer is mapped from userspace. 1127 1089 */ 1128 - if (copylen < gso.hdr_len) 1129 - copylen = gso.hdr_len; 1130 - if (!copylen) 1131 - copylen = GOODCOPY_LEN; 1090 + copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; 1132 1091 linear = copylen; 1133 - } else { 1092 + if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) 1093 + zerocopy = true; 1094 + } 1095 + 1096 + if (!zerocopy) { 1134 1097 copylen = len; 1135 1098 linear = gso.hdr_len; 1136 1099 } ··· 1130 1121 1131 1122 if (zerocopy) 1132 1123 err = zerocopy_sg_from_iovec(skb, iv, offset, count); 1133 - else 1124 + else { 1134 1125 err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); 1126 + if (!err && msg_control) { 1127 + struct ubuf_info *uarg = msg_control; 1128 + uarg->callback(uarg, false); 1129 + } 1130 + } 1135 1131 1136 1132 if (err) { 1137 1133 tun->dev->stats.rx_dropped++;
+6
drivers/net/vxlan.c
··· 1767 1767 1768 1768 static void vxlan_dellink(struct net_device *dev, struct list_head *head) 1769 1769 { 1770 + struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 1770 1771 struct vxlan_dev *vxlan = netdev_priv(dev); 1771 1772 1773 + flush_workqueue(vxlan_wq); 1774 + 1775 + spin_lock(&vn->sock_lock); 1772 1776 hlist_del_rcu(&vxlan->hlist); 1777 + spin_unlock(&vn->sock_lock); 1778 + 1773 1779 list_del(&vxlan->next); 1774 1780 unregister_netdevice_queue(dev, head); 1775 1781 }
+13 -18
drivers/net/xen-netfront.c
··· 286 286 break; 287 287 } 288 288 289 - __skb_fill_page_desc(skb, 0, page, 0, 0); 290 - skb_shinfo(skb)->nr_frags = 1; 289 + skb_add_rx_frag(skb, 0, page, 0, 0, PAGE_SIZE); 291 290 __skb_queue_tail(&np->rx_batch, skb); 292 291 } 293 292 ··· 830 831 struct sk_buff_head *list) 831 832 { 832 833 struct skb_shared_info *shinfo = skb_shinfo(skb); 833 - int nr_frags = shinfo->nr_frags; 834 834 RING_IDX cons = np->rx.rsp_cons; 835 835 struct sk_buff *nskb; 836 836 ··· 838 840 RING_GET_RESPONSE(&np->rx, ++cons); 839 841 skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0]; 840 842 841 - __skb_fill_page_desc(skb, nr_frags, 842 - skb_frag_page(nfrag), 843 - rx->offset, rx->status); 843 + if (shinfo->nr_frags == MAX_SKB_FRAGS) { 844 + unsigned int pull_to = NETFRONT_SKB_CB(skb)->pull_to; 844 845 845 - skb->data_len += rx->status; 846 + BUG_ON(pull_to <= skb_headlen(skb)); 847 + __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); 848 + } 849 + BUG_ON(shinfo->nr_frags >= MAX_SKB_FRAGS); 850 + 851 + skb_add_rx_frag(skb, shinfo->nr_frags, skb_frag_page(nfrag), 852 + rx->offset, rx->status, PAGE_SIZE); 846 853 847 854 skb_shinfo(nskb)->nr_frags = 0; 848 855 kfree_skb(nskb); 849 - 850 - nr_frags++; 851 856 } 852 857 853 - shinfo->nr_frags = nr_frags; 854 858 return cons; 855 859 } 856 860 ··· 933 933 while ((skb = __skb_dequeue(rxq)) != NULL) { 934 934 int pull_to = NETFRONT_SKB_CB(skb)->pull_to; 935 935 936 - __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); 936 + if (pull_to > skb_headlen(skb)) 937 + __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); 937 938 938 939 /* Ethernet work: Delayed to here as it peeks the header. */ 939 940 skb->protocol = eth_type_trans(skb, dev); ··· 1020 1019 skb_shinfo(skb)->frags[0].page_offset = rx->offset; 1021 1020 skb_frag_size_set(&skb_shinfo(skb)->frags[0], rx->status); 1022 1021 skb->data_len = rx->status; 1022 + skb->len += rx->status; 1023 1023 1024 1024 i = xennet_fill_frags(np, skb, &tmpq); 1025 - 1026 - /* 1027 - * Truesize is the actual allocation size, even if the 1028 - * allocation is only partially used. 1029 - */ 1030 - skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; 1031 - skb->len += skb->data_len; 1032 1025 1033 1026 if (rx->flags & XEN_NETRXF_csum_blank) 1034 1027 skb->ip_summed = CHECKSUM_PARTIAL;
+1 -2
include/linux/if_vlan.h
··· 79 79 } 80 80 81 81 #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 82 - #define vlan_tx_nonzero_tag_present(__skb) \ 83 - (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK)) 84 82 #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 83 + #define vlan_tx_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK) 85 84 86 85 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 87 86
+1 -1
net/8021q/vlan_core.c
··· 9 9 { 10 10 struct sk_buff *skb = *skbp; 11 11 __be16 vlan_proto = skb->vlan_proto; 12 - u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK; 12 + u16 vlan_id = vlan_tx_tag_get_id(skb); 13 13 struct net_device *vlan_dev; 14 14 struct vlan_pcpu_stats *rx_stats; 15 15
+7
net/8021q/vlan_dev.c
··· 73 73 { 74 74 struct vlan_priority_tci_mapping *mp; 75 75 76 + smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */ 77 + 76 78 mp = vlan_dev_priv(dev)->egress_priority_map[(skb->priority & 0xF)]; 77 79 while (mp) { 78 80 if (mp->priority == skb->priority) { ··· 251 249 np->next = mp; 252 250 np->priority = skb_prio; 253 251 np->vlan_qos = vlan_qos; 252 + /* Before inserting this element in hash table, make sure all its fields 253 + * are committed to memory. 254 + * coupled with smp_rmb() in vlan_dev_get_egress_qos_mask() 255 + */ 256 + smp_wmb(); 254 257 vlan->egress_priority_map[skb_prio & 0xF] = np; 255 258 if (vlan_qos) 256 259 vlan->nr_egress_mappings++;
+9 -2
net/core/dev.c
··· 3580 3580 } 3581 3581 } 3582 3582 3583 - if (vlan_tx_nonzero_tag_present(skb)) 3584 - skb->pkt_type = PACKET_OTHERHOST; 3583 + if (unlikely(vlan_tx_tag_present(skb))) { 3584 + if (vlan_tx_tag_get_id(skb)) 3585 + skb->pkt_type = PACKET_OTHERHOST; 3586 + /* Note: we might in the future use prio bits 3587 + * and set skb->priority like in vlan_do_receive() 3588 + * For the time being, just ignore Priority Code Point 3589 + */ 3590 + skb->vlan_tci = 0; 3591 + } 3585 3592 3586 3593 /* deliver only exact match when indicated */ 3587 3594 null_or_dev = deliver_exact ? skb->dev : NULL;
+20 -10
net/core/ethtool.c
··· 279 279 { 280 280 u32 flags = 0; 281 281 282 - if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO; 283 - if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) flags |= ETH_FLAG_RXVLAN; 284 - if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) flags |= ETH_FLAG_TXVLAN; 285 - if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE; 286 - if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH; 282 + if (dev->features & NETIF_F_LRO) 283 + flags |= ETH_FLAG_LRO; 284 + if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) 285 + flags |= ETH_FLAG_RXVLAN; 286 + if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) 287 + flags |= ETH_FLAG_TXVLAN; 288 + if (dev->features & NETIF_F_NTUPLE) 289 + flags |= ETH_FLAG_NTUPLE; 290 + if (dev->features & NETIF_F_RXHASH) 291 + flags |= ETH_FLAG_RXHASH; 287 292 288 293 return flags; 289 294 } ··· 300 295 if (data & ~ETH_ALL_FLAGS) 301 296 return -EINVAL; 302 297 303 - if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO; 304 - if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_CTAG_RX; 305 - if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_CTAG_TX; 306 - if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE; 307 - if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH; 298 + if (data & ETH_FLAG_LRO) 299 + features |= NETIF_F_LRO; 300 + if (data & ETH_FLAG_RXVLAN) 301 + features |= NETIF_F_HW_VLAN_CTAG_RX; 302 + if (data & ETH_FLAG_TXVLAN) 303 + features |= NETIF_F_HW_VLAN_CTAG_TX; 304 + if (data & ETH_FLAG_NTUPLE) 305 + features |= NETIF_F_NTUPLE; 306 + if (data & ETH_FLAG_RXHASH) 307 + features |= NETIF_F_RXHASH; 308 308 309 309 /* allow changing only bits set in hw_features */ 310 310 changed = (features ^ dev->features) & ETH_ALL_FEATURES;
+1 -20
net/ethernet/eth.c
··· 401 401 } 402 402 EXPORT_SYMBOL(alloc_etherdev_mqs); 403 403 404 - static size_t _format_mac_addr(char *buf, int buflen, 405 - const unsigned char *addr, int len) 406 - { 407 - int i; 408 - char *cp = buf; 409 - 410 - for (i = 0; i < len; i++) { 411 - cp += scnprintf(cp, buflen - (cp - buf), "%02x", addr[i]); 412 - if (i == len - 1) 413 - break; 414 - cp += scnprintf(cp, buflen - (cp - buf), ":"); 415 - } 416 - return cp - buf; 417 - } 418 - 419 404 ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len) 420 405 { 421 - size_t l; 422 - 423 - l = _format_mac_addr(buf, PAGE_SIZE, addr, len); 424 - l += scnprintf(buf + l, PAGE_SIZE - l, "\n"); 425 - return (ssize_t)l; 406 + return scnprintf(buf, PAGE_SIZE, "%*phC\n", len, addr); 426 407 } 427 408 EXPORT_SYMBOL(sysfs_format_mac);
+3 -4
net/ipv4/ip_input.c
··· 190 190 { 191 191 struct net *net = dev_net(skb->dev); 192 192 193 - __skb_pull(skb, ip_hdrlen(skb)); 194 - 195 - /* Point into the IP datagram, just past the header. */ 196 - skb_reset_transport_header(skb); 193 + __skb_pull(skb, skb_network_header_len(skb)); 197 194 198 195 rcu_read_lock(); 199 196 { ··· 433 436 IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_INDISCARDS); 434 437 goto drop; 435 438 } 439 + 440 + skb->transport_header = skb->network_header + iph->ihl*4; 436 441 437 442 /* Remove any debris in the socket control block */ 438 443 memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
+3 -3
net/ipv6/ndisc.c
··· 479 479 if (ifp) { 480 480 src_addr = solicited_addr; 481 481 if (ifp->flags & IFA_F_OPTIMISTIC) 482 - override = 0; 482 + override = false; 483 483 inc_opt |= ifp->idev->cnf.force_tllao; 484 484 in6_ifa_put(ifp); 485 485 } else { ··· 557 557 } 558 558 559 559 if (ipv6_addr_any(saddr)) 560 - inc_opt = 0; 560 + inc_opt = false; 561 561 if (inc_opt) 562 562 optlen += ndisc_opt_addr_space(dev); 563 563 ··· 790 790 (is_router = pndisc_is_router(&msg->target, dev)) >= 0)) { 791 791 if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && 792 792 skb->pkt_type != PACKET_HOST && 793 - inc != 0 && 793 + inc && 794 794 idev->nd_parms->proxy_delay != 0) { 795 795 /* 796 796 * for anycast or proxy,
+14 -17
net/irda/irlan/irlan_eth.c
··· 44 44 static int irlan_eth_close(struct net_device *dev); 45 45 static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, 46 46 struct net_device *dev); 47 - static void irlan_eth_set_multicast_list( struct net_device *dev); 47 + static void irlan_eth_set_multicast_list(struct net_device *dev); 48 48 49 49 static const struct net_device_ops irlan_eth_netdev_ops = { 50 - .ndo_open = irlan_eth_open, 51 - .ndo_stop = irlan_eth_close, 52 - .ndo_start_xmit = irlan_eth_xmit, 50 + .ndo_open = irlan_eth_open, 51 + .ndo_stop = irlan_eth_close, 52 + .ndo_start_xmit = irlan_eth_xmit, 53 53 .ndo_set_rx_mode = irlan_eth_set_multicast_list, 54 54 .ndo_change_mtu = eth_change_mtu, 55 55 .ndo_validate_addr = eth_validate_addr, ··· 110 110 { 111 111 struct irlan_cb *self = netdev_priv(dev); 112 112 113 - IRDA_DEBUG(2, "%s()\n", __func__ ); 113 + IRDA_DEBUG(2, "%s()\n", __func__); 114 114 115 115 /* Ready to play! */ 116 116 netif_stop_queue(dev); /* Wait until data link is ready */ ··· 137 137 { 138 138 struct irlan_cb *self = netdev_priv(dev); 139 139 140 - IRDA_DEBUG(2, "%s()\n", __func__ ); 140 + IRDA_DEBUG(2, "%s()\n", __func__); 141 141 142 142 /* Stop device */ 143 143 netif_stop_queue(dev); ··· 310 310 { 311 311 struct irlan_cb *self = netdev_priv(dev); 312 312 313 - IRDA_DEBUG(2, "%s()\n", __func__ ); 313 + IRDA_DEBUG(2, "%s()\n", __func__); 314 314 315 315 /* Check if data channel has been connected yet */ 316 316 if (self->client.state != IRLAN_DATA) { 317 - IRDA_DEBUG(1, "%s(), delaying!\n", __func__ ); 317 + IRDA_DEBUG(1, "%s(), delaying!\n", __func__); 318 318 return; 319 319 } 320 320 321 321 if (dev->flags & IFF_PROMISC) { 322 322 /* Enable promiscuous mode */ 323 323 IRDA_WARNING("Promiscuous mode not implemented by IrLAN!\n"); 324 - } 325 - else if ((dev->flags & IFF_ALLMULTI) || 324 + } else if ((dev->flags & IFF_ALLMULTI) || 326 325 netdev_mc_count(dev) > HW_MAX_ADDRS) { 327 326 /* Disable promiscuous mode, use normal mode. */ 328 - IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __func__ ); 327 + IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __func__); 329 328 /* hardware_set_filter(NULL); */ 330 329 331 330 irlan_set_multicast_filter(self, TRUE); 332 - } 333 - else if (!netdev_mc_empty(dev)) { 334 - IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __func__ ); 331 + } else if (!netdev_mc_empty(dev)) { 332 + IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __func__); 335 333 /* Walk the address list, and load the filter */ 336 334 /* hardware_set_filter(dev->mc_list); */ 337 335 338 336 irlan_set_multicast_filter(self, TRUE); 339 - } 340 - else { 341 - IRDA_DEBUG(4, "%s(), Clearing multicast filter\n", __func__ ); 337 + } else { 338 + IRDA_DEBUG(4, "%s(), Clearing multicast filter\n", __func__); 342 339 irlan_set_multicast_filter(self, FALSE); 343 340 } 344 341
+56 -29
net/sched/sch_qfq.c
··· 113 113 114 114 #define FRAC_BITS 30 /* fixed point arithmetic */ 115 115 #define ONE_FP (1UL << FRAC_BITS) 116 - #define IWSUM (ONE_FP/QFQ_MAX_WSUM) 117 116 118 117 #define QFQ_MTU_SHIFT 16 /* to support TSO/GSO */ 119 118 #define QFQ_MIN_LMAX 512 /* see qfq_slot_insert */ ··· 188 189 struct qfq_aggregate *in_serv_agg; /* Aggregate being served. */ 189 190 u32 num_active_agg; /* Num. of active aggregates */ 190 191 u32 wsum; /* weight sum */ 192 + u32 iwsum; /* inverse weight sum */ 191 193 192 194 unsigned long bitmaps[QFQ_MAX_STATE]; /* Group bitmaps. */ 193 195 struct qfq_group groups[QFQ_MAX_INDEX + 1]; /* The groups. */ ··· 314 314 315 315 q->wsum += 316 316 (int) agg->class_weight * (new_num_classes - agg->num_classes); 317 + q->iwsum = ONE_FP / q->wsum; 317 318 318 319 agg->num_classes = new_num_classes; 319 320 } ··· 341 340 { 342 341 if (!hlist_unhashed(&agg->nonfull_next)) 343 342 hlist_del_init(&agg->nonfull_next); 343 + q->wsum -= agg->class_weight; 344 + if (q->wsum != 0) 345 + q->iwsum = ONE_FP / q->wsum; 346 + 344 347 if (q->in_serv_agg == agg) 345 348 q->in_serv_agg = qfq_choose_next_agg(q); 346 349 kfree(agg); ··· 839 834 } 840 835 } 841 836 842 - 843 837 /* 844 - * The index of the slot in which the aggregate is to be inserted must 845 - * not be higher than QFQ_MAX_SLOTS-2. There is a '-2' and not a '-1' 846 - * because the start time of the group may be moved backward by one 847 - * slot after the aggregate has been inserted, and this would cause 848 - * non-empty slots to be right-shifted by one position. 838 + * The index of the slot in which the input aggregate agg is to be 839 + * inserted must not be higher than QFQ_MAX_SLOTS-2. There is a '-2' 840 + * and not a '-1' because the start time of the group may be moved 841 + * backward by one slot after the aggregate has been inserted, and 842 + * this would cause non-empty slots to be right-shifted by one 843 + * position. 849 844 * 850 - * If the weight and lmax (max_pkt_size) of the classes do not change, 851 - * then QFQ+ does meet the above contraint according to the current 852 - * values of its parameters. In fact, if the weight and lmax of the 853 - * classes do not change, then, from the theory, QFQ+ guarantees that 854 - * the slot index is never higher than 855 - * 2 + QFQ_MAX_AGG_CLASSES * ((1<<QFQ_MTU_SHIFT)/QFQ_MIN_LMAX) * 856 - * (QFQ_MAX_WEIGHT/QFQ_MAX_WSUM) = 2 + 8 * 128 * (1 / 64) = 18 845 + * QFQ+ fully satisfies this bound to the slot index if the parameters 846 + * of the classes are not changed dynamically, and if QFQ+ never 847 + * happens to postpone the service of agg unjustly, i.e., it never 848 + * happens that the aggregate becomes backlogged and eligible, or just 849 + * eligible, while an aggregate with a higher approximated finish time 850 + * is being served. In particular, in this case QFQ+ guarantees that 851 + * the timestamps of agg are low enough that the slot index is never 852 + * higher than 2. Unfortunately, QFQ+ cannot provide the same 853 + * guarantee if it happens to unjustly postpone the service of agg, or 854 + * if the parameters of some class are changed. 857 855 * 858 - * When the weight of a class is increased or the lmax of the class is 859 - * decreased, a new aggregate with smaller slot size than the original 860 - * parent aggregate of the class may happen to be activated. The 861 - * activation of this aggregate should be properly delayed to when the 862 - * service of the class has finished in the ideal system tracked by 863 - * QFQ+. If the activation of the aggregate is not delayed to this 864 - * reference time instant, then this aggregate may be unjustly served 865 - * before other aggregates waiting for service. This may cause the 866 - * above bound to the slot index to be violated for some of these 867 - * unlucky aggregates. 856 + * As for the first event, i.e., an out-of-order service, the 857 + * upper bound to the slot index guaranteed by QFQ+ grows to 858 + * 2 + 859 + * QFQ_MAX_AGG_CLASSES * ((1<<QFQ_MTU_SHIFT)/QFQ_MIN_LMAX) * 860 + * (current_max_weight/current_wsum) <= 2 + 8 * 128 * 1. 861 + * 862 + * The following function deals with this problem by backward-shifting 863 + * the timestamps of agg, if needed, so as to guarantee that the slot 864 + * index is never higher than QFQ_MAX_SLOTS-2. This backward-shift may 865 + * cause the service of other aggregates to be postponed, yet the 866 + * worst-case guarantees of these aggregates are not violated. In 867 + * fact, in case of no out-of-order service, the timestamps of agg 868 + * would have been even lower than they are after the backward shift, 869 + * because QFQ+ would have guaranteed a maximum value equal to 2 for 870 + * the slot index, and 2 < QFQ_MAX_SLOTS-2. Hence the aggregates whose 871 + * service is postponed because of the backward-shift would have 872 + * however waited for the service of agg before being served. 873 + * 874 + * The other event that may cause the slot index to be higher than 2 875 + * for agg is a recent change of the parameters of some class. If the 876 + * weight of a class is increased or the lmax (max_pkt_size) of the 877 + * class is decreased, then a new aggregate with smaller slot size 878 + * than the original parent aggregate of the class may happen to be 879 + * activated. The activation of this aggregate should be properly 880 + * delayed to when the service of the class has finished in the ideal 881 + * system tracked by QFQ+. If the activation of the aggregate is not 882 + * delayed to this reference time instant, then this aggregate may be 883 + * unjustly served before other aggregates waiting for service. This 884 + * may cause the above bound to the slot index to be violated for some 885 + * of these unlucky aggregates. 868 886 * 869 887 * Instead of delaying the activation of the new aggregate, which is 870 - * quite complex, the following inaccurate but simple solution is used: 871 - * if the slot index is higher than QFQ_MAX_SLOTS-2, then the 872 - * timestamps of the aggregate are shifted backward so as to let the 873 - * slot index become equal to QFQ_MAX_SLOTS-2. 888 + * quite complex, the above-discussed capping of the slot index is 889 + * used to handle also the consequences of a change of the parameters 890 + * of a class. 874 891 */ 875 892 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_aggregate *agg, 876 893 u64 roundedS) ··· 1163 1136 else 1164 1137 in_serv_agg->budget -= len; 1165 1138 1166 - q->V += (u64)len * IWSUM; 1139 + q->V += (u64)len * q->iwsum; 1167 1140 pr_debug("qfq dequeue: len %u F %lld now %lld\n", 1168 1141 len, (unsigned long long) in_serv_agg->F, 1169 1142 (unsigned long long) q->V);