Commit 02891c60 authored by David S. Miller's avatar David S. Miller

[ETHTOOL]: Add {G,S}TSO support to ethtool_ops.

parent ef71cd43
...@@ -284,6 +284,8 @@ int ethtool_op_set_sg(struct net_device *dev, u32 data); ...@@ -284,6 +284,8 @@ int ethtool_op_set_sg(struct net_device *dev, u32 data);
* set_tx_csum: Turn transmit checksums on or off * set_tx_csum: Turn transmit checksums on or off
* get_sg: Report whether scatter-gather is enabled * get_sg: Report whether scatter-gather is enabled
* set_sg: Turn scatter-gather on or off * set_sg: Turn scatter-gather on or off
* get_tso: Report whether TCP segmentation offload is enabled
* set_tso: Turn TCP segmentation offload on or off
* self_test: Run specified self-tests * self_test: Run specified self-tests
* get_strings: Return a set of strings that describe the requested objects * get_strings: Return a set of strings that describe the requested objects
* phys_id: Identify the device * phys_id: Identify the device
...@@ -337,6 +339,8 @@ struct ethtool_ops { ...@@ -337,6 +339,8 @@ struct ethtool_ops {
int (*set_tx_csum)(struct net_device *, u32); int (*set_tx_csum)(struct net_device *, u32);
u32 (*get_sg)(struct net_device *); u32 (*get_sg)(struct net_device *);
int (*set_sg)(struct net_device *, u32); int (*set_sg)(struct net_device *, u32);
u32 (*get_tso)(struct net_device *);
int (*set_tso)(struct net_device *, u32);
int (*self_test_count)(struct net_device *); int (*self_test_count)(struct net_device *);
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
void (*get_strings)(struct net_device *, u32 stringset, u8 *); void (*get_strings)(struct net_device *, u32 stringset, u8 *);
......
...@@ -454,6 +454,33 @@ static int ethtool_set_sg(struct net_device *dev, char *useraddr) ...@@ -454,6 +454,33 @@ static int ethtool_set_sg(struct net_device *dev, char *useraddr)
return dev->ethtool_ops->set_sg(dev, edata.data); return dev->ethtool_ops->set_sg(dev, edata.data);
} }
static int ethtool_get_tso(struct net_device *dev, char *useraddr)
{
struct ethtool_value edata = { ETHTOOL_GTSO };
if (!dev->ethtool_ops->get_tso)
return -EOPNOTSUPP;
edata.data = dev->ethtool_ops->get_tso(dev);
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
static int ethtool_set_tso(struct net_device *dev, char *useraddr)
{
struct ethtool_value edata;
if (!dev->ethtool_ops->set_tso)
return -EOPNOTSUPP;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
return dev->ethtool_ops->set_tso(dev, edata.data);
}
static int ethtool_self_test(struct net_device *dev, char *useraddr) static int ethtool_self_test(struct net_device *dev, char *useraddr)
{ {
struct ethtool_test test; struct ethtool_test test;
...@@ -653,6 +680,10 @@ int dev_ethtool(struct ifreq *ifr) ...@@ -653,6 +680,10 @@ int dev_ethtool(struct ifreq *ifr)
return ethtool_get_sg(dev, useraddr); return ethtool_get_sg(dev, useraddr);
case ETHTOOL_SSG: case ETHTOOL_SSG:
return ethtool_set_sg(dev, useraddr); return ethtool_set_sg(dev, useraddr);
case ETHTOOL_GTSO:
return ethtool_get_tso(dev, useraddr);
case ETHTOOL_STSO:
return ethtool_set_tso(dev, useraddr);
case ETHTOOL_TEST: case ETHTOOL_TEST:
return ethtool_self_test(dev, useraddr); return ethtool_self_test(dev, useraddr);
case ETHTOOL_GSTRINGS: case ETHTOOL_GSTRINGS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment