Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103203
b: refs/heads/master
c: 0853ad6
h: refs/heads/master
i:
  103201: a72ffa5
  103199: db217cd
v: v3
  • Loading branch information
Santwona Behera authored and David S. Miller committed Jul 2, 2008
1 parent 16c5fe5 commit 436d565
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ecbed6a41900126e7b9509e12a8d0cc22176e3eb
refs/heads/master: 0853ad66b14feb12acde7ac13b7c3b75770a0adc
33 changes: 33 additions & 0 deletions trunk/include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ enum ethtool_flags {
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
};

struct ethtool_rxnfc {
__u32 cmd;
__u32 flow_type;
__u64 data;
};

#ifdef __KERNEL__

struct net_device;
Expand Down Expand Up @@ -396,6 +402,8 @@ struct ethtool_ops {
/* the following hooks are obsolete */
int (*self_test_count)(struct net_device *);/* use get_sset_count */
int (*get_stats_count)(struct net_device *);/* use get_sset_count */
int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *);
int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *);
};
#endif /* __KERNEL__ */

Expand Down Expand Up @@ -442,6 +450,9 @@ struct ethtool_ops {
#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */

#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */

/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
#define SPARC_ETH_SSET ETHTOOL_SSET
Expand Down Expand Up @@ -528,4 +539,26 @@ struct ethtool_ops {
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */

/* L3-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01
#define UDP_V4_FLOW 0x02
#define SCTP_V4_FLOW 0x03
#define AH_ESP_V4_FLOW 0x04
#define TCP_V6_FLOW 0x05
#define UDP_V6_FLOW 0x06
#define SCTP_V6_FLOW 0x07
#define AH_ESP_V6_FLOW 0x08

/* L3-L4 network traffic flow hash options */
#define RXH_DEV_PORT (1 << 0)
#define RXH_L2DA (1 << 1)
#define RXH_VLAN (1 << 2)
#define RXH_L3_PROTO (1 << 3)
#define RXH_IP_SRC (1 << 4)
#define RXH_IP_DST (1 << 5)
#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
#define RXH_DISCARD (1 << 31)


#endif /* _LINUX_ETHTOOL_H */
37 changes: 37 additions & 0 deletions trunk/net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,36 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
return 0;
}

static int ethtool_set_rxhash(struct net_device *dev, void __user *useraddr)
{
struct ethtool_rxnfc cmd;

if (!dev->ethtool_ops->set_rxhash)
return -EOPNOTSUPP;

if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
return -EFAULT;

return dev->ethtool_ops->set_rxhash(dev, &cmd);
}

static int ethtool_get_rxhash(struct net_device *dev, void __user *useraddr)
{
struct ethtool_rxnfc info;

if (!dev->ethtool_ops->get_rxhash)
return -EOPNOTSUPP;

if (copy_from_user(&info, useraddr, sizeof(info)))
return -EFAULT;

dev->ethtool_ops->get_rxhash(dev, &info);

if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}

static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
{
struct ethtool_regs regs;
Expand Down Expand Up @@ -826,6 +856,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_GGSO:
case ETHTOOL_GFLAGS:
case ETHTOOL_GPFLAGS:
case ETHTOOL_GRXFH:
break;
default:
if (!capable(CAP_NET_ADMIN))
Expand Down Expand Up @@ -977,6 +1008,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
rc = ethtool_set_value(dev, useraddr,
dev->ethtool_ops->set_priv_flags);
break;
case ETHTOOL_GRXFH:
rc = ethtool_get_rxhash(dev, useraddr);
break;
case ETHTOOL_SRXFH:
rc = ethtool_set_rxhash(dev, useraddr);
break;
default:
rc = -EOPNOTSUPP;
}
Expand Down

0 comments on commit 436d565

Please sign in to comment.