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.c91
-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.c36
6 files changed, 104 insertions, 33 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..cf8a95f48cff 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}
@@ -4803,9 +4809,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev,
4803 sysfs_remove_link(&(dev->dev.kobj), linkname); 4809 sysfs_remove_link(&(dev->dev.kobj), linkname);
4804} 4810}
4805 4811
4806#define netdev_adjacent_is_neigh_list(dev, dev_list) \ 4812static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev,
4807 (dev_list == &dev->adj_list.upper || \ 4813 struct net_device *adj_dev,
4808 dev_list == &dev->adj_list.lower) 4814 struct list_head *dev_list)
4815{
4816 return (dev_list == &dev->adj_list.upper ||
4817 dev_list == &dev->adj_list.lower) &&
4818 net_eq(dev_net(dev), dev_net(adj_dev));
4819}
4809 4820
4810static int __netdev_adjacent_dev_insert(struct net_device *dev, 4821static int __netdev_adjacent_dev_insert(struct net_device *dev,
4811 struct net_device *adj_dev, 4822 struct net_device *adj_dev,
@@ -4835,7 +4846,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
4835 pr_debug("dev_hold for %s, because of link added from %s to %s\n", 4846 pr_debug("dev_hold for %s, because of link added from %s to %s\n",
4836 adj_dev->name, dev->name, adj_dev->name); 4847 adj_dev->name, dev->name, adj_dev->name);
4837 4848
4838 if (netdev_adjacent_is_neigh_list(dev, dev_list)) { 4849 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) {
4839 ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); 4850 ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list);
4840 if (ret) 4851 if (ret)
4841 goto free_adj; 4852 goto free_adj;
@@ -4856,7 +4867,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
4856 return 0; 4867 return 0;
4857 4868
4858remove_symlinks: 4869remove_symlinks:
4859 if (netdev_adjacent_is_neigh_list(dev, dev_list)) 4870 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
4860 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); 4871 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
4861free_adj: 4872free_adj:
4862 kfree(adj); 4873 kfree(adj);
@@ -4889,7 +4900,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
4889 if (adj->master) 4900 if (adj->master)
4890 sysfs_remove_link(&(dev->dev.kobj), "master"); 4901 sysfs_remove_link(&(dev->dev.kobj), "master");
4891 4902
4892 if (netdev_adjacent_is_neigh_list(dev, dev_list)) 4903 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
4893 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); 4904 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
4894 4905
4895 list_del_rcu(&adj->list); 4906 list_del_rcu(&adj->list);
@@ -5159,11 +5170,65 @@ void netdev_upper_dev_unlink(struct net_device *dev,
5159} 5170}
5160EXPORT_SYMBOL(netdev_upper_dev_unlink); 5171EXPORT_SYMBOL(netdev_upper_dev_unlink);
5161 5172
5173void netdev_adjacent_add_links(struct net_device *dev)
5174{
5175 struct netdev_adjacent *iter;
5176
5177 struct net *net = dev_net(dev);
5178
5179 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5180 if (!net_eq(net,dev_net(iter->dev)))
5181 continue;
5182 netdev_adjacent_sysfs_add(iter->dev, dev,
5183 &iter->dev->adj_list.lower);
5184 netdev_adjacent_sysfs_add(dev, iter->dev,
5185 &dev->adj_list.upper);
5186 }
5187
5188 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5189 if (!net_eq(net,dev_net(iter->dev)))
5190 continue;
5191 netdev_adjacent_sysfs_add(iter->dev, dev,
5192 &iter->dev->adj_list.upper);
5193 netdev_adjacent_sysfs_add(dev, iter->dev,
5194 &dev->adj_list.lower);
5195 }
5196}
5197
5198void netdev_adjacent_del_links(struct net_device *dev)
5199{
5200 struct netdev_adjacent *iter;
5201
5202 struct net *net = dev_net(dev);
5203
5204 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5205 if (!net_eq(net,dev_net(iter->dev)))
5206 continue;
5207 netdev_adjacent_sysfs_del(iter->dev, dev->name,
5208 &iter->dev->adj_list.lower);
5209 netdev_adjacent_sysfs_del(dev, iter->dev->name,
5210 &dev->adj_list.upper);
5211 }
5212
5213 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5214 if (!net_eq(net,dev_net(iter->dev)))
5215 continue;
5216 netdev_adjacent_sysfs_del(iter->dev, dev->name,
5217 &iter->dev->adj_list.upper);
5218 netdev_adjacent_sysfs_del(dev, iter->dev->name,
5219 &dev->adj_list.lower);
5220 }
5221}
5222
5162void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) 5223void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
5163{ 5224{
5164 struct netdev_adjacent *iter; 5225 struct netdev_adjacent *iter;
5165 5226
5227 struct net *net = dev_net(dev);
5228
5166 list_for_each_entry(iter, &dev->adj_list.upper, list) { 5229 list_for_each_entry(iter, &dev->adj_list.upper, list) {
5230 if (!net_eq(net,dev_net(iter->dev)))
5231 continue;
5167 netdev_adjacent_sysfs_del(iter->dev, oldname, 5232 netdev_adjacent_sysfs_del(iter->dev, oldname,
5168 &iter->dev->adj_list.lower); 5233 &iter->dev->adj_list.lower);
5169 netdev_adjacent_sysfs_add(iter->dev, dev, 5234 netdev_adjacent_sysfs_add(iter->dev, dev,
@@ -5171,6 +5236,8 @@ void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
5171 } 5236 }
5172 5237
5173 list_for_each_entry(iter, &dev->adj_list.lower, list) { 5238 list_for_each_entry(iter, &dev->adj_list.lower, list) {
5239 if (!net_eq(net,dev_net(iter->dev)))
5240 continue;
5174 netdev_adjacent_sysfs_del(iter->dev, oldname, 5241 netdev_adjacent_sysfs_del(iter->dev, oldname,
5175 &iter->dev->adj_list.upper); 5242 &iter->dev->adj_list.upper);
5176 netdev_adjacent_sysfs_add(iter->dev, dev, 5243 netdev_adjacent_sysfs_add(iter->dev, dev,
@@ -6773,6 +6840,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
6773 6840
6774 /* Send a netdev-removed uevent to the old namespace */ 6841 /* Send a netdev-removed uevent to the old namespace */
6775 kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); 6842 kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
6843 netdev_adjacent_del_links(dev);
6776 6844
6777 /* Actually switch the network namespace */ 6845 /* Actually switch the network namespace */
6778 dev_net_set(dev, net); 6846 dev_net_set(dev, net);
@@ -6787,6 +6855,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
6787 6855
6788 /* Send a netdev-add uevent to the new namespace */ 6856 /* Send a netdev-add uevent to the new namespace */
6789 kobject_uevent(&dev->dev.kobj, KOBJ_ADD); 6857 kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
6858 netdev_adjacent_add_links(dev);
6790 6859
6791 /* Fixup kobjects */ 6860 /* Fixup kobjects */
6792 err = device_rename(&dev->dev, dev->name); 6861 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..9c3f823e76a9 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 }
@@ -1863,16 +1866,14 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
1863 * skb_page_frag_refill - check that a page_frag contains enough room 1866 * skb_page_frag_refill - check that a page_frag contains enough room
1864 * @sz: minimum size of the fragment we want to get 1867 * @sz: minimum size of the fragment we want to get
1865 * @pfrag: pointer to page_frag 1868 * @pfrag: pointer to page_frag
1866 * @prio: priority for memory allocation 1869 * @gfp: priority for memory allocation
1867 * 1870 *
1868 * Note: While this allocator tries to use high order pages, there is 1871 * Note: While this allocator tries to use high order pages, there is
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);