From bea3348eef27e6044b6161fd04c3152215f96411 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 3 Oct 2007 16:41:36 -0700 Subject: [NET]: Make NAPI polling independent of struct net_device objects. Several devices have multiple independant RX queues per net device, and some have a single interrupt doorbell for several queues. In either case, it's easier to support layouts like that if the structure representing the poll is independant from the net device itself. The signature of the ->poll() call back goes from: int foo_poll(struct net_device *dev, int *budget) to int foo_poll(struct napi_struct *napi, int budget) The caller is returned the number of RX packets processed (or the number of "NAPI credits" consumed if you want to get abstract). The callee no longer messes around bumping dev->quota, *budget, etc. because that is all handled in the caller upon return. The napi_struct is to be embedded in the device driver private data structures. Furthermore, it is the driver's responsibility to disable all NAPI instances in it's ->stop() device close handler. Since the napi_struct is privatized into the driver's private data structures, only the driver knows how to get at all of the napi_struct instances it may have per-device. With lots of help and suggestions from Rusty Russell, Roland Dreier, Michael Chan, Jeff Garzik, and Jamal Hadi Salim. Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra, Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan. [ Ported to current tree and all drivers converted. Integrated Stephen's follow-on kerneldoc additions, and restored poll_list handling to the old style to fix mutual exclusion issues. -DaveM ] Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- drivers/net/ibmveth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ibmveth.h') diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index 72cc15a6cab..e05694126f8 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h @@ -112,6 +112,7 @@ struct ibmveth_rx_q { struct ibmveth_adapter { struct vio_dev *vdev; struct net_device *netdev; + struct napi_struct napi; struct net_device_stats stats; unsigned int mcastFilterSize; unsigned long mac_addr; -- cgit v1.2.3 From f4ff28720f45354573dcf4e0eb5a2dc5452cb3e1 Mon Sep 17 00:00:00 2001 From: Brian King Date: Sat, 15 Sep 2007 13:36:07 -0700 Subject: ibmveth: Enable TCP checksum offload This patchset enables TCP checksum offload support for IPV4 on ibmveth. This completely eliminates the generation and checking of the checksum for packets that are completely virtual and never touch a physical network. A simple TCP_STREAM netperf run on a virtual network with maximum mtu set yielded a ~30% increase in throughput. This feature is enabled by default on systems that support it, but can be disabled with a module option. Signed-off-by: Brian King Signed-off-by: Jeff Garzik Signed-off-by: David S. Miller --- drivers/net/ibmveth.h | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'drivers/net/ibmveth.h') diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index e05694126f8..3f10f0f4447 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h @@ -67,6 +67,21 @@ static inline long h_send_logical_lan(unsigned long unit_address, return rc; } +static inline long h_illan_attributes(unsigned long unit_address, + unsigned long reset_mask, unsigned long set_mask, + unsigned long *ret_attributes) +{ + long rc; + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; + + rc = plpar_hcall(H_ILLAN_ATTRIBUTES, retbuf, unit_address, + reset_mask, set_mask); + + *ret_attributes = retbuf[0]; + + return rc; +} + #define h_multicast_ctrl(ua, cmd, mac) \ plpar_hcall_norets(H_MULTICAST_CTRL, ua, cmd, mac) @@ -142,7 +157,9 @@ struct ibmveth_adapter { struct ibmveth_buf_desc_fields { u32 valid : 1; u32 toggle : 1; - u32 reserved : 6; + u32 reserved : 4; + u32 no_csum : 1; + u32 csum_good : 1; u32 length : 24; u32 address; }; @@ -152,10 +169,30 @@ union ibmveth_buf_desc { struct ibmveth_buf_desc_fields fields; }; +struct ibmveth_illan_attributes_fields { + u32 reserved; + u32 reserved2 : 18; + u32 csum_offload_padded_pkt_support : 1; + u32 reserved3 : 1; + u32 trunk_priority : 4; + u32 reserved4 : 5; + u32 tcp_csum_offload_ipv6 : 1; + u32 tcp_csum_offload_ipv4 : 1; + u32 active_trunk : 1; +}; + +union ibmveth_illan_attributes { + u64 desc; + struct ibmveth_illan_attributes_fields fields; +}; + struct ibmveth_rx_q_entry { u16 toggle : 1; u16 valid : 1; - u16 reserved : 14; + u16 reserved : 4; + u16 no_csum : 1; + u16 csum_good : 1; + u16 reserved2 : 8; u16 offset; u32 length; u64 correlator; -- cgit v1.2.3 From 5fc7e01cb77132f96e171a37f9f792270b1603f6 Mon Sep 17 00:00:00 2001 From: Brian King Date: Fri, 17 Aug 2007 09:16:31 -0500 Subject: ibmveth: Implement ethtool hooks to enable/disable checksum offload This patch adds the appropriate ethtool hooks to allow for enabling/disabling of hypervisor assisted checksum offload for TCP. Signed-off-by: Brian King Signed-off-by: Jeff Garzik --- drivers/net/ibmveth.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ibmveth.h') diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index 3f10f0f4447..43b068d9a55 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h @@ -138,6 +138,7 @@ struct ibmveth_adapter { struct ibmveth_buff_pool rx_buff_pool[IbmVethNumBufferPools]; struct ibmveth_rx_q rx_queue; int pool_config; + int rx_csum; /* adapter specific stats */ u64 replenish_task_cycles; -- cgit v1.2.3 From 3449a2ab31681420515e242920e755262b4f41e9 Mon Sep 17 00:00:00 2001 From: Brian King Date: Fri, 17 Aug 2007 09:16:49 -0500 Subject: ibmveth: Remove dead frag processing code Removes dead frag processing code from ibmveth. Since NETIF_F_SG was not set, this code was never executed. Also, since the ibmveth interface can only handle 6 fragments, core networking code would need to be modified in order to efficiently enable this support. Signed-off-by: Brian King Signed-off-by: Jeff Garzik --- drivers/net/ibmveth.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/net/ibmveth.h') diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index 43b068d9a55..30f9fc67b0c 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h @@ -25,8 +25,6 @@ #ifndef _IBMVETH_H #define _IBMVETH_H -#define IbmVethMaxSendFrags 6 - /* constants for H_MULTICAST_CTRL */ #define IbmVethMcastReceptionModifyBit 0x80000UL #define IbmVethMcastReceptionEnableBit 0x20000UL @@ -147,9 +145,6 @@ struct ibmveth_adapter { u64 replenish_add_buff_success; u64 rx_invalid_buffer; u64 rx_no_buffer; - u64 tx_multidesc_send; - u64 tx_linearized; - u64 tx_linearize_failed; u64 tx_map_failed; u64 tx_send_failed; spinlock_t stats_lock; -- cgit v1.2.3 From 79ef4a4dd44cd4f9942975b0f625bd01549a2aa9 Mon Sep 17 00:00:00 2001 From: Brian King Date: Fri, 17 Aug 2007 09:16:56 -0500 Subject: ibmveth: Remove use of bitfields Removes the use of bitfields from the ibmveth driver. This results in slightly smaller object code. Signed-off-by: Brian King Signed-off-by: Jeff Garzik --- drivers/net/ibmveth.h | 56 +++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 33 deletions(-) (limited to 'drivers/net/ibmveth.h') diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index 30f9fc67b0c..41f61cd1885 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h @@ -39,6 +39,12 @@ #define IbmVethMcastRemoveFilter 0x2UL #define IbmVethMcastClearFilterTable 0x3UL +#define IBMVETH_ILLAN_PADDED_PKT_CSUM 0x0000000000002000ULL +#define IBMVETH_ILLAN_TRUNK_PRI_MASK 0x0000000000000F00ULL +#define IBMVETH_ILLAN_IPV6_TCP_CSUM 0x0000000000000004ULL +#define IBMVETH_ILLAN_IPV4_TCP_CSUM 0x0000000000000002ULL +#define IBMVETH_ILLAN_ACTIVE_TRUNK 0x0000000000000001ULL + /* hcall macros */ #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \ plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac) @@ -151,13 +157,13 @@ struct ibmveth_adapter { }; struct ibmveth_buf_desc_fields { - u32 valid : 1; - u32 toggle : 1; - u32 reserved : 4; - u32 no_csum : 1; - u32 csum_good : 1; - u32 length : 24; - u32 address; + u32 flags_len; +#define IBMVETH_BUF_VALID 0x80000000 +#define IBMVETH_BUF_TOGGLE 0x40000000 +#define IBMVETH_BUF_NO_CSUM 0x02000000 +#define IBMVETH_BUF_CSUM_GOOD 0x01000000 +#define IBMVETH_BUF_LEN_MASK 0x00FFFFFF + u32 address; }; union ibmveth_buf_desc { @@ -165,33 +171,17 @@ union ibmveth_buf_desc { struct ibmveth_buf_desc_fields fields; }; -struct ibmveth_illan_attributes_fields { - u32 reserved; - u32 reserved2 : 18; - u32 csum_offload_padded_pkt_support : 1; - u32 reserved3 : 1; - u32 trunk_priority : 4; - u32 reserved4 : 5; - u32 tcp_csum_offload_ipv6 : 1; - u32 tcp_csum_offload_ipv4 : 1; - u32 active_trunk : 1; -}; - -union ibmveth_illan_attributes { - u64 desc; - struct ibmveth_illan_attributes_fields fields; -}; - struct ibmveth_rx_q_entry { - u16 toggle : 1; - u16 valid : 1; - u16 reserved : 4; - u16 no_csum : 1; - u16 csum_good : 1; - u16 reserved2 : 8; - u16 offset; - u32 length; - u64 correlator; + u32 flags_off; +#define IBMVETH_RXQ_TOGGLE 0x80000000 +#define IBMVETH_RXQ_TOGGLE_SHIFT 31 +#define IBMVETH_RXQ_VALID 0x40000000 +#define IBMVETH_RXQ_NO_CSUM 0x02000000 +#define IBMVETH_RXQ_CSUM_GOOD 0x01000000 +#define IBMVETH_RXQ_OFF_MASK 0x0000FFFF + + u32 length; + u64 correlator; }; #endif /* _IBMVETH_H */ -- cgit v1.2.3