aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-01-03 07:04:51 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-04 14:09:10 -0500
commit55664f324c2a1a6386dc88492c5c94aa3d336b93 (patch)
treea1859e049a47b3bb207882e4b9db126987f2ead9 /net/core/ethtool.c
parent3a73e49caa75928149ea54f570f8afb5f6f4774d (diff)
ethtool: Allow drivers to select RX NFC rule locations
Define special location values for RX NFC that request the driver to select the actual rule location. This allows for implementation on devices that use hash-based filter lookup, whereas currently the API is more suited to devices with TCAM lookup or linear search. In ethtool_set_rxnfc() and the compat wrapper ethtool_ioctl(), copy the structure back to user-space after insertion so that the actual location is returned. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 597732c989ca..e88b80d41f73 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -439,6 +439,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
439{ 439{
440 struct ethtool_rxnfc info; 440 struct ethtool_rxnfc info;
441 size_t info_size = sizeof(info); 441 size_t info_size = sizeof(info);
442 int rc;
442 443
443 if (!dev->ethtool_ops->set_rxnfc) 444 if (!dev->ethtool_ops->set_rxnfc)
444 return -EOPNOTSUPP; 445 return -EOPNOTSUPP;
@@ -454,7 +455,15 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
454 if (copy_from_user(&info, useraddr, info_size)) 455 if (copy_from_user(&info, useraddr, info_size))
455 return -EFAULT; 456 return -EFAULT;
456 457
457 return dev->ethtool_ops->set_rxnfc(dev, &info); 458 rc = dev->ethtool_ops->set_rxnfc(dev, &info);
459 if (rc)
460 return rc;
461
462 if (cmd == ETHTOOL_SRXCLSRLINS &&
463 copy_to_user(useraddr, &info, info_size))
464 return -EFAULT;
465
466 return 0;
458} 467}
459 468
460static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, 469static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,