Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 279405
b: refs/heads/master
c: 55664f3
h: refs/heads/master
i:
  279403: bcef81c
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Jan 4, 2012
1 parent cd38585 commit 3bdd189
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3a73e49caa75928149ea54f570f8afb5f6f4774d
refs/heads/master: 55664f324c2a1a6386dc88492c5c94aa3d336b93
26 changes: 24 additions & 2 deletions trunk/include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
* on return.
*
* For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
* rules on return.
* rules on return. If @data is non-zero on return then it is the
* size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
* driver supports any special location values. If that flag is not
* set in @data then special location values should not be used.
*
* For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
* existing rule on entry and @fs contains the rule on return.
Expand All @@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
* must use the second parameter to get_rxnfc() instead of @rule_locs.
*
* For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
* @fs.@location specifies the location to use and must not be ignored.
* @fs.@location either specifies the location to use or is a special
* location value with %RX_CLS_LOC_SPECIAL flag set. On return,
* @fs.@location is the actual rule location.
*
* For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
* existing rule on entry.
*
* A driver supporting the special location values for
* %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
* location, and may remove a rule at a later location (lower
* priority) that matches exactly the same set of flows. The special
* values are: %RX_CLS_LOC_ANY, selecting any location;
* %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
* priority); and %RX_CLS_LOC_LAST, selecting the last suitable
* location (minimum priority). Additional special values may be
* defined in future and drivers must return -%EINVAL for any
* unrecognised value.
*/
struct ethtool_rxnfc {
__u32 cmd;
Expand Down Expand Up @@ -1141,6 +1157,12 @@ struct ethtool_ops {

#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL

/* Special RX classification rule insert location values */
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
#define RX_CLS_LOC_ANY 0xffffffff
#define RX_CLS_LOC_FIRST 0xfffffffe
#define RX_CLS_LOC_LAST 0xfffffffd

/* Reset flags */
/* The reset() operation must clear the flags for the components which
* were actually reset. On successful return, the flags indicate the
Expand Down
11 changes: 10 additions & 1 deletion trunk/net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3bdd189

Please sign in to comment.