* [PATCH 0/9] Convert features fields from u32 to type u64 @ 2011-04-22 23:35 Mahesh Bandewar 2011-04-22 23:35 ` [PATCH 1/9] net-dev: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64 Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:35 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Mahesh Bandewar (9): net-dev: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64 net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-core: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-tcp: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-udp: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-vlan: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-bridge: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-ipv4: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. net-ipv6: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. include/linux/ethtool.h | 26 +++++++------ include/linux/netdevice.h | 86 ++++++++++++++++++++++---------------------- include/linux/skbuff.h | 2 +- include/net/protocol.h | 4 +- include/net/sock.h | 8 ++-- include/net/tcp.h | 2 +- include/net/udp.h | 2 +- net/8021q/vlan_dev.c | 2 +- net/bridge/br_if.c | 2 +- net/bridge/br_private.h | 2 +- net/core/dev.c | 26 +++++++------- net/core/ethtool.c | 89 ++++++++++++++++----------------------------- net/core/skbuff.c | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/udp.c | 2 +- 18 files changed, 119 insertions(+), 144 deletions(-) -- 1.7.3.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/9] net-dev: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64 2011-04-22 23:35 [PATCH 0/9] Convert features fields from u32 to type u64 Mahesh Bandewar @ 2011-04-22 23:35 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 2/9] net-ethtool: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:35 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- include/linux/netdevice.h | 86 ++++++++++++++++++++++---------------------- net/core/dev.c | 26 +++++++------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cb8178a..7ec5af5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -877,12 +877,12 @@ struct netdev_tc_txq { * Called to release previously enslaved netdev. * * Feature/offload setting functions. - * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); + * u64 (*ndo_fix_features)(struct net_device *dev, u64 features); * Adjusts the requested feature flags according to device-specific * constraints, and returns the resulting flags. Must not modify * the device state. * - * int (*ndo_set_features)(struct net_device *dev, u32 features); + * int (*ndo_set_features)(struct net_device *dev, u64 features); * Called to update device configuration to new features. Passed * feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. @@ -974,10 +974,10 @@ struct net_device_ops { struct net_device *slave_dev); int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); - u32 (*ndo_fix_features)(struct net_device *dev, - u32 features); + u64 (*ndo_fix_features)(struct net_device *dev, + u64 features); int (*ndo_set_features)(struct net_device *dev, - u32 features); + u64 features); }; /* @@ -1030,43 +1030,43 @@ struct net_device { struct list_head unreg_list; /* currently active device features */ - u32 features; + u64 features; /* user-changeable features */ - u32 hw_features; + u64 hw_features; /* user-requested features */ - u32 wanted_features; + u64 wanted_features; /* mask of features inheritable by VLAN devices */ - u32 vlan_features; + u64 vlan_features; /* Net device feature bits; if you change something, * also update netdev_features_strings[] in ethtool.c */ -#define NETIF_F_SG 1 /* Scatter/gather IO. */ -#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ -#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ -#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ -#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */ -#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ -#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ -#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ -#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ -#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ -#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ -#define NETIF_F_GSO 2048 /* Enable software GSO. */ -#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ - /* do not use LLTX in new drivers */ -#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ -#define NETIF_F_GRO 16384 /* Generic receive offload */ -#define NETIF_F_LRO 32768 /* large receive offload */ +#define NETIF_F_SG ((u64)1 << 0) /* Scatter/gather IO. */ +#define NETIF_F_IP_CSUM ((u64)1 << 1) /* Can checksum TCP/UDP over IPv4. */ +#define NETIF_F_NO_CSUM ((u64)1 << 2) /* Does not require checksum. F.e. loopack. */ +#define NETIF_F_HW_CSUM ((u64)1 << 3) /* Can checksum all the packets. */ +#define NETIF_F_IPV6_CSUM ((u64)1 << 4) /* Can checksum TCP/UDP over IPV6 */ +#define NETIF_F_HIGHDMA ((u64)1 << 5) /* Can DMA to high memory. */ +#define NETIF_F_FRAGLIST ((u64)1 << 6) /* Scatter/gather IO. */ +#define NETIF_F_HW_VLAN_TX ((u64)1 << 7) /* Transmit VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_RX ((u64)1 << 8) /* Receive VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_FILTER ((u64)1 << 9) /* Receive filtering on VLAN */ +#define NETIF_F_VLAN_CHALLENGED ((u64)1 << 10) /* Device cannot handle VLAN packets */ +#define NETIF_F_GSO ((u64)1 << 11) /* Enable software GSO. */ +#define NETIF_F_LLTX ((u64)1 << 12) /* LockLess TX - deprecated. Please */ + /* do not use LLTX in new drivers */ +#define NETIF_F_NETNS_LOCAL ((u64)1 << 13) /* Does not change network namespaces */ +#define NETIF_F_GRO ((u64)1 << 14) /* Generic receive offload */ +#define NETIF_F_LRO ((u64)1 << 15) /* large receive offload */ /* the GSO_MASK reserves bits 16 through 23 */ -#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ -#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ -#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ -#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ -#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ -#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */ -#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */ +#define NETIF_F_FCOE_CRC ((u64)1 << 24) /* FCoE CRC32 */ +#define NETIF_F_SCTP_CSUM ((u64)1 << 25) /* SCTP checksum offload */ +#define NETIF_F_FCOE_MTU ((u64)1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ +#define NETIF_F_NTUPLE ((u64)1 << 27) /* N-tuple filters supported */ +#define NETIF_F_RXHASH ((u64)1 << 28) /* Receive hashing offload */ +#define NETIF_F_RXCSUM ((u64)1 << 29) /* Receive checksumming offload */ +#define NETIF_F_NOCACHE_COPY ((u64)1 << 30) /* Use no-cache copyfromuser */ /* Segmentation offload features */ #define NETIF_F_GSO_SHIFT 16 @@ -1541,7 +1541,7 @@ struct packet_type { struct packet_type *, struct net_device *); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - u32 features); + u64 features); int (*gso_send_check)(struct sk_buff *skb); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); @@ -2518,7 +2518,7 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master) extern int netdev_set_bond_master(struct net_device *dev, struct net_device *master); extern int skb_checksum_help(struct sk_buff *skb); -extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); +extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u64 features); #ifdef CONFIG_BUG extern void netdev_rx_csum_fault(struct net_device *dev); #else @@ -2545,33 +2545,33 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l extern void linkwatch_run_queue(void); -static inline u32 netdev_get_wanted_features(struct net_device *dev) +static inline u64 netdev_get_wanted_features(struct net_device *dev) { return (dev->features & ~dev->hw_features) | dev->wanted_features; } -u32 netdev_increment_features(u32 all, u32 one, u32 mask); -u32 netdev_fix_features(struct net_device *dev, u32 features); +u64 netdev_increment_features(u64 all, u64 one, u64 mask); +u64 netdev_fix_features(struct net_device *dev, u64 features); int __netdev_update_features(struct net_device *dev); void netdev_update_features(struct net_device *dev); void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev); -u32 netif_skb_features(struct sk_buff *skb); +u64 netif_skb_features(struct sk_buff *skb); -static inline int net_gso_ok(u32 features, int gso_type) +static inline u64 net_gso_ok(u64 features, int gso_type) { - int feature = gso_type << NETIF_F_GSO_SHIFT; + u64 feature = (u64)gso_type << NETIF_F_GSO_SHIFT; return (features & feature) == feature; } -static inline int skb_gso_ok(struct sk_buff *skb, u32 features) +static inline int skb_gso_ok(struct sk_buff *skb, u64 features) { return net_gso_ok(features, skb_shinfo(skb)->gso_type) && (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); } -static inline int netif_needs_gso(struct sk_buff *skb, int features) +static inline int netif_needs_gso(struct sk_buff *skb, u64 features) { return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); diff --git a/net/core/dev.c b/net/core/dev.c index 379c993..73d96e5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1840,7 +1840,7 @@ EXPORT_SYMBOL(skb_checksum_help); * It may return NULL if the skb requires no segmentation. This is * only possible when GSO is used for verifying header integrity. */ -struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features) +struct sk_buff *skb_gso_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); struct packet_type *ptype; @@ -1978,7 +1978,7 @@ static void dev_gso_skb_destructor(struct sk_buff *skb) * This function segments the given skb and stores the list of segments * in skb->next. */ -static int dev_gso_segment(struct sk_buff *skb, int features) +static int dev_gso_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs; @@ -2017,7 +2017,7 @@ static inline void skb_orphan_try(struct sk_buff *skb) } } -static bool can_checksum_protocol(unsigned long features, __be16 protocol) +static bool can_checksum_protocol(u64 features, __be16 protocol) { return ((features & NETIF_F_GEN_CSUM) || ((features & NETIF_F_V4_CSUM) && @@ -2028,7 +2028,7 @@ static bool can_checksum_protocol(unsigned long features, __be16 protocol) protocol == htons(ETH_P_FCOE))); } -static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features) +static u64 harmonize_features(struct sk_buff *skb, __be16 protocol, u64 features) { if (!can_checksum_protocol(features, protocol)) { features &= ~NETIF_F_ALL_CSUM; @@ -2040,10 +2040,10 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features return features; } -u32 netif_skb_features(struct sk_buff *skb) +u64 netif_skb_features(struct sk_buff *skb) { __be16 protocol = skb->protocol; - u32 features = skb->dev->features; + u64 features = skb->dev->features; if (protocol == htons(ETH_P_8021Q)) { struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; @@ -2072,7 +2072,7 @@ EXPORT_SYMBOL(netif_skb_features); * support DMA from it. */ static inline int skb_needs_linearize(struct sk_buff *skb, - int features) + u64 features) { return skb_is_nonlinear(skb) && ((skb_has_frag_list(skb) && @@ -2088,7 +2088,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, int rc = NETDEV_TX_OK; if (likely(!skb->next)) { - u32 features; + u64 features; /* * If device doesn't need skb->dst, release it right now while @@ -5185,7 +5185,7 @@ static void rollback_registered(struct net_device *dev) list_del(&single); } -u32 netdev_fix_features(struct net_device *dev, u32 features) +u64 netdev_fix_features(struct net_device *dev, u64 features) { /* Fix illegal checksum combinations */ if ((features & NETIF_F_HW_CSUM) && @@ -5248,7 +5248,7 @@ EXPORT_SYMBOL(netdev_fix_features); int __netdev_update_features(struct net_device *dev) { - u32 features; + u64 features; int err = 0; ASSERT_RTNL(); @@ -5264,7 +5264,7 @@ int __netdev_update_features(struct net_device *dev) if (dev->features == features) return 0; - netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n", + netdev_info(dev, "Features changed: 0x%016x -> 0x%016x\n", dev->features, features); if (dev->netdev_ops->ndo_set_features) @@ -5272,7 +5272,7 @@ int __netdev_update_features(struct net_device *dev) if (unlikely(err < 0)) { netdev_err(dev, - "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n", + "set_features() failed (%d); wanted 0x%016x, left 0x%016x\n", err, features, dev->features); return -1; } @@ -6182,7 +6182,7 @@ static int dev_cpu_callback(struct notifier_block *nfb, * @one to the master device with current feature set @all. Will not * enable anything that is off in @mask. Returns the new feature set. */ -u32 netdev_increment_features(u32 all, u32 one, u32 mask) +u64 netdev_increment_features(u64 all, u64 one, u64 mask) { /* If device needs checksumming, downgrade to it. */ if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/9] net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:35 ` [PATCH 1/9] net-dev: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64 Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 3/9] net-core: " Mahesh Bandewar ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- include/linux/ethtool.h | 26 +++++++------ net/core/ethtool.c | 89 ++++++++++++++++------------------------------ 2 files changed, 45 insertions(+), 70 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 9de3127..71e8a02 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -605,10 +605,10 @@ struct ethtool_flash { * @never_changed: mask of features not changeable for any device */ struct ethtool_get_features_block { - __u32 available; - __u32 requested; - __u32 active; - __u32 never_changed; + __u64 available; + __u64 requested; + __u64 active; + __u64 never_changed; }; /** @@ -618,10 +618,11 @@ struct ethtool_get_features_block { * out: number of elements in features[] needed to hold all features * @features: state of features */ +/* TODO Why is this needed XXX */ struct ethtool_gfeatures { __u32 cmd; __u32 size; - struct ethtool_get_features_block features[0]; + struct ethtool_get_features_block features; }; /** @@ -630,8 +631,8 @@ struct ethtool_gfeatures { * @requested: values of features to be changed */ struct ethtool_set_features_block { - __u32 valid; - __u32 requested; + __u64 valid; + __u64 requested; }; /** @@ -640,10 +641,11 @@ struct ethtool_set_features_block { * @size: array size of the features[] array * @features: feature change masks */ +/* TODO Why is this needed XXX */ struct ethtool_sfeatures { __u32 cmd; __u32 size; - struct ethtool_set_features_block features[0]; + struct ethtool_set_features_block features; }; /* @@ -686,7 +688,7 @@ enum ethtool_sfeatures_retval_bits { #include <linux/rculist.h> /* needed by dev_disable_lro() */ -extern int __ethtool_set_flags(struct net_device *dev, u32 flags); +extern int __ethtool_set_flags(struct net_device *dev, u64 flags); struct ethtool_rx_ntuple_flow_spec_container { struct ethtool_rx_ntuple_flow_spec fs; @@ -730,10 +732,10 @@ u32 ethtool_op_get_tso(struct net_device *dev); int ethtool_op_set_tso(struct net_device *dev, u32 data); u32 ethtool_op_get_ufo(struct net_device *dev); int ethtool_op_set_ufo(struct net_device *dev, u32 data); -u32 ethtool_op_get_flags(struct net_device *dev); -int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); +u64 ethtool_op_get_flags(struct net_device *dev); +int ethtool_op_set_flags(struct net_device *dev, u64 data, u64 supported); void ethtool_ntuple_flush(struct net_device *dev); -bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported); +bool ethtool_invalid_flags(struct net_device *dev, u64 data, u64 supported); /** * struct ethtool_ops - optional netdev operations diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d8b1a8d..8a25090 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -128,11 +128,11 @@ EXPORT_SYMBOL(ethtool_op_set_ufo); /* the following list of flags are the same as their associated * NETIF_F_xxx values in include/linux/netdevice.h */ -static const u32 flags_dup_features = +static const u64 flags_dup_features = (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH); -u32 ethtool_op_get_flags(struct net_device *dev) +u64 ethtool_op_get_flags(struct net_device *dev) { /* in the future, this function will probably contain additional * handling for flags which are not so easily handled @@ -148,9 +148,9 @@ EXPORT_SYMBOL(ethtool_op_get_flags); * If feature can not be toggled, it state (enabled or disabled) must match * hardcoded device features state, otherwise flags are marked as invalid. */ -bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported) +bool ethtool_invalid_flags(struct net_device *dev, u64 data, u64 supported) { - u32 features = dev->features & flags_dup_features; + u64 features = dev->features & flags_dup_features; /* "data" can contain only flags_dup_features bits, * see __ethtool_set_flags */ @@ -158,7 +158,7 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported) } EXPORT_SYMBOL(ethtool_invalid_flags); -int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported) +int ethtool_op_set_flags(struct net_device *dev, u64 data, u64 supported) { if (ethtool_invalid_flags(dev, data, supported)) return -EINVAL; @@ -183,8 +183,6 @@ EXPORT_SYMBOL(ethtool_ntuple_flush); /* Handlers for each ethtool command */ -#define ETHTOOL_DEV_FEATURE_WORDS 1 - static void ethtool_get_features_compat(struct net_device *dev, struct ethtool_get_features_block *features) { @@ -211,23 +209,23 @@ static void ethtool_get_features_compat(struct net_device *dev, static int ethtool_set_feature_compat(struct net_device *dev, int (*legacy_set)(struct net_device *, u32), - struct ethtool_set_features_block *features, u32 mask) + struct ethtool_set_features_block *features, u64 mask) { u32 do_set; if (!legacy_set) return 0; - if (!(features[0].valid & mask)) + if (!(features->valid & mask)) return 0; - features[0].valid &= ~mask; + features->valid &= ~mask; - do_set = !!(features[0].requested & mask); + do_set = !!(features->requested & mask); if (legacy_set(dev, do_set) < 0) netdev_info(dev, - "Legacy feature change (%s) failed for 0x%08x\n", + "Legacy feature change (%s) failed for 0x%016lX\n", do_set ? "set" : "clear", mask); return 1; @@ -259,33 +257,15 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) { struct ethtool_gfeatures cmd = { .cmd = ETHTOOL_GFEATURES, - .size = ETHTOOL_DEV_FEATURE_WORDS, - }; - struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = { - { - .available = dev->hw_features, - .requested = dev->wanted_features, - .active = dev->features, - .never_changed = NETIF_F_NEVER_CHANGE, - }, + .features.available = dev->hw_features, + .features.requested = dev->wanted_features, + .features.active = dev->features, + .features.never_changed = NETIF_F_NEVER_CHANGE, }; - u32 __user *sizeaddr; - u32 copy_size; - - ethtool_get_features_compat(dev, features); - - sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); - if (get_user(copy_size, sizeaddr)) - return -EFAULT; - - if (copy_size > ETHTOOL_DEV_FEATURE_WORDS) - copy_size = ETHTOOL_DEV_FEATURE_WORDS; + ethtool_get_features_compat(dev, &cmd.features); if (copy_to_user(useraddr, &cmd, sizeof(cmd))) return -EFAULT; - useraddr += sizeof(cmd); - if (copy_to_user(useraddr, features, copy_size * sizeof(*features))) - return -EFAULT; return 0; } @@ -293,41 +273,34 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) static int ethtool_set_features(struct net_device *dev, void __user *useraddr) { struct ethtool_sfeatures cmd; - struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; int ret = 0; if (copy_from_user(&cmd, useraddr, sizeof(cmd))) return -EFAULT; - useraddr += sizeof(cmd); - - if (cmd.size != ETHTOOL_DEV_FEATURE_WORDS) - return -EINVAL; - - if (copy_from_user(features, useraddr, sizeof(features))) - return -EFAULT; - if (features[0].valid & ~NETIF_F_ETHTOOL_BITS) + if (cmd.features.valid & ~NETIF_F_ETHTOOL_BITS) return -EINVAL; - if (ethtool_set_features_compat(dev, features)) + if (ethtool_set_features_compat(dev, &cmd.features)) ret |= ETHTOOL_F_COMPAT; - if (features[0].valid & ~dev->hw_features) { - features[0].valid &= dev->hw_features; + if (cmd.features.valid & ~dev->hw_features) { + cmd.features.valid &= dev->hw_features; ret |= ETHTOOL_F_UNSUPPORTED; } - dev->wanted_features &= ~features[0].valid; - dev->wanted_features |= features[0].valid & features[0].requested; + dev->wanted_features &= ~cmd.features.valid; + dev->wanted_features |= cmd.features.valid & cmd.features.requested; __netdev_update_features(dev); - if ((dev->wanted_features ^ dev->features) & features[0].valid) + if ((dev->wanted_features ^ dev->features) & cmd.features.valid) ret |= ETHTOOL_F_WISH; return ret; } -static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GSTRING_LEN] = { +static const char +netdev_features_strings[sizeof(u64) * BITS_PER_BYTE][ETH_GSTRING_LEN] = { /* NETIF_F_SG */ "tx-scatter-gather", /* NETIF_F_IP_CSUM */ "tx-checksum-ipv4", /* NETIF_F_NO_CSUM */ "tx-checksum-unneeded", @@ -391,7 +364,7 @@ static void __ethtool_get_strings(struct net_device *dev, ops->get_strings(dev, stringset, data); } -static u32 ethtool_get_feature_mask(u32 eth_cmd) +static u64 ethtool_get_feature_mask(u32 eth_cmd) { /* feature masks of legacy discrete ethtool ops */ @@ -445,7 +418,7 @@ static void *__ethtool_get_one_feature_actor(struct net_device *dev, u32 ethcmd) } } -static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev) +static u64 __ethtool_get_rx_csum_oldbug(struct net_device *dev) { return !!(dev->features & NETIF_F_ALL_CSUM); } @@ -453,7 +426,7 @@ static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev) static int ethtool_get_one_feature(struct net_device *dev, char __user *useraddr, u32 ethcmd) { - u32 mask = ethtool_get_feature_mask(ethcmd); + u64 mask = ethtool_get_feature_mask(ethcmd); struct ethtool_value edata = { .cmd = ethcmd, .data = !!(dev->features & mask), @@ -461,7 +434,7 @@ static int ethtool_get_one_feature(struct net_device *dev, /* compatibility with discrete get_ ops */ if (!(dev->hw_features & mask)) { - u32 (*actor)(struct net_device *); + u64 (*actor)(struct net_device *); actor = __ethtool_get_one_feature_actor(dev, ethcmd); @@ -488,7 +461,7 @@ static int ethtool_set_one_feature(struct net_device *dev, void __user *useraddr, u32 ethcmd) { struct ethtool_value edata; - u32 mask; + u64 mask; if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; @@ -530,9 +503,9 @@ static int ethtool_set_one_feature(struct net_device *dev, } } -int __ethtool_set_flags(struct net_device *dev, u32 data) +int __ethtool_set_flags(struct net_device *dev, u64 data) { - u32 changed; + u64 changed; if (data & ~flags_dup_features) return -EINVAL; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/9] net-core: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 2/9] net-ethtool: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 4/9] net-tcp: " Mahesh Bandewar 2011-04-24 5:30 ` [PATCH 2/9] net-ethtool: " Ben Hutchings 2011-04-25 8:48 ` Michał Mirosław 2 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- include/linux/skbuff.h | 2 +- include/net/protocol.h | 4 ++-- include/net/sock.h | 8 ++++---- net/core/skbuff.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d0ae90a..5174846 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1880,7 +1880,7 @@ extern void skb_split(struct sk_buff *skb, extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); -extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); +extern struct sk_buff *skb_segment(struct sk_buff *skb, u64 features); static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer) diff --git a/include/net/protocol.h b/include/net/protocol.h index 6f7eb80..6451e27 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h @@ -38,7 +38,7 @@ struct net_protocol { void (*err_handler)(struct sk_buff *skb, u32 info); int (*gso_send_check)(struct sk_buff *skb); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - u32 features); + u64 features); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); int (*gro_complete)(struct sk_buff *skb); @@ -57,7 +57,7 @@ struct inet6_protocol { int (*gso_send_check)(struct sk_buff *skb); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - u32 features); + u64 features); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); int (*gro_complete)(struct sk_buff *skb); diff --git a/include/net/sock.h b/include/net/sock.h index f2046e4..8a0a3fe 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -307,8 +307,8 @@ struct sock { kmemcheck_bitfield_end(flags); int sk_wmem_queued; gfp_t sk_allocation; - int sk_route_caps; - int sk_route_nocaps; + u64 sk_route_caps; + u64 sk_route_nocaps; int sk_gso_type; unsigned int sk_gso_max_size; int sk_rcvlowat; @@ -1377,14 +1377,14 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); -static inline int sk_can_gso(const struct sock *sk) +static inline u64 sk_can_gso(const struct sock *sk) { return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); } extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); -static inline void sk_nocaps_add(struct sock *sk, int flags) +static inline void sk_nocaps_add(struct sock *sk, u64 flags) { sk->sk_route_nocaps |= flags; sk->sk_route_caps &= ~flags; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7ebeed0..0d748cc 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2494,7 +2494,7 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum); * a pointer to the first in a list of new skbs for the segments. * In case of error it returns ERR_PTR(err). */ -struct sk_buff *skb_segment(struct sk_buff *skb, u32 features) +struct sk_buff *skb_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = NULL; struct sk_buff *tail = NULL; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/9] net-tcp: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 3/9] net-core: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 5/9] net-udp: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- include/net/tcp.h | 2 +- net/ipv4/tcp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index cda30ea..bcfd5cb 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1396,7 +1396,7 @@ extern struct request_sock_ops tcp6_request_sock_ops; extern void tcp_v4_destroy_sock(struct sock *sk); extern int tcp_v4_gso_send_check(struct sk_buff *skb); -extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features); +extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u64 features); extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb); extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 054a59d..1320523 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2654,7 +2654,7 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname, EXPORT_SYMBOL(compat_tcp_getsockopt); #endif -struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features) +struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct tcphdr *th; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/9] net-udp: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 4/9] net-tcp: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 6/9] net-vlan: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- include/net/udp.h | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/udp.h b/include/net/udp.h index 67ea6fc..7a3779c 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -256,5 +256,5 @@ extern void udp4_proc_exit(void); extern void udp_init(void); extern int udp4_ufo_send_check(struct sk_buff *skb); -extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features); +extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u64 features); #endif /* _UDP_H */ diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index bc0dab2..e06d546 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2230,7 +2230,7 @@ int udp4_ufo_send_check(struct sk_buff *skb) return 0; } -struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features) +struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); unsigned int mss; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 1bdc5f0..9f8ad70 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1295,7 +1295,7 @@ static int udp6_ufo_send_check(struct sk_buff *skb) return 0; } -static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features) +static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); unsigned int mss; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/9] net-vlan: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 5/9] net-udp: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 7/9] net-bridge: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- net/8021q/vlan_dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index d174c31..f68a670 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -586,7 +586,7 @@ static void vlan_dev_uninit(struct net_device *dev) } } -static u32 vlan_dev_fix_features(struct net_device *dev, u32 features) +static u64 vlan_dev_fix_features(struct net_device *dev, u64 features) { struct net_device *real_dev = vlan_dev_info(dev)->real_dev; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/9] net-bridge: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 6/9] net-vlan: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 8/9] net-ipv4: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- net/bridge/br_if.c | 2 +- net/bridge/br_private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 7f5379c..6455f52 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -294,7 +294,7 @@ int br_min_mtu(const struct net_bridge *br) void br_features_recompute(struct net_bridge *br) { struct net_bridge_port *p; - u32 features, mask; + u64 features, mask; features = mask = br->feature_mask; if (list_empty(&br->port_list)) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index e2a4034..1ac4020 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -183,7 +183,7 @@ struct net_bridge struct br_cpu_netstats __percpu *stats; spinlock_t hash_lock; struct hlist_head hash[BR_HASH_SIZE]; - u32 feature_mask; + u64 feature_mask; #ifdef CONFIG_BRIDGE_NETFILTER struct rtable fake_rtable; bool nf_call_iptables; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 8/9] net-ipv4: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 7/9] net-bridge: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 9/9] net-ipv6: " Mahesh Bandewar 0 siblings, 1 reply; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- net/ipv4/af_inet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index cae75ef..5bf9b0f 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1219,7 +1219,7 @@ out: return err; } -static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u32 features) +static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct iphdr *iph; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 9/9] net-ipv6: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 8/9] net-ipv4: " Mahesh Bandewar @ 2011-04-22 23:36 ` Mahesh Bandewar 0 siblings, 0 replies; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-22 23:36 UTC (permalink / raw) To: David Miller; +Cc: netdev, Mahesh Bandewar Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- net/ipv6/af_inet6.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index b7919f9..10d1896 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -765,7 +765,7 @@ out: return err; } -static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, u32 features) +static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, u64 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct ipv6hdr *ipv6h; -- 1.7.3.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/9] net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 2/9] net-ethtool: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 3/9] net-core: " Mahesh Bandewar @ 2011-04-24 5:30 ` Ben Hutchings 2011-04-25 5:28 ` David Miller 2011-04-25 18:14 ` Mahesh Bandewar 2011-04-25 8:48 ` Michał Mirosław 2 siblings, 2 replies; 14+ messages in thread From: Ben Hutchings @ 2011-04-24 5:30 UTC (permalink / raw) To: Mahesh Bandewar; +Cc: David Miller, netdev, Michał Mirosław On Fri, 2011-04-22 at 16:36 -0700, Mahesh Bandewar wrote: > Signed-off-by: Mahesh Bandewar <maheshb@google.com> > --- > include/linux/ethtool.h | 26 +++++++------ > net/core/ethtool.c | 89 ++++++++++++++++------------------------------ > 2 files changed, 45 insertions(+), 70 deletions(-) > > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h > index 9de3127..71e8a02 100644 > --- a/include/linux/ethtool.h > +++ b/include/linux/ethtool.h > @@ -605,10 +605,10 @@ struct ethtool_flash { > * @never_changed: mask of features not changeable for any device > */ > struct ethtool_get_features_block { > - __u32 available; > - __u32 requested; > - __u32 active; > - __u32 never_changed; > + __u64 available; > + __u64 requested; > + __u64 active; > + __u64 never_changed; > }; > > /** > @@ -618,10 +618,11 @@ struct ethtool_get_features_block { > * out: number of elements in features[] needed to hold all features > * @features: state of features > */ > +/* TODO Why is this needed XXX */ Precisely to allow for expansion to more than 32 bits. > struct ethtool_gfeatures { > __u32 cmd; > __u32 size; > - struct ethtool_get_features_block features[0]; > + struct ethtool_get_features_block features; > }; > > /** > @@ -630,8 +631,8 @@ struct ethtool_gfeatures { > * @requested: values of features to be changed > */ > struct ethtool_set_features_block { > - __u32 valid; > - __u32 requested; > + __u64 valid; > + __u64 requested; > }; > > /** > @@ -640,10 +641,11 @@ struct ethtool_set_features_block { > * @size: array size of the features[] array > * @features: feature change masks > */ > +/* TODO Why is this needed XXX */ > struct ethtool_sfeatures { > __u32 cmd; > __u32 size; > - struct ethtool_set_features_block features[0]; > + struct ethtool_set_features_block features; > }; [...] These structures are part of the userland API, but they are new in 2.6.39. So they can still be changed up until 2.6.39 is released, but not afterwards. If we think 64 bits will be enough for the next 10 years, then let's just go with a single 64-bit feature word. If we're not so sure then then the ethtool API should continue to allow for multiple words (whether 32-bit or 64-bit). Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/9] net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-24 5:30 ` [PATCH 2/9] net-ethtool: " Ben Hutchings @ 2011-04-25 5:28 ` David Miller 2011-04-25 18:14 ` Mahesh Bandewar 1 sibling, 0 replies; 14+ messages in thread From: David Miller @ 2011-04-25 5:28 UTC (permalink / raw) To: bhutchings; +Cc: maheshb, netdev, mirq-linux From: Ben Hutchings <bhutchings@solarflare.com> Date: Sun, 24 Apr 2011 06:30:40 +0100 > If we think 64 bits will be enough for the next 10 years, then let's > just go with a single 64-bit feature word. If we're not so sure then > then the ethtool API should continue to allow for multiple words > (whether 32-bit or 64-bit). I think the ethtool facing stuff should stay as is. Having total flexibility internally is important. I know some people had reservations about using the bitmap interfaces, but that's what they exist for. The approach for the conversion just wasn't right. My humble suggestion is: 1) Abstract away every access to these feature sets, like this. void netdev_set_feature(struct net_device *netdev, int feature); void netdev_clear_feature(struct net_device *netdev, int feature); bool netdev_test_feature(struct net_device *netdev, int feature); Then you can use whatever representation you want, without having to edit hundreds of files every time we want to change how these feature sets are stored. Thus, after this, future changes will be painless. This is a multi-commit change. First you add the interfaces, then you change the access sites in logical groups. 2) Write translators between the internal representation and the ethtool user-visible data structures we have for this stuff. 3) Pick an extensible set implementation and use it. We may need to have a type that gets used to pass feature sets around, and if that's absolutely needed, then fine. But it has to be a typedef or similar, so that it can be changed without having to change every function signature every time we want to change the representation. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/9] net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-24 5:30 ` [PATCH 2/9] net-ethtool: " Ben Hutchings 2011-04-25 5:28 ` David Miller @ 2011-04-25 18:14 ` Mahesh Bandewar 1 sibling, 0 replies; 14+ messages in thread From: Mahesh Bandewar @ 2011-04-25 18:14 UTC (permalink / raw) To: Ben Hutchings; +Cc: David Miller, netdev, Michał Mirosław On Sat, Apr 23, 2011 at 10:30 PM, Ben Hutchings <bhutchings@solarflare.com> wrote: > On Fri, 2011-04-22 at 16:36 -0700, Mahesh Bandewar wrote: >> Signed-off-by: Mahesh Bandewar <maheshb@google.com> >> --- >> include/linux/ethtool.h | 26 +++++++------ >> net/core/ethtool.c | 89 ++++++++++++++++------------------------------ >> 2 files changed, 45 insertions(+), 70 deletions(-) >> >> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h >> index 9de3127..71e8a02 100644 >> --- a/include/linux/ethtool.h >> +++ b/include/linux/ethtool.h >> @@ -605,10 +605,10 @@ struct ethtool_flash { >> * @never_changed: mask of features not changeable for any device >> */ >> struct ethtool_get_features_block { >> - __u32 available; >> - __u32 requested; >> - __u32 active; >> - __u32 never_changed; >> + __u64 available; >> + __u64 requested; >> + __u64 active; >> + __u64 never_changed; >> }; >> >> /** >> @@ -618,10 +618,11 @@ struct ethtool_get_features_block { >> * out: number of elements in features[] needed to hold all features >> * @features: state of features >> */ >> +/* TODO Why is this needed XXX */ > > Precisely to allow for expansion to more than 32 bits. > :) That comment was not supposed to be part of the patch and was just to aid my thinking while we were discussing about the approach to extend features. (I thought) if we have decided not to use use arrays, then why to complicate this interface, so was attempting to simplify the interface. >> struct ethtool_gfeatures { >> __u32 cmd; >> __u32 size; >> - struct ethtool_get_features_block features[0]; >> + struct ethtool_get_features_block features; >> }; >> >> /** >> @@ -630,8 +631,8 @@ struct ethtool_gfeatures { >> * @requested: values of features to be changed >> */ >> struct ethtool_set_features_block { >> - __u32 valid; >> - __u32 requested; >> + __u64 valid; >> + __u64 requested; >> }; >> >> /** >> @@ -640,10 +641,11 @@ struct ethtool_set_features_block { >> * @size: array size of the features[] array >> * @features: feature change masks >> */ >> +/* TODO Why is this needed XXX */ >> struct ethtool_sfeatures { >> __u32 cmd; >> __u32 size; >> - struct ethtool_set_features_block features[0]; >> + struct ethtool_set_features_block features; >> }; > [...] > > These structures are part of the userland API, but they are new in > 2.6.39. So they can still be changed up until 2.6.39 is released, but > not afterwards. > got it! > If we think 64 bits will be enough for the next 10 years, then let's > just go with a single 64-bit feature word. If we're not so sure then > then the ethtool API should continue to allow for multiple words > (whether 32-bit or 64-bit). > I think even 64 bits may not be enough, so in the earlier thread I had mentioned that, this would (probably) give us next two years! I didn't know this constraint though. --mahesh.. > Ben. > > -- > Ben Hutchings, Senior Software Engineer, Solarflare > Not speaking for my employer; that's the marketing department's job. > They asked us to note that Solarflare product names are trademarked. > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/9] net-ethtool: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64. 2011-04-22 23:36 ` [PATCH 2/9] net-ethtool: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 3/9] net-core: " Mahesh Bandewar 2011-04-24 5:30 ` [PATCH 2/9] net-ethtool: " Ben Hutchings @ 2011-04-25 8:48 ` Michał Mirosław 2 siblings, 0 replies; 14+ messages in thread From: Michał Mirosław @ 2011-04-25 8:48 UTC (permalink / raw) To: Mahesh Bandewar; +Cc: David Miller, netdev 2011/4/23 Mahesh Bandewar <maheshb@google.com>: > > Signed-off-by: Mahesh Bandewar <maheshb@google.com> > --- > include/linux/ethtool.h | 26 +++++++------ > net/core/ethtool.c | 89 ++++++++++++++++------------------------------ > 2 files changed, 45 insertions(+), 70 deletions(-) > > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h > index 9de3127..71e8a02 100644 > --- a/include/linux/ethtool.h > +++ b/include/linux/ethtool.h > @@ -605,10 +605,10 @@ struct ethtool_flash { > * @never_changed: mask of features not changeable for any device > */ > struct ethtool_get_features_block { > - __u32 available; > - __u32 requested; > - __u32 active; > - __u32 never_changed; > + __u64 available; > + __u64 requested; > + __u64 active; > + __u64 never_changed; > }; [...] Please don't do it like this. G/SFEATURES were prepared to handle multiple words when needed. This means that it's enough to just split the u64 into two u32 sets represented in ethtool_get/set_features. Best Regards, Michał Mirosław ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-04-25 18:14 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-22 23:35 [PATCH 0/9] Convert features fields from u32 to type u64 Mahesh Bandewar 2011-04-22 23:35 ` [PATCH 1/9] net-dev: Convert (hw_/vlan_/wanted_)features fields from u32 type to u64 Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 2/9] net-ethtool: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 3/9] net-core: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 4/9] net-tcp: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 5/9] net-udp: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 6/9] net-vlan: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 7/9] net-bridge: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 8/9] net-ipv4: " Mahesh Bandewar 2011-04-22 23:36 ` [PATCH 9/9] net-ipv6: " Mahesh Bandewar 2011-04-24 5:30 ` [PATCH 2/9] net-ethtool: " Ben Hutchings 2011-04-25 5:28 ` David Miller 2011-04-25 18:14 ` Mahesh Bandewar 2011-04-25 8:48 ` Michał Mirosław
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).