diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-11-15 10:29:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-16 17:43:10 -0500 |
commit | c8f44affb7244f2ac3e703cab13d55ede27621bb (patch) | |
tree | 62e7aea2916a8d7cab825fe500670c5113854c0f /net | |
parent | a59e2ecb859f2ab03bb2e230709f8039472ad2c3 (diff) |
net: introduce and use netdev_features_t for device features sets
v2: add couple missing conversions in drivers
split unexporting netdev_fix_features()
implemented %pNF
convert sock::sk_route_(no?)caps
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/8021q/vlan_dev.c | 3 | ||||
-rw-r--r-- | net/bridge/br_device.c | 3 | ||||
-rw-r--r-- | net/bridge/br_if.c | 5 | ||||
-rw-r--r-- | net/bridge/br_private.h | 3 | ||||
-rw-r--r-- | net/core/dev.c | 38 | ||||
-rw-r--r-- | net/core/ethtool.c | 9 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 3 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 3 | ||||
-rw-r--r-- | net/ipv4/udp.c | 3 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 3 | ||||
-rw-r--r-- | net/ipv6/udp.c | 3 |
12 files changed, 45 insertions, 33 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 6a4e0cb897b7..2b5fcde1f629 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -591,7 +591,8 @@ static void vlan_dev_uninit(struct net_device *dev) | |||
591 | } | 591 | } |
592 | } | 592 | } |
593 | 593 | ||
594 | static u32 vlan_dev_fix_features(struct net_device *dev, u32 features) | 594 | static netdev_features_t vlan_dev_fix_features(struct net_device *dev, |
595 | netdev_features_t features) | ||
595 | { | 596 | { |
596 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; | 597 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
597 | u32 old_features = features; | 598 | u32 old_features = features; |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index feb77ea7b58e..772bad34794c 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -186,7 +186,8 @@ static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
186 | strcpy(info->bus_info, "N/A"); | 186 | strcpy(info->bus_info, "N/A"); |
187 | } | 187 | } |
188 | 188 | ||
189 | static u32 br_fix_features(struct net_device *dev, u32 features) | 189 | static netdev_features_t br_fix_features(struct net_device *dev, |
190 | netdev_features_t features) | ||
190 | { | 191 | { |
191 | struct net_bridge *br = netdev_priv(dev); | 192 | struct net_bridge *br = netdev_priv(dev); |
192 | 193 | ||
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index f603e5b0b930..0a942fbccc9a 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -296,10 +296,11 @@ int br_min_mtu(const struct net_bridge *br) | |||
296 | /* | 296 | /* |
297 | * Recomputes features using slave's features | 297 | * Recomputes features using slave's features |
298 | */ | 298 | */ |
299 | u32 br_features_recompute(struct net_bridge *br, u32 features) | 299 | netdev_features_t br_features_recompute(struct net_bridge *br, |
300 | netdev_features_t features) | ||
300 | { | 301 | { |
301 | struct net_bridge_port *p; | 302 | struct net_bridge_port *p; |
302 | u32 mask; | 303 | netdev_features_t mask; |
303 | 304 | ||
304 | if (list_empty(&br->port_list)) | 305 | if (list_empty(&br->port_list)) |
305 | return features; | 306 | return features; |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index d7d6fb05411f..4027029aa5e4 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -387,7 +387,8 @@ extern int br_add_if(struct net_bridge *br, | |||
387 | extern int br_del_if(struct net_bridge *br, | 387 | extern int br_del_if(struct net_bridge *br, |
388 | struct net_device *dev); | 388 | struct net_device *dev); |
389 | extern int br_min_mtu(const struct net_bridge *br); | 389 | extern int br_min_mtu(const struct net_bridge *br); |
390 | extern u32 br_features_recompute(struct net_bridge *br, u32 features); | 390 | extern netdev_features_t br_features_recompute(struct net_bridge *br, |
391 | netdev_features_t features); | ||
391 | 392 | ||
392 | /* br_input.c */ | 393 | /* br_input.c */ |
393 | extern int br_handle_frame_finish(struct sk_buff *skb); | 394 | extern int br_handle_frame_finish(struct sk_buff *skb); |
diff --git a/net/core/dev.c b/net/core/dev.c index 185e246d61fd..f1cca59c4638 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1914,7 +1914,8 @@ EXPORT_SYMBOL(skb_checksum_help); | |||
1914 | * It may return NULL if the skb requires no segmentation. This is | 1914 | * It may return NULL if the skb requires no segmentation. This is |
1915 | * only possible when GSO is used for verifying header integrity. | 1915 | * only possible when GSO is used for verifying header integrity. |
1916 | */ | 1916 | */ |
1917 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features) | 1917 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, |
1918 | netdev_features_t features) | ||
1918 | { | 1919 | { |
1919 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 1920 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
1920 | struct packet_type *ptype; | 1921 | struct packet_type *ptype; |
@@ -1944,9 +1945,9 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features) | |||
1944 | if (dev && dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) | 1945 | if (dev && dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) |
1945 | dev->ethtool_ops->get_drvinfo(dev, &info); | 1946 | dev->ethtool_ops->get_drvinfo(dev, &info); |
1946 | 1947 | ||
1947 | WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d ip_summed=%d\n", | 1948 | WARN(1, "%s: caps=(%pNF, %pNF) len=%d data_len=%d ip_summed=%d\n", |
1948 | info.driver, dev ? dev->features : 0L, | 1949 | info.driver, dev ? &dev->features : NULL, |
1949 | skb->sk ? skb->sk->sk_route_caps : 0L, | 1950 | skb->sk ? &skb->sk->sk_route_caps : NULL, |
1950 | skb->len, skb->data_len, skb->ip_summed); | 1951 | skb->len, skb->data_len, skb->ip_summed); |
1951 | 1952 | ||
1952 | if (skb_header_cloned(skb) && | 1953 | if (skb_header_cloned(skb) && |
@@ -2055,7 +2056,7 @@ static void dev_gso_skb_destructor(struct sk_buff *skb) | |||
2055 | * This function segments the given skb and stores the list of segments | 2056 | * This function segments the given skb and stores the list of segments |
2056 | * in skb->next. | 2057 | * in skb->next. |
2057 | */ | 2058 | */ |
2058 | static int dev_gso_segment(struct sk_buff *skb, int features) | 2059 | static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features) |
2059 | { | 2060 | { |
2060 | struct sk_buff *segs; | 2061 | struct sk_buff *segs; |
2061 | 2062 | ||
@@ -2094,7 +2095,7 @@ static inline void skb_orphan_try(struct sk_buff *skb) | |||
2094 | } | 2095 | } |
2095 | } | 2096 | } |
2096 | 2097 | ||
2097 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) | 2098 | static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) |
2098 | { | 2099 | { |
2099 | return ((features & NETIF_F_GEN_CSUM) || | 2100 | return ((features & NETIF_F_GEN_CSUM) || |
2100 | ((features & NETIF_F_V4_CSUM) && | 2101 | ((features & NETIF_F_V4_CSUM) && |
@@ -2105,7 +2106,8 @@ static bool can_checksum_protocol(unsigned long features, __be16 protocol) | |||
2105 | protocol == htons(ETH_P_FCOE))); | 2106 | protocol == htons(ETH_P_FCOE))); |
2106 | } | 2107 | } |
2107 | 2108 | ||
2108 | static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features) | 2109 | static netdev_features_t harmonize_features(struct sk_buff *skb, |
2110 | __be16 protocol, netdev_features_t features) | ||
2109 | { | 2111 | { |
2110 | if (!can_checksum_protocol(features, protocol)) { | 2112 | if (!can_checksum_protocol(features, protocol)) { |
2111 | features &= ~NETIF_F_ALL_CSUM; | 2113 | features &= ~NETIF_F_ALL_CSUM; |
@@ -2117,10 +2119,10 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features | |||
2117 | return features; | 2119 | return features; |
2118 | } | 2120 | } |
2119 | 2121 | ||
2120 | u32 netif_skb_features(struct sk_buff *skb) | 2122 | netdev_features_t netif_skb_features(struct sk_buff *skb) |
2121 | { | 2123 | { |
2122 | __be16 protocol = skb->protocol; | 2124 | __be16 protocol = skb->protocol; |
2123 | u32 features = skb->dev->features; | 2125 | netdev_features_t features = skb->dev->features; |
2124 | 2126 | ||
2125 | if (protocol == htons(ETH_P_8021Q)) { | 2127 | if (protocol == htons(ETH_P_8021Q)) { |
2126 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | 2128 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; |
@@ -2166,7 +2168,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
2166 | unsigned int skb_len; | 2168 | unsigned int skb_len; |
2167 | 2169 | ||
2168 | if (likely(!skb->next)) { | 2170 | if (likely(!skb->next)) { |
2169 | u32 features; | 2171 | netdev_features_t features; |
2170 | 2172 | ||
2171 | /* | 2173 | /* |
2172 | * If device doesn't need skb->dst, release it right now while | 2174 | * If device doesn't need skb->dst, release it right now while |
@@ -5350,7 +5352,8 @@ static void rollback_registered(struct net_device *dev) | |||
5350 | list_del(&single); | 5352 | list_del(&single); |
5351 | } | 5353 | } |
5352 | 5354 | ||
5353 | static u32 netdev_fix_features(struct net_device *dev, u32 features) | 5355 | static netdev_features_t netdev_fix_features(struct net_device *dev, |
5356 | netdev_features_t features) | ||
5354 | { | 5357 | { |
5355 | /* Fix illegal checksum combinations */ | 5358 | /* Fix illegal checksum combinations */ |
5356 | if ((features & NETIF_F_HW_CSUM) && | 5359 | if ((features & NETIF_F_HW_CSUM) && |
@@ -5412,7 +5415,7 @@ static u32 netdev_fix_features(struct net_device *dev, u32 features) | |||
5412 | 5415 | ||
5413 | int __netdev_update_features(struct net_device *dev) | 5416 | int __netdev_update_features(struct net_device *dev) |
5414 | { | 5417 | { |
5415 | u32 features; | 5418 | netdev_features_t features; |
5416 | int err = 0; | 5419 | int err = 0; |
5417 | 5420 | ||
5418 | ASSERT_RTNL(); | 5421 | ASSERT_RTNL(); |
@@ -5428,16 +5431,16 @@ int __netdev_update_features(struct net_device *dev) | |||
5428 | if (dev->features == features) | 5431 | if (dev->features == features) |
5429 | return 0; | 5432 | return 0; |
5430 | 5433 | ||
5431 | netdev_dbg(dev, "Features changed: 0x%08x -> 0x%08x\n", | 5434 | netdev_dbg(dev, "Features changed: %pNF -> %pNF\n", |
5432 | dev->features, features); | 5435 | &dev->features, &features); |
5433 | 5436 | ||
5434 | if (dev->netdev_ops->ndo_set_features) | 5437 | if (dev->netdev_ops->ndo_set_features) |
5435 | err = dev->netdev_ops->ndo_set_features(dev, features); | 5438 | err = dev->netdev_ops->ndo_set_features(dev, features); |
5436 | 5439 | ||
5437 | if (unlikely(err < 0)) { | 5440 | if (unlikely(err < 0)) { |
5438 | netdev_err(dev, | 5441 | netdev_err(dev, |
5439 | "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n", | 5442 | "set_features() failed (%d); wanted %pNF, left %pNF\n", |
5440 | err, features, dev->features); | 5443 | err, &features, &dev->features); |
5441 | return -1; | 5444 | return -1; |
5442 | } | 5445 | } |
5443 | 5446 | ||
@@ -6361,7 +6364,8 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
6361 | * @one to the master device with current feature set @all. Will not | 6364 | * @one to the master device with current feature set @all. Will not |
6362 | * enable anything that is off in @mask. Returns the new feature set. | 6365 | * enable anything that is off in @mask. Returns the new feature set. |
6363 | */ | 6366 | */ |
6364 | u32 netdev_increment_features(u32 all, u32 one, u32 mask) | 6367 | netdev_features_t netdev_increment_features(netdev_features_t all, |
6368 | netdev_features_t one, netdev_features_t mask) | ||
6365 | { | 6369 | { |
6366 | if (mask & NETIF_F_GEN_CSUM) | 6370 | if (mask & NETIF_F_GEN_CSUM) |
6367 | mask |= NETIF_F_ALL_CSUM; | 6371 | mask |= NETIF_F_ALL_CSUM; |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index a354919a32ac..f135f1c92c9d 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -171,7 +171,7 @@ static void __ethtool_get_strings(struct net_device *dev, | |||
171 | ops->get_strings(dev, stringset, data); | 171 | ops->get_strings(dev, stringset, data); |
172 | } | 172 | } |
173 | 173 | ||
174 | static u32 ethtool_get_feature_mask(u32 eth_cmd) | 174 | static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd) |
175 | { | 175 | { |
176 | /* feature masks of legacy discrete ethtool ops */ | 176 | /* feature masks of legacy discrete ethtool ops */ |
177 | 177 | ||
@@ -205,7 +205,7 @@ static u32 ethtool_get_feature_mask(u32 eth_cmd) | |||
205 | static int ethtool_get_one_feature(struct net_device *dev, | 205 | static int ethtool_get_one_feature(struct net_device *dev, |
206 | char __user *useraddr, u32 ethcmd) | 206 | char __user *useraddr, u32 ethcmd) |
207 | { | 207 | { |
208 | u32 mask = ethtool_get_feature_mask(ethcmd); | 208 | netdev_features_t mask = ethtool_get_feature_mask(ethcmd); |
209 | struct ethtool_value edata = { | 209 | struct ethtool_value edata = { |
210 | .cmd = ethcmd, | 210 | .cmd = ethcmd, |
211 | .data = !!(dev->features & mask), | 211 | .data = !!(dev->features & mask), |
@@ -220,7 +220,7 @@ static int ethtool_set_one_feature(struct net_device *dev, | |||
220 | void __user *useraddr, u32 ethcmd) | 220 | void __user *useraddr, u32 ethcmd) |
221 | { | 221 | { |
222 | struct ethtool_value edata; | 222 | struct ethtool_value edata; |
223 | u32 mask; | 223 | netdev_features_t mask; |
224 | 224 | ||
225 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | 225 | if (copy_from_user(&edata, useraddr, sizeof(edata))) |
226 | return -EFAULT; | 226 | return -EFAULT; |
@@ -260,8 +260,7 @@ static u32 __ethtool_get_flags(struct net_device *dev) | |||
260 | 260 | ||
261 | static int __ethtool_set_flags(struct net_device *dev, u32 data) | 261 | static int __ethtool_set_flags(struct net_device *dev, u32 data) |
262 | { | 262 | { |
263 | u32 features = 0; | 263 | netdev_features_t features = 0, changed; |
264 | u32 changed; | ||
265 | 264 | ||
266 | if (data & ~ETH_ALL_FLAGS) | 265 | if (data & ~ETH_ALL_FLAGS) |
267 | return -EINVAL; | 266 | return -EINVAL; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8d2c5b32f172..cbc003b2914a 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2670,7 +2670,7 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum); | |||
2670 | * a pointer to the first in a list of new skbs for the segments. | 2670 | * a pointer to the first in a list of new skbs for the segments. |
2671 | * In case of error it returns ERR_PTR(err). | 2671 | * In case of error it returns ERR_PTR(err). |
2672 | */ | 2672 | */ |
2673 | struct sk_buff *skb_segment(struct sk_buff *skb, u32 features) | 2673 | struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) |
2674 | { | 2674 | { |
2675 | struct sk_buff *segs = NULL; | 2675 | struct sk_buff *segs = NULL; |
2676 | struct sk_buff *tail = NULL; | 2676 | struct sk_buff *tail = NULL; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index b2bbcd0ebd19..15dc4c4828de 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1250,7 +1250,8 @@ out: | |||
1250 | return err; | 1250 | return err; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u32 features) | 1253 | static struct sk_buff *inet_gso_segment(struct sk_buff *skb, |
1254 | netdev_features_t features) | ||
1254 | { | 1255 | { |
1255 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 1256 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
1256 | struct iphdr *iph; | 1257 | struct iphdr *iph; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 34f5db1e1c8b..50c359645665 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2653,7 +2653,8 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname, | |||
2653 | EXPORT_SYMBOL(compat_tcp_getsockopt); | 2653 | EXPORT_SYMBOL(compat_tcp_getsockopt); |
2654 | #endif | 2654 | #endif |
2655 | 2655 | ||
2656 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features) | 2656 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, |
2657 | netdev_features_t features) | ||
2657 | { | 2658 | { |
2658 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 2659 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
2659 | struct tcphdr *th; | 2660 | struct tcphdr *th; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6854f581313f..b867ea23ece9 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -2247,7 +2247,8 @@ int udp4_ufo_send_check(struct sk_buff *skb) | |||
2247 | return 0; | 2247 | return 0; |
2248 | } | 2248 | } |
2249 | 2249 | ||
2250 | struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features) | 2250 | struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, |
2251 | netdev_features_t features) | ||
2251 | { | 2252 | { |
2252 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 2253 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
2253 | unsigned int mss; | 2254 | unsigned int mss; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 282dc7a91f32..ee3319487c4f 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -769,7 +769,8 @@ out: | |||
769 | return err; | 769 | return err; |
770 | } | 770 | } |
771 | 771 | ||
772 | static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, u32 features) | 772 | static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, |
773 | netdev_features_t features) | ||
773 | { | 774 | { |
774 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 775 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
775 | struct ipv6hdr *ipv6h; | 776 | struct ipv6hdr *ipv6h; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b4a4a15fa96f..ccfb0451b1c3 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1300,7 +1300,8 @@ static int udp6_ufo_send_check(struct sk_buff *skb) | |||
1300 | return 0; | 1300 | return 0; |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features) | 1303 | static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, |
1304 | netdev_features_t features) | ||
1304 | { | 1305 | { |
1305 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 1306 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
1306 | unsigned int mss; | 1307 | unsigned int mss; |