aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/datagram.c2
-rw-r--r--net/core/dev.c77
-rw-r--r--net/core/gen_estimator.c2
-rw-r--r--net/core/gen_stats.c2
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c34
6 files changed, 94 insertions, 27 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 488dd1a825c0..fdbc9a81d4c2 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -775,7 +775,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
775EXPORT_SYMBOL(__skb_checksum_complete); 775EXPORT_SYMBOL(__skb_checksum_complete);
776 776
777/** 777/**
778 * skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec. 778 * skb_copy_and_csum_datagram_iovec - Copy and checksum skb to user iovec.
779 * @skb: skbuff 779 * @skb: skbuff
780 * @hlen: hardware length 780 * @hlen: hardware length
781 * @iov: io vector 781 * @iov: io vector
diff --git a/net/core/dev.c b/net/core/dev.c
index b65a5051361f..ab9a16530c36 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2587,13 +2587,19 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2587 return harmonize_features(skb, features); 2587 return harmonize_features(skb, features);
2588 } 2588 }
2589 2589
2590 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | 2590 features = netdev_intersect_features(features,
2591 NETIF_F_HW_VLAN_STAG_TX); 2591 skb->dev->vlan_features |
2592 NETIF_F_HW_VLAN_CTAG_TX |
2593 NETIF_F_HW_VLAN_STAG_TX);
2592 2594
2593 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) 2595 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD))
2594 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | 2596 features = netdev_intersect_features(features,
2595 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | 2597 NETIF_F_SG |
2596 NETIF_F_HW_VLAN_STAG_TX; 2598 NETIF_F_HIGHDMA |
2599 NETIF_F_FRAGLIST |
2600 NETIF_F_GEN_CSUM |
2601 NETIF_F_HW_VLAN_CTAG_TX |
2602 NETIF_F_HW_VLAN_STAG_TX);
2597 2603
2598 return harmonize_features(skb, features); 2604 return harmonize_features(skb, features);
2599} 2605}
@@ -4889,7 +4895,8 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
4889 if (adj->master) 4895 if (adj->master)
4890 sysfs_remove_link(&(dev->dev.kobj), "master"); 4896 sysfs_remove_link(&(dev->dev.kobj), "master");
4891 4897
4892 if (netdev_adjacent_is_neigh_list(dev, dev_list)) 4898 if (netdev_adjacent_is_neigh_list(dev, dev_list) &&
4899 net_eq(dev_net(dev),dev_net(adj_dev)))
4893 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); 4900 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
4894 4901
4895 list_del_rcu(&adj->list); 4902 list_del_rcu(&adj->list);
@@ -5159,11 +5166,65 @@ void netdev_upper_dev_unlink(struct net_device *dev,
5159} 5166}
5160EXPORT_SYMBOL(netdev_upper_dev_unlink); 5167EXPORT_SYMBOL(netdev_upper_dev_unlink);
5161 5168
5169void netdev_adjacent_add_links(struct net_device *dev)
5170{
5171 struct netdev_adjacent *iter;
5172
5173 struct net *net = dev_net(dev);
5174
5175 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5176 if (!net_eq(net,dev_net(iter->dev)))
5177 continue;
5178 netdev_adjacent_sysfs_add(iter->dev, dev,
5179 &iter->dev->adj_list.lower);
5180 netdev_adjacent_sysfs_add(dev, iter->dev,
5181 &dev->adj_list.upper);
5182 }
5183
5184 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5185 if (!net_eq(net,dev_net(iter->dev)))
5186 continue;
5187 netdev_adjacent_sysfs_add(iter->dev, dev,
5188 &iter->dev->adj_list.upper);
5189 netdev_adjacent_sysfs_add(dev, iter->dev,
5190 &dev->adj_list.lower);
5191 }
5192}
5193
5194void netdev_adjacent_del_links(struct net_device *dev)
5195{
5196 struct netdev_adjacent *iter;
5197
5198 struct net *net = dev_net(dev);
5199
5200 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5201 if (!net_eq(net,dev_net(iter->dev)))
5202 continue;
5203 netdev_adjacent_sysfs_del(iter->dev, dev->name,
5204 &iter->dev->adj_list.lower);
5205 netdev_adjacent_sysfs_del(dev, iter->dev->name,
5206 &dev->adj_list.upper);
5207 }
5208
5209 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5210 if (!net_eq(net,dev_net(iter->dev)))
5211 continue;
5212 netdev_adjacent_sysfs_del(iter->dev, dev->name,
5213 &iter->dev->adj_list.upper);
5214 netdev_adjacent_sysfs_del(dev, iter->dev->name,
5215 &dev->adj_list.lower);
5216 }
5217}
5218
5162void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) 5219void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
5163{ 5220{
5164 struct netdev_adjacent *iter; 5221 struct netdev_adjacent *iter;
5165 5222
5223 struct net *net = dev_net(dev);
5224
5166 list_for_each_entry(iter, &dev->adj_list.upper, list) { 5225 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5226 if (!net_eq(net,dev_net(iter->dev)))
5227 continue;
5167 netdev_adjacent_sysfs_del(iter->dev, oldname, 5228 netdev_adjacent_sysfs_del(iter->dev, oldname,
5168 &iter->dev->adj_list.lower); 5229 &iter->dev->adj_list.lower);
5169 netdev_adjacent_sysfs_add(iter->dev, dev, 5230 netdev_adjacent_sysfs_add(iter->dev, dev,
@@ -5171,6 +5232,8 @@ void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
5171 } 5232 }
5172 5233
5173 list_for_each_entry(iter, &dev->adj_list.lower, list) { 5234 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5235 if (!net_eq(net,dev_net(iter->dev)))
5236 continue;
5174 netdev_adjacent_sysfs_del(iter->dev, oldname, 5237 netdev_adjacent_sysfs_del(iter->dev, oldname,
5175 &iter->dev->adj_list.upper); 5238 &iter->dev->adj_list.upper);
5176 netdev_adjacent_sysfs_add(iter->dev, dev, 5239 netdev_adjacent_sysfs_add(iter->dev, dev,
@@ -6773,6 +6836,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
6773 6836
6774 /* Send a netdev-removed uevent to the old namespace */ 6837 /* Send a netdev-removed uevent to the old namespace */
6775 kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); 6838 kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
6839 netdev_adjacent_del_links(dev);
6776 6840
6777 /* Actually switch the network namespace */ 6841 /* Actually switch the network namespace */
6778 dev_net_set(dev, net); 6842 dev_net_set(dev, net);
@@ -6787,6 +6851,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
6787 6851
6788 /* Send a netdev-add uevent to the new namespace */ 6852 /* Send a netdev-add uevent to the new namespace */
6789 kobject_uevent(&dev->dev.kobj, KOBJ_ADD); 6853 kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
6854 netdev_adjacent_add_links(dev);
6790 6855
6791 /* Fixup kobjects */ 6856 /* Fixup kobjects */
6792 err = device_rename(&dev->dev, dev->name); 6857 err = device_rename(&dev->dev, dev->name);
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 6b5b6e7013ca..9d33dfffca19 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -197,7 +197,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats
197 * as destination. A new timer with the interval specified in the 197 * as destination. A new timer with the interval specified in the
198 * configuration TLV is created. Upon each interval, the latest statistics 198 * configuration TLV is created. Upon each interval, the latest statistics
199 * will be read from &bstats and the estimated rate will be stored in 199 * will be read from &bstats and the estimated rate will be stored in
200 * &rate_est with the statistics lock grabed during this period. 200 * &rate_est with the statistics lock grabbed during this period.
201 * 201 *
202 * Returns 0 on success or a negative error code. 202 * Returns 0 on success or a negative error code.
203 * 203 *
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 9d3d9e78397b..2ddbce4cce14 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -206,7 +206,7 @@ EXPORT_SYMBOL(gnet_stats_copy_queue);
206 * @st: application specific statistics data 206 * @st: application specific statistics data
207 * @len: length of data 207 * @len: length of data
208 * 208 *
209 * Appends the application sepecific statistics to the top level TLV created by 209 * Appends the application specific statistics to the top level TLV created by
210 * gnet_stats_start_copy() and remembers the data for XSTATS if the dumping 210 * gnet_stats_start_copy() and remembers the data for XSTATS if the dumping
211 * handle is in backward compatibility mode. 211 * handle is in backward compatibility mode.
212 * 212 *
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 163b673f9e62..da1378a3e2c7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2647,7 +2647,7 @@ EXPORT_SYMBOL(skb_prepare_seq_read);
2647 * skb_seq_read() will return the remaining part of the block. 2647 * skb_seq_read() will return the remaining part of the block.
2648 * 2648 *
2649 * Note 1: The size of each block of data returned can be arbitrary, 2649 * Note 1: The size of each block of data returned can be arbitrary,
2650 * this limitation is the cost for zerocopy seqeuental 2650 * this limitation is the cost for zerocopy sequential
2651 * reads of potentially non linear data. 2651 * reads of potentially non linear data.
2652 * 2652 *
2653 * Note 2: Fragment lists within fragments are not implemented 2653 * Note 2: Fragment lists within fragments are not implemented
@@ -2781,7 +2781,7 @@ EXPORT_SYMBOL(skb_find_text);
2781/** 2781/**
2782 * skb_append_datato_frags - append the user data to a skb 2782 * skb_append_datato_frags - append the user data to a skb
2783 * @sk: sock structure 2783 * @sk: sock structure
2784 * @skb: skb structure to be appened with user data. 2784 * @skb: skb structure to be appended with user data.
2785 * @getfrag: call back function to be used for getting the user data 2785 * @getfrag: call back function to be used for getting the user data
2786 * @from: pointer to user message iov 2786 * @from: pointer to user message iov
2787 * @length: length of the iov message 2787 * @length: length of the iov message
diff --git a/net/core/sock.c b/net/core/sock.c
index 2714811afbd8..d372b4bd3f99 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(sk_ns_capable);
166/** 166/**
167 * sk_capable - Socket global capability test 167 * sk_capable - Socket global capability test
168 * @sk: Socket to use a capability on or through 168 * @sk: Socket to use a capability on or through
169 * @cap: The global capbility to use 169 * @cap: The global capability to use
170 * 170 *
171 * Test to see if the opener of the socket had when the socket was 171 * Test to see if the opener of the socket had when the socket was
172 * created and the current process has the capability @cap in all user 172 * created and the current process has the capability @cap in all user
@@ -183,7 +183,7 @@ EXPORT_SYMBOL(sk_capable);
183 * @sk: Socket to use a capability on or through 183 * @sk: Socket to use a capability on or through
184 * @cap: The capability to use 184 * @cap: The capability to use
185 * 185 *
186 * Test to see if the opener of the socket had when the socke was created 186 * Test to see if the opener of the socket had when the socket was created
187 * and the current process has the capability @cap over the network namespace 187 * and the current process has the capability @cap over the network namespace
188 * the socket is a member of. 188 * the socket is a member of.
189 */ 189 */
@@ -1822,6 +1822,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1822 order); 1822 order);
1823 if (page) 1823 if (page)
1824 goto fill_page; 1824 goto fill_page;
1825 /* Do not retry other high order allocations */
1826 order = 1;
1827 max_page_order = 0;
1825 } 1828 }
1826 order--; 1829 order--;
1827 } 1830 }
@@ -1869,10 +1872,8 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
1869 * no guarantee that allocations succeed. Therefore, @sz MUST be 1872 * no guarantee that allocations succeed. Therefore, @sz MUST be
1870 * less or equal than PAGE_SIZE. 1873 * less or equal than PAGE_SIZE.
1871 */ 1874 */
1872bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) 1875bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp)
1873{ 1876{
1874 int order;
1875
1876 if (pfrag->page) { 1877 if (pfrag->page) {
1877 if (atomic_read(&pfrag->page->_count) == 1) { 1878 if (atomic_read(&pfrag->page->_count) == 1) {
1878 pfrag->offset = 0; 1879 pfrag->offset = 0;
@@ -1883,20 +1884,21 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio)
1883 put_page(pfrag->page); 1884 put_page(pfrag->page);
1884 } 1885 }
1885 1886
1886 order = SKB_FRAG_PAGE_ORDER; 1887 pfrag->offset = 0;
1887 do { 1888 if (SKB_FRAG_PAGE_ORDER) {
1888 gfp_t gfp = prio; 1889 pfrag->page = alloc_pages(gfp | __GFP_COMP |
1889 1890 __GFP_NOWARN | __GFP_NORETRY,
1890 if (order) 1891 SKB_FRAG_PAGE_ORDER);
1891 gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
1892 pfrag->page = alloc_pages(gfp, order);
1893 if (likely(pfrag->page)) { 1892 if (likely(pfrag->page)) {
1894 pfrag->offset = 0; 1893 pfrag->size = PAGE_SIZE << SKB_FRAG_PAGE_ORDER;
1895 pfrag->size = PAGE_SIZE << order;
1896 return true; 1894 return true;
1897 } 1895 }
1898 } while (--order >= 0); 1896 }
1899 1897 pfrag->page = alloc_page(gfp);
1898 if (likely(pfrag->page)) {
1899 pfrag->size = PAGE_SIZE;
1900 return true;
1901 }
1900 return false; 1902 return false;
1901} 1903}
1902EXPORT_SYMBOL(skb_page_frag_refill); 1904EXPORT_SYMBOL(skb_page_frag_refill);