Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183999
b: refs/heads/master
c: 15682bc
h: refs/heads/master
i:
  183997: 8dc9b51
  183995: 710eff3
  183991: 6a14445
  183983: 9068592
  183967: a9ae9ce
  183935: 2d0ca5a
v: v3
  • Loading branch information
Peter P Waskiewicz Jr authored and David S. Miller committed Feb 11, 2010
1 parent f9149e9 commit 2968f94
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 2 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: 375c568844e49d292885c7485d4a255f71680e56
refs/heads/master: 15682bc488d4af8c9bb998844a94281025e0a333
50 changes: 50 additions & 0 deletions trunk/include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define _LINUX_ETHTOOL_H

#include <linux/types.h>
#include <linux/rculist.h>

/* This should work for both 32 and 64 bit userland. */
struct ethtool_cmd {
Expand Down Expand Up @@ -242,6 +243,7 @@ enum ethtool_stringset {
ETH_SS_TEST = 0,
ETH_SS_STATS,
ETH_SS_PRIV_FLAGS,
ETH_SS_NTUPLE_FILTERS,
};

/* for passing string sets for data tagging */
Expand Down Expand Up @@ -290,6 +292,7 @@ struct ethtool_perm_addr {
*/
enum ethtool_flags {
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
};

/* The following structures are for supporting RX network flow
Expand Down Expand Up @@ -363,6 +366,35 @@ struct ethtool_rxnfc {
__u32 rule_locs[0];
};

struct ethtool_rx_ntuple_flow_spec {
__u32 flow_type;
union {
struct ethtool_tcpip4_spec tcp_ip4_spec;
struct ethtool_tcpip4_spec udp_ip4_spec;
struct ethtool_tcpip4_spec sctp_ip4_spec;
struct ethtool_ah_espip4_spec ah_ip4_spec;
struct ethtool_ah_espip4_spec esp_ip4_spec;
struct ethtool_rawip4_spec raw_ip4_spec;
struct ethtool_ether_spec ether_spec;
struct ethtool_usrip4_spec usr_ip4_spec;
__u8 hdata[64];
} h_u, m_u; /* entry, mask */

__u16 vlan_tag;
__u16 vlan_tag_mask;
__u64 data; /* user-defined flow spec data */
__u64 data_mask; /* user-defined flow spec mask */

/* signed to distinguish between queue and actions (DROP) */
__s32 action;
#define ETHTOOL_RXNTUPLE_ACTION_DROP -1
};

struct ethtool_rx_ntuple {
__u32 cmd;
struct ethtool_rx_ntuple_flow_spec fs;
};

#define ETHTOOL_FLASH_MAX_FILENAME 128
enum ethtool_flash_op_type {
ETHTOOL_FLASH_ALL_REGIONS = 0,
Expand All @@ -377,6 +409,18 @@ struct ethtool_flash {

#ifdef __KERNEL__

struct ethtool_rx_ntuple_flow_spec_container {
struct ethtool_rx_ntuple_flow_spec fs;
struct list_head list;
};

struct ethtool_rx_ntuple_list {
#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
struct list_head list;
unsigned int count;
};

struct net_device;

/* Some generic methods drivers may use in their ethtool_ops */
Expand All @@ -394,6 +438,7 @@ u32 ethtool_op_get_ufo(struct net_device *dev);
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
u32 ethtool_op_get_flags(struct net_device *dev);
int ethtool_op_set_flags(struct net_device *dev, u32 data);
void ethtool_ntuple_flush(struct net_device *dev);

/**
* &ethtool_ops - Alter and report network device settings
Expand Down Expand Up @@ -500,6 +545,8 @@ struct ethtool_ops {
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
int (*flash_device)(struct net_device *, struct ethtool_flash *);
int (*reset)(struct net_device *, u32 *);
int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *);
int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
};
#endif /* __KERNEL__ */

Expand Down Expand Up @@ -559,6 +606,9 @@ struct ethtool_ops {
#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
#define ETHTOOL_RESET 0x00000034 /* Reset hardware */

#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */

/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
#define SPARC_ETH_SSET ETHTOOL_SSET
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ struct net_device {
#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */

/* Segmentation offload features */
#define NETIF_F_GSO_SHIFT 16
Expand Down Expand Up @@ -954,6 +955,8 @@ struct net_device {
/* max exchange id for FCoE LRO by ddp */
unsigned int fcoe_ddp_xid;
#endif
/* n-tuple filter list attached to this device */
struct ethtool_rx_ntuple_list ethtool_ntuple_list;
};
#define to_net_dev(d) container_of(d, struct net_device, dev)

Expand Down
5 changes: 5 additions & 0 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5419,6 +5419,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,

netdev_init_queues(dev);

INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list);
dev->ethtool_ntuple_list.count = 0;
INIT_LIST_HEAD(&dev->napi_list);
INIT_LIST_HEAD(&dev->unreg_list);
INIT_LIST_HEAD(&dev->link_watch_list);
Expand Down Expand Up @@ -5455,6 +5457,9 @@ void free_netdev(struct net_device *dev)
/* Flush device addresses */
dev_addr_flush(dev);

/* Clear ethtool n-tuple list */
ethtool_ntuple_flush(dev);

list_for_each_entry_safe(p, n, &dev->napi_list, dev_list)
netif_napi_del(p);

Expand Down
Loading

0 comments on commit 2968f94

Please sign in to comment.