ixgbe: Allocate driver resources per NUMA node
Subsystems (3)
PATCH 1/5 ixgbe: Allocate driver resources per NUMA node
From: Jesse Brandeburg <[email protected]>
The default policy for the current driver is to do all its memory allocation on whatever processor is running insmod/modprobe. This is less than optimal.
This driver's default mode of operation will be to use each node for each subsequent transmit/receive queue. The most efficient allocation will be to then have the interrupts bound in such a way as to match up the interrupt of the queue to the cpu where its memory was allocated.
---
drivers/net/ixgbe/ixgbe.h | 2 ++ drivers/net/ixgbe/ixgbe_main.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe.h +2 -0
@@ -379,6 +379,8 @@ struct ixgbe_adapter {u64 rsc_total_flush;u32 wol;u16 eeprom_version; + +int node; };enum ixbge_state_t {
drivers/net/ixgbe/ixgbe_main.c +27 -3
@@ -3741,7 +3741,8 @@ static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) }for (q_idx =0 ; q_idx < num_q_vectors; q_idx++) { - q_vector =kzalloc (sizeof (struct ixgbe_q_vector ),GFP_KERNEL ); + q_vector =kzalloc_node (sizeof (struct ixgbe_q_vector ), +GFP_KERNEL , adapter->node);if (!q_vector) goto err_out; q_vector->adapter = adapter;
@@ -4041,6 +4042,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)/* enable rx csum by default */ adapter->flags |=IXGBE_FLAG_RX_CSUM_ENABLED ; +/* get assigned NUMA node */ + adapter->node =dev_to_node (&pdev->dev); +set_bit (__IXGBE_DOWN, &adapter->state);return 0 ;
@@ -4060,7 +4064,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,int size; size =sizeof (struct ixgbe_tx_buffer ) * tx_ring->count; - tx_ring->tx_buffer_info =vmalloc (size); + tx_ring->tx_buffer_info =vmalloc_node (size, adapter->node);if (!tx_ring->tx_buffer_info) goto err;memset (tx_ring->tx_buffer_info,0 , size);
@@ -4100,8 +4104,15 @@ err:static int ixgbe_setup_all_tx_resources (struct ixgbe_adapter *adapter) {int i, err =0 ; +int orig_node = adapter->node;for (i =0 ; i < adapter->num_tx_queues; i++) { +if (orig_node ==-1 ) { +int cur_node =next_online_node (adapter->node); +if (cur_node ==MAX_NUMNODES ) + cur_node = first_online_node; + adapter->node = cur_node; + } err =ixgbe_setup_tx_resources (adapter, &adapter->tx_ring[i]);if (!err)continue ;
@@ -4109,6 +4120,9 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)break ; } +/* reset the node back to its starting value */ + adapter->node = orig_node; +return err; }
@@ -4126,7 +4140,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,int size; size =sizeof (struct ixgbe_rx_buffer ) * rx_ring->count; - rx_ring->rx_buffer_info =vmalloc (size); + rx_ring->rx_buffer_info =vmalloc_node (size, adapter->node);if (!rx_ring->rx_buffer_info) {DPRINTK (PROBE ,ERR ,"vmalloc allocation failed for the rx desc ring\n" );
@@ -4170,8 +4184,15 @@ alloc_failed:static int ixgbe_setup_all_rx_resources (struct ixgbe_adapter *adapter) {int i, err =0 ; +int orig_node = adapter->node;for (i =0 ; i < adapter->num_rx_queues; i++) { +if (orig_node ==-1 ) { +int cur_node =next_online_node (adapter->node); +if (cur_node ==MAX_NUMNODES ) + cur_node = first_online_node; + adapter->node = cur_node; + } err =ixgbe_setup_rx_resources (adapter, &adapter->rx_ring[i]);if (!err)continue ;
@@ -4179,6 +4200,9 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)break ; } +/* reset the node back to its starting value */ + adapter->node = orig_node; +return err; }
PATCH 2/5 ixgbe: Make descriptor ring allocations NUMA-aware
From: PJ Waskiewicz <[email protected]>
This patch allocates the ring structures themselves on each NUMA node along with the buffer_info structures. This way we don't allocate the entire ring memory on a single node in one big block, thus reducing NUMA node memory crosstalk.
---
drivers/net/ixgbe/ixgbe.h | 7 + drivers/net/ixgbe/ixgbe_ethtool.c | 71 +++++----- drivers/net/ixgbe/ixgbe_fcoe.c | 4 - drivers/net/ixgbe/ixgbe_main.c | 270 +++++++++++++++++++------------------ 4 files changed, 185 insertions(+), 167 deletions(-)
drivers/net/ixgbe/ixgbe.h +4 -3
@@ -147,7 +147,7 @@ struct ixgbe_ring {#ifdef CONFIG_IXGBE_DCA /* cpu for tx queue */ -int cpu; +u8 cpu;#endif u16 work_limit;/* max work per interrupt */
@@ -156,6 +156,7 @@ struct ixgbe_ring {* associated with this ring, which is * different for DCB and RSS modes */ +u8 numa_node;struct ixgbe_queue_stats stats;unsigned long reinit_state;
@@ -277,7 +278,7 @@ struct ixgbe_adapter {u16 eitr_high;/* TX */ -struct ixgbe_ring *tx_ring____cacheline_aligned_in_smp ;/* One per active queue */ +struct ixgbe_ring *tx_ring[MAX_TX_QUEUES ]____cacheline_aligned_in_smp ;int num_tx_queues;u32 tx_timeout_count;bool detect_tx_hung;
@@ -286,7 +287,7 @@ struct ixgbe_adapter {u64 lsc_int;/* RX */ -struct ixgbe_ring *rx_ring____cacheline_aligned_in_smp ;/* One per active queue */ +struct ixgbe_ring *rx_ring[MAX_RX_QUEUES ]____cacheline_aligned_in_smp ;int num_rx_queues;u64 hw_csum_rx_error;u64 hw_rx_no_dma_resources;
drivers/net/ixgbe/ixgbe_ethtool.c +38 -33
163 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_fcoe.c +2 -2
@@ -525,7 +525,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)for (i =0 ; i <IXGBE_FCRETA_SIZE ; i++) { fcoe_i = f->mask + i % f->indices; fcoe_i &=IXGBE_FCRETA_ENTRY_MASK ; - fcoe_q = adapter->rx_ring[fcoe_i].reg_idx; + fcoe_q = adapter->rx_ring[fcoe_i]->reg_idx;IXGBE_WRITE_REG (hw,IXGBE_FCRETA (i), fcoe_q); }IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,IXGBE_FCRECTL_ENA );
@@ -533,7 +533,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) }else {/* Use single rx queue for FCoE */ fcoe_i = f->mask; - fcoe_q = adapter->rx_ring[fcoe_i].reg_idx; + fcoe_q = adapter->rx_ring[fcoe_i]->reg_idx;IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,0 ); IXGBE_WRITE_REG(hw, IXGBE_ETQS(IXGBE_ETQF_FILTER_FCOE), IXGBE_ETQS_QUEUE_EN |
drivers/net/ixgbe/ixgbe_main.c +141 -129
675 lines not on this page · raw message
David Miller
maintainerRe: [net-next-2.6 PATCH 2/5] ixgbe: Make descriptor ring allocations NUMA-aware
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:48:46 -0800
drivers/net/ixgbe/ixgbe.h struct ixgbe_ring { · line 153
Quoted 9 lines
drivers/net/ixgbe/ixgbe.h +1
-1@@ -147,7 +147,7 @@ struct ixgbe_ring {#ifdef CONFIG_IXGBE_DCA /* cpu for tx queue */ -int cpu; +u8 cpu;#endif u16 work_limit;/* max work per interrupt */
Is truncating cpu and node numbers to 8-bits ok? I really don't see how it can be fine, even for DCA.
This is especially the case since dca3_get_tag() and the DCA ->get_tag() callback explicitly take an 'int' argument too.
Re: [net-next-2.6 PATCH 2/5] ixgbe: Make descriptor ring allocations NUMA-aware
Quoted 11 lines · David Miller
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:48:46 -0800Quoted 8 lines
drivers/net/ixgbe/ixgbe.h +1
-1@@ -147,7 +147,7 @@ struct ixgbe_ring {#ifdef CONFIG_IXGBE_DCA /* cpu for tx queue */ -int cpu; +u8 cpu;#endif
Quoted 4 lines
drivers/net/ixgbe/ixgbe.h struct ixgbe_ring { · line 153
Quoted 1 line
drivers/net/ixgbe/ixgbe.h +0
-0u16 work_limit;/* max work per interrupt */ Is truncating cpu and node numbers to 8-bits ok? I really don't see how it can be fine, even for DCA.
In our hardware (82598 and 82599), the CPU field in the DCA registers is 8 bits.
The reason I truncated this was to fit these values into the first cacheline of the struct. I also didn't figure we'd see a system that would have 255 NUMA nodes before 10 GbE was something that was on the shelf collecting dust. :-)
Quoted 3 lines
This is especially the case since
dca3_get_tag()and the DCA ->get_tag() callback explicitly take an 'int' argument too.
Cheers,
-PJ
David Miller
maintainerRe: [net-next-2.6 PATCH 2/5] ixgbe: Make descriptor ring allocations NUMA-aware
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:25:26 -0800 (Pacific Standard Time)
Quoted 7 lines
In our hardware (82598 and 82599), the CPU field in the DCA registers is 8 bits.
The reason I truncated this was to fit these values into the first cacheline of the struct. I also didn't figure we'd see a system that would have 255 NUMA nodes before 10 GbE was something that was on the shelf collecting dust. :-)
The X86 port supports 9 for "NODES_SHIFT", and up to 4096 cpus.
Even when !MAXSMP, the cpu limit is 512.
Don't make the type ungeneric just because some current piece of hardware has that limitation. This is how subtle bugs slip into the tree, and it makes auditing for such bugs a nightmare.
Thanks.
Re: [net-next-2.6 PATCH 2/5] ixgbe: Make descriptor ring allocations NUMA-aware
Quoted 13 lines · David Miller
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:25:26 -0800 (Pacific Standard Time)Quoted 7 lines
In our hardware (82598 and 82599), the CPU field in the DCA registers is 8 bits.
The reason I truncated this was to fit these values into the first cacheline of the struct. I also didn't figure we'd see a system that would have 255 NUMA nodes before 10 GbE was something that was on the shelf collecting dust. :-)
The X86 port supports 9 for "
NODES_SHIFT", and up to 4096 cpus.
Quoted 7 lines
Even when !MAXSMP, the cpu limit is 512.
Don't make the type ungeneric just because some current piece of hardware has that limitation. This is how subtle bugs slip into the tree, and it makes auditing for such bugs a nightmare.
Thanks.
Understood. Let me see if I can shuffle things around in the struct to keep my cacheline packed, and not screw with the data type sizes. I'll respin and have Jeff push a new patch once I get it sorted out.
Thanks for the review Dave,
-PJ
PATCH 3/5 ethtool: Introduce n-tuple filter programming support
In reply to Jeff KirsherFrom: PJ Waskiewicz <[email protected]>
This patchset enables the ethtool layer to program n-tuple filters to an underlying device. The idea is to allow capable hardware to have static rules applied that can assist steering flows into appropriate queues.
Hardware that is known to support these types of filters today are ixgbe and niu.
---
include/linux/ethtool.h | 34 ++++++++++++++++++++++++++++++++++ net/core/ethtool.c | 16 ++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-)
include/linux/ethtool.h +34 -0
@@ -363,6 +363,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 128enum ethtool_flash_op_type {ETHTOOL_FLASH_ALL_REGIONS =0 ,
@@ -500,6 +529,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 *, struct ethtool_rx_ntuple *, void *); };#endif /* __KERNEL__ */
@@ -559,6 +590,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
net/core/ethtool.c +16 -0
@@ -266,6 +266,19 @@ err_out:return ret; } +static int ethtool_set_rx_ntuple (struct net_device *dev,void __user *useraddr) +{ +struct ethtool_rx_ntuple cmd; + +if (!dev->ethtool_ops->set_rx_ntuple) +return -EOPNOTSUPP ; + +if (copy_from_user (&cmd, useraddr,sizeof (cmd))) +return -EFAULT ; + +return dev->ethtool_ops->set_rx_ntuple (dev, &cmd); +} +static int ethtool_get_regs (struct net_device *dev,char __user *useraddr) {struct ethtool_regs regs;
@@ -1112,6 +1125,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)case ETHTOOL_RESET : rc =ethtool_reset (dev, useraddr);break ; +case ETHTOOL_SRXNTUPLE : + rc =ethtool_set_rx_ntuple (dev, useraddr); +break ;default : rc = -EOPNOTSUPP ; }
David Miller
maintainerRe: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:49:06 -0800
Quoted 10 lines
include/linux/ethtool.h +2
-0@@ -500,6 +529,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 *, struct ethtool_rx_ntuple *, void *); };#endif /* __KERNEL__ */
include/linux/ethtool.h struct ethtool_ops { · line 595
Quoted 6 lines
include/linux/ethtool.h +3
-0@@ -559,6 +590,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 */ +
Command value ETHTOOL_GRXNTUPLE and the ethtool_ops callback ->get_rx_ntuple() for it are declared, but I see no implementation added to net/core/ethtool.c
Re: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
Quoted 16 lines · David Miller
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:49:06 -0800Quoted 13 lines
include/linux/ethtool.h +2
-0@@ -500,6 +529,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 *, struct ethtool_rx_ntuple *, void *); };#endif /* __KERNEL__ */ @@ -559,6 +590,9 @@ struct ethtool_ops {#define ETHTOOL_FLASHDEV 0x00000033/* Flash firmware to device */ #define ETHTOOL_RESET 0x00000034/* Reset hardware */
Quoted 7 lines
include/linux/ethtool.h struct ethtool_ops { · line 595
Quoted 3 lines
include/linux/ethtool.h +3
-0+#define ETHTOOL_SRXNTUPLE 0x00000035/* Add an n-tuple filter to device */ +#define ETHTOOL_GRXNTUPLE 0x00000036/* Get n-tuple filters from device */ +Command value
ETHTOOL_GRXNTUPLEand theethtool_opscallback ->get_rx_ntuple() for it are declared, but I see no implementation added tonet/core/ethtool.c
Yes, I left that in there somewhat accidentally. I had every intention in putting a get routine in, but I couldn't come up with a generic way to work with most hardware (how to get all filters back and dump them). The 82599 needs to query the hardware for each filter currently programmed, and I'm not sure what the niu hardware layout is for the filters.
I can remove the get stubs for now, since I have no good solution to dump the filters that is generic.
Thanks,
-PJ
David Miller
maintainerRe: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:34:23 -0800 (Pacific Standard Time)
Quoted 5 lines
Yes, I left that in there somewhat accidentally. I had every intention in putting a get routine in, but I couldn't come up with a generic way to work with most hardware (how to get all filters back and dump them). The 82599 needs to query the hardware for each filter currently programmed, and I'm not sure what the niu hardware layout is for the filters.
NIU simply has a TCAM array that you can read the values back from.
Quoted 2 lines
I can remove the get stubs for now, since I have no good solution to dump the filters that is generic.
For hardware where it's difficult to read the values back, you can maintain a copy of the current filters in software.
Just an idea. If you need you'll need something like this for multiple drivers already, probably we can put the helper code into ethtool.c and just maintain a software copy in the kernel for all devices. Even one's for which fetching is straightforward.
And anyways, I can't see this being a usable interface if the current set of filters can't be queried by the user.
Re: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
Quoted 10 lines · David Miller
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:34:23 -0800 (Pacific Standard Time)Quoted 5 lines
Yes, I left that in there somewhat accidentally. I had every intention in putting a get routine in, but I couldn't come up with a generic way to work with most hardware (how to get all filters back and dump them). The 82599 needs to query the hardware for each filter currently programmed, and I'm not sure what the niu hardware layout is for the filters.
NIU simply has a TCAM array that you can read the values back from.
I wish we had that in our hardware. :-)
Quoted 11 lines
Quoted 3 lines
I can remove the get stubs for now, since I have no good solution to dump the filters that is generic.
For hardware where it's difficult to read the values back, you can maintain a copy of the current filters in software.
Just an idea. If you need you'll need something like this for multiple drivers already, probably we can put the helper code into
ethtool.cand just maintain a software copy in the kernel for all devices. Even one's for which fetching is straightforward.
It's a good idea. I'll go with that.
Quoted 2 lines
And anyways, I can't see this being a usable interface if the current set of filters can't be queried by the user.
I can agree with that. Thinking of user applications written to maintain these filters, it'd be nice to have a way to populate a View tab or something.
I'll implement the get portion and resend.
Thanks Dave for the inputs,
-PJ
Re: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
In reply to Jeff KirsherQuoted 6 lines · Jeff Kirsher
From: PJ Waskiewicz <[email protected]>
This patchset enables the ethtool layer to program n-tuple filters to an underlying device. The idea is to allow capable hardware to have static rules applied that can assist steering flows into appropriate queues.
[...]
include/linux/ethtool.h struct ethtool_ops { · line 536
Quoted 9 lines
include/linux/ethtool.h +2
-0@@ -500,6 +529,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 *, struct ethtool_rx_ntuple *, void *); };#endif /* __KERNEL__ */
[...]
It it really necessary to add new driver operations? It seems to me that it would be preferable to extend {get,set}_rx_nfc() and have the ethtool common code convert between the ethtool_rxnfc and ethtool_rx_ntuple structures. Does that seem possible?
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
RE: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
Quoted 29 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Monday, January 11, 2010 11:33 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; [email protected]; Waskiewicz Jr, Peter P; Luca Deri; Gasparakis, Joseph
Subject: Re: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming supportQuoted 6 lines · Jeff Kirsher
From: PJ Waskiewicz <[email protected]>
This patchset enables the ethtool layer to program n-tuple filters to an underlying device. The idea is to allow capable hardware to have static rules applied that can assist steering flows into appropriate queues.
[...]
Review struct ethtool_ops { · line 530
Quoted 3 lines
(quoted diff) +0
-0@@ -500,6 +529,8 @@ struct ethtool_ops { int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); int (*flash_device)(struct net_device *, struct ethtool_flash*);
Review struct ethtool_ops { · line 532
Quoted 2 lines
(quoted diff) +1
-0int (*reset)(struct net_device *, u32 *); + int (*set_rx_ntuple)(struct net_device *, struct
ethtool_rx_ntuple*);Review struct ethtool_ops { · line 533
Quoted 1 line
(quoted diff) +1
-0+ int (*get_rx_ntuple)(struct net_device *, struct
ethtool_rx_ntuple*, void *);include/linux/ethtool.h struct ethtool_ops { · line 536
Quoted 3 lines
include/linux/ethtool.h +0
-0};#endif /* __KERNEL__ */
Quoted 7 lines
[...]
It it really necessary to add new driver operations? It seems to me that it would be preferable to extend {get,set}_rx_nfc() and have the ethtool common code convert between the
ethtool_rxnfcandethtool_rx_ntuplestructures. Does that seem possible?
It is possible, but I'm not sure if it's the right way to go. The nfc routines are just flipping the various engines on in niu, where the ntuple routines are for passing full amounts of data through for different filters. Also, I think keeping them separate makes niu programming cleaner, which can support both the nfc and ntuple modes.
Cheers,
-PJ
David Miller
maintainerRe: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming support
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Tue, 12 Jan 2010 11:13:54 -0800
Quoted 15 lines
Quoted 9 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Monday, January 11, 2010 11:33 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; [email protected]; Waskiewicz Jr, Peter P; Luca Deri; Gasparakis, Joseph
Subject: Re: [net-next-2.6 PATCH 3/5] ethtool: Introduce n-tuple filter programming supportQuoted 5 lines
It it really necessary to add new driver operations? It seems to me that it would be preferable to extend {get,set}_rx_nfc() and have the ethtool common code convert between the
ethtool_rxnfcandethtool_rx_ntuplestructures. Does that seem possible?
Quoted 6 lines
It is possible, but I'm not sure if it's the right way to go. The nfc routines are just flipping the various engines on in niu, where the ntuple routines are for passing full amounts of data through for different filters. Also, I think keeping them separate makes niu programming cleaner, which can support both the nfc and ntuple modes.
Agreed.
PATCH 4/5 ixgbe: Add Flow Director configuration support as a mod parameter
In reply to Jeff KirsherFrom: PJ Waskiewicz <[email protected]>
This patch adds the ability to change the Flow Director behavior in ixgbe through a module parameter. ixgbe, on 82599 hardware, can support hash-based or perfect-based filtering. It currently uses hash-based, and should have a knob to enable perfect-based filtering.
This will be used in conjunction with the ethtool n-tuple filter programming support.
---
drivers/net/ixgbe/ixgbe_main.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +14 -2
@@ -124,6 +124,11 @@ static struct notifier_block dca_notifier = { };#endif +static unsigned int fdir_filter_mode; +module_param (fdir_filter_mode, uint,0 ); +MODULE_PARM_DESC (fdir_filter_mode,"Flow Director filtering mode: 0 - hash, " +"1 - perfect" ); +MODULE_AUTHOR ("Intel Corporation, <[email protected]>" );MODULE_DESCRIPTION ("Intel(R) 10 Gigabit PCI Express Network Driver" );MODULE_LICENSE ("GPL" );
@@ -4002,10 +4007,17 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->max_msix_q_vectors =MAX_MSIX_Q_VECTORS_82599 ; adapter->flags2 |=IXGBE_FLAG2_RSC_CAPABLE ; adapter->flags2 |=IXGBE_FLAG2_RSC_ENABLED ; - adapter->flags |=IXGBE_FLAG_FDIR_HASH_CAPABLE ; + +if (fdir_filter_mode ==0 ) { + adapter->flags |=IXGBE_FLAG_FDIR_HASH_CAPABLE ; + adapter->atr_sample_rate =20 ; + }else { + adapter->flags |=IXGBE_FLAG_FDIR_PERFECT_CAPABLE ; +spin_lock_init (&adapter->fdir_perfect_lock); + } + adapter->ring_feature[RING_F_FDIR ].indices =IXGBE_MAX_FDIR_INDICES ; - adapter->atr_sample_rate =20 ; adapter->fdir_pballoc =0 ;#ifdef IXGBE_FCOE adapter->flags |=IXGBE_FLAG_FCOE_CAPABLE ;
David Miller
maintainerRe: [net-next-2.6 PATCH 4/5] ixgbe: Add Flow Director configuration support as a mod parameter
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:49:29 -0800
Quoted 7 lines
From: PJ Waskiewicz <[email protected]>
This patch adds the ability to change the Flow Director behavior in ixgbe through a module parameter. ixgbe, on 82599 hardware, can support hash-based or perfect-based filtering. It currently uses hash-based, and should have a knob to enable perfect-based filtering.
Quoted 5 lines
This will be used in conjunction with the ethtool n-tuple filter programming support.
Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Use a generic ethtool boolean flag or similar, not "yet another different-in-every-driver" module parameter please.
Re: [net-next-2.6 PATCH 4/5] ixgbe: Add Flow Director configuration support as a mod parameter
Quoted 10 lines · David Miller
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:49:29 -0800Quoted 7 lines
From: PJ Waskiewicz <[email protected]>
This patch adds the ability to change the Flow Director behavior in ixgbe through a module parameter. ixgbe, on 82599 hardware, can support hash-based or perfect-based filtering. It currently uses hash-based, and should have a knob to enable perfect-based filtering.
Quoted 8 lines
Quoted 5 lines
This will be used in conjunction with the ethtool n-tuple filter programming support.
Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>Use a generic ethtool boolean flag or similar, not "yet another different-in-every-driver" module parameter please.
Something added to the setflags routine perhaps?
-PJ
David Miller
maintainerRe: [net-next-2.6 PATCH 4/5] ixgbe: Add Flow Director configuration support as a mod parameter
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:28:17 -0800 (Pacific Standard Time)
Quoted 6 lines · David Miller
Quoted 3 lines
Use a generic ethtool boolean flag or similar, not "yet another different-in-every-driver" module parameter please.
Something added to the setflags routine perhaps?
Yeah, something via 'struct ethtool_flags' is probably appropriate.
Re: [net-next-2.6 PATCH 4/5] ixgbe: Add Flow Director configuration support as a mod parameter
Quoted 11 lines · David Miller
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Fri, 8 Jan 2010 00:28:17 -0800 (Pacific Standard Time)Quoted 6 lines · David Miller
Quoted 3 lines
Use a generic ethtool boolean flag or similar, not "yet another different-in-every-driver" module parameter please.
Something added to the setflags routine perhaps?
Yeah, something via 'struct
ethtool_flags' is probably appropriate.
Cool. I'll respin and get rid of the module parameter.
Thanks for the review,
-PJ
PATCH 5/5 ixgbe: Add support for the new ethtool n-tuple programming interface
In reply to Jeff KirsherFrom: PJ Waskiewicz <[email protected]>
This patch adds n-tuple filter programming to 82599.
---
drivers/net/ixgbe/ixgbe.h | 4 + drivers/net/ixgbe/ixgbe_82599.c | 106 ++++++++++++++++++++++++++++++++----- drivers/net/ixgbe/ixgbe_ethtool.c | 81 ++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_type.h | 9 +++ 4 files changed, 187 insertions(+), 13 deletions(-)
drivers/net/ixgbe/ixgbe.h +4 -0
@@ -429,6 +429,10 @@ extern s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc);extern s32 ixgbe_fdir_add_signature_filter_82599 (struct ixgbe_hw *hw,struct ixgbe_atr_input *input,u8 queue); +extern s32 ixgbe_fdir_add_perfect_filter_82599 (struct ixgbe_hw *hw, +struct ixgbe_atr_input *input, +struct ixgbe_atr_input_masks *input_masks, +u16 soft_id,u8 queue);extern s32 ixgbe_atr_set_vlan_id_82599 (struct ixgbe_atr_input *input,u16 vlan_id); extern s32 ixgbe_atr_set_src_ipv4_82599(struct ixgbe_atr_input *input,
drivers/net/ixgbe/ixgbe_82599.c +93 -13
197 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethtool.c +81 -0
93 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_type.h +9 -0
@@ -2109,6 +2109,15 @@ struct ixgbe_atr_input {u8 byte_stream[42 ]; }; +struct ixgbe_atr_input_masks { +u32 src_ip_mask; +u32 dst_ip_mask; +u16 src_port_mask; +u16 dst_port_mask; +u16 vlan_id_mask; +u16 data_mask; +}; +enum ixgbe_eeprom_type { ixgbe_eeprom_uninitialized =0 , ixgbe_eeprom_spi,
David Miller
maintainerRe: [net-next-2.6 PATCH 5/5] ixgbe: Add support for the new ethtool n-tuple programming interface
From: Jeff Kirsher <[email protected]>
Date: Wed, 06 Jan 2010 20:49:53 -0800
drivers/net/ixgbe/ixgbe_ethtool.c static int ixgbe_set_flags(struct net_device *netdev, u32 data) · line 2180
Quoted 8 lines
drivers/net/ixgbe/ixgbe_ethtool.c +8
-0+/* +* Don't allow programming if we're not in perfect filter mode, or +* if the action is a queue greater than the number of online Tx +* queues. +*/ +if ((!(adapter->flags &IXGBE_FLAG_FDIR_PERFECT_CAPABLE )) || + (fs.action >= adapter->num_tx_queues)) +return -EINVAL ;
This is yet another argument for making the perfect filter mode control an ethtool setting, why should the user have to reload the module just to get that boolean setting fixed up when they want to load filters?
drivers/net/ixgbe/ixgbe_main.c static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) · line 3745
Quoted 12 lines · Jeff Kirsher
enum
ixbge_state_t{drivers/net/ixgbe/ixgbe_main.c +2
-1@@ -3741,7 +3741,8 @@ static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) }for (q_idx =0 ; q_idx < num_q_vectors; q_idx++) { - q_vector =kzalloc (sizeof (struct ixgbe_q_vector ),GFP_KERNEL ); + q_vector =kzalloc_node (sizeof (struct ixgbe_q_vector ), +GFP_KERNEL , adapter->node);
The problem of doing this is that the node might be full or have no memory and k*alloc_node will fail then.
So you would need a fallback to be reliable (we probably should have a generic utility function for this somewhere, but we don't currently)
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 30 lines
-----Original Message-----
From: Andi Kleen [mailto:[email protected]]
Sent: Thursday, January 14, 2010 3:02 AM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; [email protected]; Waskiewicz Jr, Peter P
Subject: Re: [net-next-2.6 PATCH 1/5] ixgbe: Allocate driver resources per NUMA nodeReview
Quoted 2 lines · Jeff Kirsher
enum
ixbge_state_t{(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_main.cdrivers/net/ixgbe/ixgbe_main.c static int ixgbe_alloc_q_vectors(struct
Quoted 4 lines
index 2ad754c..6895de7 100644
drivers/net/ixgbe/ixgbe_main.c +0
-0@@ -3741,7 +3741,8 @@ static int ixgbe_alloc_q_vectors(struct
ixgbe_adapter*adapter)drivers/net/ixgbe/ixgbe_main.c static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter)
Quoted 4 lines
drivers/net/ixgbe/ixgbe_main.c +0
-1}for (q_idx =0 ; q_idx < num_q_vectors; q_idx++) { - q_vector = kzalloc(sizeof(struct ixgbe_q_vector),
GFP_KERNEL);drivers/net/ixgbe/ixgbe_main.c static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) · line 3745
Quoted 2 lines
drivers/net/ixgbe/ixgbe_main.c +2
-0+ q_vector =kzalloc_node (sizeof (struct ixgbe_q_vector ), +GFP_KERNEL , adapter->node);The problem of doing this is that the node might be full or have no memory and k*alloc_node will fail then.
Quoted 2 lines
So you would need a fallback to be reliable (we probably should have a generic utility function for this somewhere, but we don't currently)
So you'd rather see us call kzalloc() if kzalloc_node() fails, instead of immediately failing out to err_out?
Thanks,
-PJ
Quoted 7 lines
Quoted 5 lines
The problem of doing this is that the node might be full or have no memory and k*alloc_node will fail then.
So you would need a fallback to be reliable (we probably should have a generic utility function for this somewhere, but we don't currently)
So you'd rather see us call
kzalloc()ifkzalloc_node()fails, instead of immediately failing out toerr_out?
Yes.
After all it's only an optimization to place memory, it's not a functional requirement.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 17 lines
-----Original Message-----
From: Andi Kleen [mailto:[email protected]]
Sent: Tuesday, January 19, 2010 11:34 AM
To: Waskiewicz Jr, Peter P
Cc: Andi Kleen; Kirsher, Jeffrey T; [email protected]; [email protected]; [email protected]
Subject: Re: [net-next-2.6 PATCH 1/5] ixgbe: Allocate driver resources per NUMA nodeQuoted 4 lines
Quoted 4 lines
The problem of doing this is that the node might be full or have no memory and k*alloc_node will fail then.
So you would need a fallback to be reliable (we probably should have
a
Quoted 3 lines
Quoted 1 line
generic utility function for this somewhere, but we don't currently)
So you'd rather see us call
kzalloc()ifkzalloc_node()fails, instead
Quoted 9 lines
of immediately failing out to
err_out?Yes.
After all it's only an optimization to place memory, it's not a functional requirement.
-Andi
Makes sense. I have the change in my local tree and will push new patches through Jeff shortly.
Thanks Andi,
-PJ