summaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-11-15 10:29:55 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-16 17:43:10 -0500
commitc8f44affb7244f2ac3e703cab13d55ede27621bb (patch)
tree62e7aea2916a8d7cab825fe500670c5113854c0f /include/linux/netdevice.h
parenta59e2ecb859f2ab03bb2e230709f8039472ad2c3 (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 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9cf6e90b171d..b35ffd735ecc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -847,12 +847,13 @@ struct netdev_tc_txq {
847 * Called to release previously enslaved netdev. 847 * Called to release previously enslaved netdev.
848 * 848 *
849 * Feature/offload setting functions. 849 * Feature/offload setting functions.
850 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); 850 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
851 * netdev_features_t features);
851 * Adjusts the requested feature flags according to device-specific 852 * Adjusts the requested feature flags according to device-specific
852 * constraints, and returns the resulting flags. Must not modify 853 * constraints, and returns the resulting flags. Must not modify
853 * the device state. 854 * the device state.
854 * 855 *
855 * int (*ndo_set_features)(struct net_device *dev, u32 features); 856 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
856 * Called to update device configuration to new features. Passed 857 * Called to update device configuration to new features. Passed
857 * feature set might be less than what was returned by ndo_fix_features()). 858 * feature set might be less than what was returned by ndo_fix_features()).
858 * Must return >0 or -errno if it changed dev->features itself. 859 * Must return >0 or -errno if it changed dev->features itself.
@@ -946,10 +947,10 @@ struct net_device_ops {
946 struct net_device *slave_dev); 947 struct net_device *slave_dev);
947 int (*ndo_del_slave)(struct net_device *dev, 948 int (*ndo_del_slave)(struct net_device *dev,
948 struct net_device *slave_dev); 949 struct net_device *slave_dev);
949 u32 (*ndo_fix_features)(struct net_device *dev, 950 netdev_features_t (*ndo_fix_features)(struct net_device *dev,
950 u32 features); 951 netdev_features_t features);
951 int (*ndo_set_features)(struct net_device *dev, 952 int (*ndo_set_features)(struct net_device *dev,
952 u32 features); 953 netdev_features_t features);
953}; 954};
954 955
955/* 956/*
@@ -999,13 +1000,13 @@ struct net_device {
999 struct list_head unreg_list; 1000 struct list_head unreg_list;
1000 1001
1001 /* currently active device features */ 1002 /* currently active device features */
1002 u32 features; 1003 netdev_features_t features;
1003 /* user-changeable features */ 1004 /* user-changeable features */
1004 u32 hw_features; 1005 netdev_features_t hw_features;
1005 /* user-requested features */ 1006 /* user-requested features */
1006 u32 wanted_features; 1007 netdev_features_t wanted_features;
1007 /* mask of features inheritable by VLAN devices */ 1008 /* mask of features inheritable by VLAN devices */
1008 u32 vlan_features; 1009 netdev_features_t vlan_features;
1009 1010
1010 /* Interface index. Unique device identifier */ 1011 /* Interface index. Unique device identifier */
1011 int ifindex; 1012 int ifindex;
@@ -1439,7 +1440,7 @@ struct packet_type {
1439 struct packet_type *, 1440 struct packet_type *,
1440 struct net_device *); 1441 struct net_device *);
1441 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1442 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1442 u32 features); 1443 netdev_features_t features);
1443 int (*gso_send_check)(struct sk_buff *skb); 1444 int (*gso_send_check)(struct sk_buff *skb);
1444 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1445 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1445 struct sk_buff *skb); 1446 struct sk_buff *skb);
@@ -2444,7 +2445,8 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master)
2444extern int netdev_set_bond_master(struct net_device *dev, 2445extern int netdev_set_bond_master(struct net_device *dev,
2445 struct net_device *master); 2446 struct net_device *master);
2446extern int skb_checksum_help(struct sk_buff *skb); 2447extern int skb_checksum_help(struct sk_buff *skb);
2447extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); 2448extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
2449 netdev_features_t features);
2448#ifdef CONFIG_BUG 2450#ifdef CONFIG_BUG
2449extern void netdev_rx_csum_fault(struct net_device *dev); 2451extern void netdev_rx_csum_fault(struct net_device *dev);
2450#else 2452#else
@@ -2471,11 +2473,13 @@ extern const char *netdev_drivername(const struct net_device *dev);
2471 2473
2472extern void linkwatch_run_queue(void); 2474extern void linkwatch_run_queue(void);
2473 2475
2474static inline u32 netdev_get_wanted_features(struct net_device *dev) 2476static inline netdev_features_t netdev_get_wanted_features(
2477 struct net_device *dev)
2475{ 2478{
2476 return (dev->features & ~dev->hw_features) | dev->wanted_features; 2479 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2477} 2480}
2478u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2481netdev_features_t netdev_increment_features(netdev_features_t all,
2482 netdev_features_t one, netdev_features_t mask);
2479int __netdev_update_features(struct net_device *dev); 2483int __netdev_update_features(struct net_device *dev);
2480void netdev_update_features(struct net_device *dev); 2484void netdev_update_features(struct net_device *dev);
2481void netdev_change_features(struct net_device *dev); 2485void netdev_change_features(struct net_device *dev);
@@ -2483,21 +2487,22 @@ void netdev_change_features(struct net_device *dev);
2483void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2487void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2484 struct net_device *dev); 2488 struct net_device *dev);
2485 2489
2486u32 netif_skb_features(struct sk_buff *skb); 2490netdev_features_t netif_skb_features(struct sk_buff *skb);
2487 2491
2488static inline int net_gso_ok(u32 features, int gso_type) 2492static inline int net_gso_ok(netdev_features_t features, int gso_type)
2489{ 2493{
2490 int feature = gso_type << NETIF_F_GSO_SHIFT; 2494 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2491 return (features & feature) == feature; 2495 return (features & feature) == feature;
2492} 2496}
2493 2497
2494static inline int skb_gso_ok(struct sk_buff *skb, u32 features) 2498static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2495{ 2499{
2496 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2500 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2497 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2501 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2498} 2502}
2499 2503
2500static inline int netif_needs_gso(struct sk_buff *skb, int features) 2504static inline int netif_needs_gso(struct sk_buff *skb,
2505 netdev_features_t features)
2501{ 2506{
2502 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2507 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2503 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2508 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));