mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
3a73e49caa
commit
55664f324c
3 changed files with 35 additions and 4 deletions
|
|
@ -439,6 +439,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
|
|||
{
|
||||
struct ethtool_rxnfc info;
|
||||
size_t info_size = sizeof(info);
|
||||
int rc;
|
||||
|
||||
if (!dev->ethtool_ops->set_rxnfc)
|
||||
return -EOPNOTSUPP;
|
||||
|
|
@ -454,7 +455,15 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
|
|||
if (copy_from_user(&info, useraddr, info_size))
|
||||
return -EFAULT;
|
||||
|
||||
return dev->ethtool_ops->set_rxnfc(dev, &info);
|
||||
rc = dev->ethtool_ops->set_rxnfc(dev, &info);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (cmd == ETHTOOL_SRXCLSRLINS &&
|
||||
copy_to_user(useraddr, &info, info_size))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
|
||||
|
|
|
|||
|
|
@ -2758,10 +2758,10 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
|
|||
case ETHTOOL_GRXRINGS:
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
case ETHTOOL_GRXCLSRULE:
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
convert_out = true;
|
||||
/* fall through */
|
||||
case ETHTOOL_SRXCLSRLDEL:
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
buf_size += sizeof(struct ethtool_rxnfc);
|
||||
convert_in = true;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue