X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fcore%2Fethtool.c;h=0b531e98ec3355c34f837cea2551965abd09d48a;hb=40b77c943468236c6dfad3e7b94348fe70c70331;hp=87dc556fd9d6c694f65e33c6868aebdeef8325cc;hpb=8a84fc15ae5cafcc366dd85cf8e1ab2040679abc;p=linux-2.6 diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 87dc556fd9..0b531e98ec 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -17,7 +17,7 @@ #include #include -/* +/* * Some useful ethtool_ops methods that're device independent. * If we find that all drivers want to do the same thing here, * we can turn these into dev_() function calls. @@ -52,6 +52,17 @@ int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) return 0; } + +int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + else + dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); + + return 0; +} + u32 ethtool_op_get_sg(struct net_device *dev) { return (dev->features & NETIF_F_SG) != 0; @@ -87,12 +98,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a unsigned char len = dev->addr_len; if ( addr->size < len ) return -ETOOSMALL; - + addr->size = len; memcpy(data, dev->perm_addr, len); return 0; } - + u32 ethtool_op_get_ufo(struct net_device *dev) { @@ -550,7 +561,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; - if (edata.data && + if (edata.data && !(dev->features & NETIF_F_ALL_CSUM)) return -EINVAL; @@ -836,7 +847,7 @@ int dev_ethtool(struct ifreq *ifr) return -EPERM; } - if(dev->ethtool_ops->begin) + if (dev->ethtool_ops->begin) if ((rc = dev->ethtool_ops->begin(dev)) < 0) return rc; @@ -951,8 +962,8 @@ int dev_ethtool(struct ifreq *ifr) default: rc = -EOPNOTSUPP; } - - if(dev->ethtool_ops->complete) + + if (dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev); if (old_features != dev->features) @@ -980,5 +991,6 @@ EXPORT_SYMBOL(ethtool_op_set_sg); EXPORT_SYMBOL(ethtool_op_set_tso); EXPORT_SYMBOL(ethtool_op_set_tx_csum); EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); +EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum); EXPORT_SYMBOL(ethtool_op_set_ufo); EXPORT_SYMBOL(ethtool_op_get_ufo);