myri10ge updates for 2.6.24
Subsystems (2)
PATCH 1/5 myri10ge: fix some indentation, white spaces, and comments
In reply to Brice GoglinFix one comment in myri10ge.c and update indendation and white spaces to match the code generated by indent from upstream CVS.
--- drivers/net/myri10ge/myri10ge.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/myri10ge/myri10ge.c +5 -6
@@ -1047,7 +1047,8 @@ hlen =MYRI10GE_HLEN > len ? len :MYRI10GE_HLEN ; -/* allocate an skb to attach the page(s) to. */ +/* allocate an skb to attach the page(s) to. This is done +* after trying LRO, so as to avoid skb allocation overheads */ skb =netdev_alloc_skb (dev,MYRI10GE_HLEN +16 );if (unlikely (skb ==NULL )) {
@@ -1217,7 +1218,8 @@static int myri10ge_poll (struct napi_struct *napi,int budget) { - struct myri10ge_priv *mgp = container_of(napi, struct myri10ge_priv, napi); +struct myri10ge_priv *mgp = + container_of(napi, struct myri10ge_priv, napi);struct net_device *netdev = mgp->dev;struct myri10ge_rx_done *rx_done = &mgp->rx_done;int work_done;
@@ -2706,7 +2708,6 @@ }#ifdef CONFIG_PM -static int myri10ge_suspend (struct pci_dev *pdev,pm_message_t state) {struct myri10ge_priv *mgp;
@@ -2787,7 +2788,6 @@ return -EIO; } -#endif /* CONFIG_PM */ static u32 myri10ge_read_reboot (struct myri10ge_priv *mgp)
@@ -2954,8 +2954,7 @@ mgp =netdev_priv (netdev); mgp->dev = netdev; -netif_napi_add (netdev, &mgp->napi, - myri10ge_poll, myri10ge_napi_weight); +netif_napi_add (netdev, &mgp->napi, myri10ge_poll, myri10ge_napi_weight); mgp->pdev = pdev; mgp->csum_flag =MXGEFW_FLAGS_CKSUM ; mgp->pause = myri10ge_flow_control;
cover myri10ge updates for 2.6.24
Hi Jeff,
Now that LRO and the new NAPI have landed in myri10ge for 2.6.24, here's a couple updates. The big part is support for IPv6 TSO, which requires the addition of skb_is_gso_v6(). I am CC'ing Dave and Herbert in the corresponding mails. The other patches are trivial.
1. myri10ge: fix some indentation, white spaces, and comments
2. myri10ge: update firmware headers
3. [IPV6]: add skb_is_gso_v6()
4. myri10ge: add IPv6 TSO support
5. myri10ge: update driver version to 1.3.2-1.287
Please apply for 2.6.24.
Thanks,
Brice
PATCH 2/5 myri10ge: update firmware headers
Update myri10ge firmware headers to latest upstream version with TSO6 and RSS support.
--- drivers/net/myri10ge/myri10ge_mcp.h | 90 ++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-)
drivers/net/myri10ge/myri10ge_mcp.h +86 -4
@@ -10,7 +10,7 @@__be32 low; }; -/* 4 Bytes */ +/* 4 Bytes. 8 Bytes for NDIS drivers. */ struct mcp_slot {__sum16 checksum;__be16 length;
@@ -205,8 +205,87 @@/* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned * chipset */ -MXGEFW_CMD_UNALIGNED_STATUS -/* return data = boolean, true if the chipset is known to be unaligned */ +MXGEFW_CMD_UNALIGNED_STATUS , +/* return data = boolean, true if the chipset is known to be unaligned */ + +MXGEFW_CMD_ALWAYS_USE_N_BIG_BUFFERS , +/* data0 = number of big buffers to use. It must be 0 or a power of 2. +* 0 indicates that the NIC consumes as many buffers as they are required +* for packet. This is the default behavior. +* A power of 2 number indicates that the NIC always uses the specified +* number of buffers for each big receive packet. +* It is up to the driver to ensure that this value is big enough for +* the NIC to be able to receive maximum-sized packets. +*/ + +MXGEFW_CMD_GET_MAX_RSS_QUEUES , +MXGEFW_CMD_ENABLE_RSS_QUEUES , +/* data0 = number of slices n (0, 1, ..., n-1) to enable +* data1 = interrupt mode. 0=share one INTx/MSI, 1=use one MSI-X per queue. +* If all queues share one interrupt, the driver must have set +* RSS_SHARED_INTERRUPT_DMA before enabling queues. +*/ +MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET , +MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA , +/* data0, data1 = bus address lsw, msw */ +MXGEFW_CMD_GET_RSS_TABLE_OFFSET , +/* get the offset of the indirection table */ +MXGEFW_CMD_SET_RSS_TABLE_SIZE , +/* set the size of the indirection table */ +MXGEFW_CMD_GET_RSS_KEY_OFFSET , +/* get the offset of the secret key */ +MXGEFW_CMD_RSS_KEY_UPDATED , +/* tell nic that the secret key's been updated */ +MXGEFW_CMD_SET_RSS_ENABLE , +/* data0 = enable/disable rss +* 0: disable rss. nic does not distribute receive packets. +* 1: enable rss. nic distributes receive packets among queues. +* data1 = hash type +* 1: IPV4 +* 2: TCP_IPV4 +* 3: IPV4 | TCP_IPV4 +*/ + +MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE , +/* Return data = the max. size of the entire headers of a IPv6 TSO packet. +* If the header size of a IPv6 TSO packet is larger than the specified +* value, then the driver must not use TSO. +* This size restriction only applies to IPv6 TSO. +* For IPv4 TSO, the maximum size of the headers is fixed, and the NIC +* always has enough header buffer to store maximum-sized headers. +*/ + +MXGEFW_CMD_SET_TSO_MODE , +/* data0 = TSO mode. +* 0: Linux/FreeBSD style (NIC default) +* 1: NDIS/NetBSD style +*/ + +MXGEFW_CMD_MDIO_READ , +/* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */ +MXGEFW_CMD_MDIO_WRITE , +/* data0 = dev_addr, data1 = register/addr, data2 = value */ + +MXGEFW_CMD_XFP_I2C_READ , +/* Starts to get a fresh copy of one byte or of the whole xfp i2c table, the +* obtained data is cached inside the xaui-xfi chip : +* data0 : "all" flag : 0 => get one byte, 1=> get 256 bytes, +* data1 : if (data0 == 0): index of byte to refresh [ not used otherwise ] +* The operation might take ~1ms for a single byte or ~65ms when refreshing all 256 bytes +* During the i2c operation, MXGEFW_CMD_XFP_I2C_READ or MXGEFW_CMD_XFP_BYTE attempts +* will return MXGEFW_CMD_ERROR_BUSY +*/ +MXGEFW_CMD_XFP_BYTE , +/* Return the last obtained copy of a given byte in the xfp i2c table +* (copy cached during the last relevant MXGEFW_CMD_XFP_I2C_READ) +* data0 : index of the desired table entry +* Return data = the byte stored at the requested index in the table +*/ + +MXGEFW_CMD_GET_VPUMP_OFFSET , +/* Return data = NIC memory offset of mcp_vpump_public_global */ + MXGEFW_CMD_RESET_VPUMP, + /* Resets the VPUMP state */ }; enum myri10ge_mcp_cmd_status {
@@ -220,7 +299,10 @@MXGEFW_CMD_ERROR_BAD_PORT ,MXGEFW_CMD_ERROR_RESOURCES ,MXGEFW_CMD_ERROR_MULTICAST , - MXGEFW_CMD_ERROR_UNALIGNED +MXGEFW_CMD_ERROR_UNALIGNED , +MXGEFW_CMD_ERROR_NO_MDIO , +MXGEFW_CMD_ERROR_XFP_FAILURE , + MXGEFW_CMD_ERROR_XFP_ABSENT };#define MXGEFW_OLD_IRQ_DATA_LEN 40
PATCH 5/5 myri10ge: update driver version to 1.3.2-1.287
In reply to Brice GoglinThe myri10ge driver is now at version 1.3.2-1.287.
--- drivers/net/myri10ge/myri10ge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/myri10ge/myri10ge.c +1 -1
@@ -75,7 +75,7 @@#include "myri10ge_mcp.h" #include "myri10ge_mcp_gen_header.h" -#define MYRI10GE_VERSION_STR "1.3.2-1.269" +#define MYRI10GE_VERSION_STR "1.3.2-1.287"MODULE_DESCRIPTION ("Myricom 10G driver (10GbE)" );MODULE_AUTHOR ("Maintainer: [email protected]" );
PATCH 3/5 : Add skb_is_gso_v6
In reply to Brice GoglinAdd skb_is_gso_v6().
--- include/linux/skbuff.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/skbuff.h +5 -0
@@ -1781,6 +1781,11 @@return skb_shinfo (skb)->gso_size; } +static inline int skb_is_gso_v6 (const struct sk_buff *skb) +{ +return skb_shinfo (skb)->gso_type &SKB_GSO_TCPV6 ; +} +static inline void skb_forward_csum (struct sk_buff *skb) {/* Unfortunately we don't support this one. Any brave souls? */
PATCH 4/5 myri10ge: add IPv6 TSO support
In reply to Brice GoglinAdd support for IPv6 TSO to the myri10ge driver.
--- drivers/net/myri10ge/myri10ge.c | 87 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 8 deletions(-)
drivers/net/myri10ge/myri10ge.c +79 -8
@@ -214,6 +214,8 @@unsigned long serial_number;int vendor_specific_offset;int fw_multicast_support; +unsigned long features; +u32 max_tso6;u32 read_dma;u32 write_dma;u32 read_write_dma;
@@ -311,6 +313,7 @@#define myri10ge_pio_copy (to,from,size) __iowrite64_copy(to,from,size/8)static void myri10ge_set_multicast_list (struct net_device *dev); +static int myri10ge_sw_tso (struct sk_buff *skb,struct net_device *dev);static inline void put_be32 (__be32 val,__be32 __iomem * p) {
@@ -612,6 +615,7 @@__be32 buf[16 ];u32 dma_low, dma_high, size;int status, i; +struct myri10ge_cmd cmd; size =0 ; status =myri10ge_load_hotplug_firmware (mgp, &size);
@@ -688,6 +692,14 @@dev_info (&mgp->pdev->dev,"handoff confirmed\n" );myri10ge_dummy_rdma (mgp,1 ); +/* probe for IPv6 TSO support */ + mgp->features =NETIF_F_SG |NETIF_F_HW_CSUM |NETIF_F_TSO ; + status =myri10ge_send_cmd (mgp,MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE , + &cmd,0 ); +if (status ==0 ) { + mgp->max_tso6 = cmd.data0; + mgp->features |=NETIF_F_TSO6 ; + }return 0 ; }
@@ -1384,6 +1396,18 @@return 0 ; } +static int myri10ge_set_tso (struct net_device *netdev,u32 tso_enabled) +{ +struct myri10ge_priv *mgp =netdev_priv (netdev); +unsigned long flags = mgp->features & (NETIF_F_TSO6 |NETIF_F_TSO ); + +if (tso_enabled) + netdev->features |= flags; +else + netdev->features &= ~flags; +return 0 ; +} +static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN ] = {"rx_packets" ,"tx_packets" ,"rx_bytes" ,"tx_bytes" ,"rx_errors" ,"tx_errors" ,"rx_dropped" ,"tx_dropped" ,"multicast" ,"collisions" ,
@@ -1508,7 +1532,7 @@ .set_rx_csum = myri10ge_set_rx_csum, .set_tx_csum = ethtool_op_set_tx_hw_csum, .set_sg = ethtool_op_set_sg, - .set_tso = ethtool_op_set_tso, + .set_tso = myri10ge_set_tso, .get_link = ethtool_op_get_link, .get_strings = myri10ge_get_strings, .get_sset_count = myri10ge_get_sset_count,
@@ -2166,7 +2190,8 @@ pseudo_hdr_offset = cksum_offset + skb->csum_offset;/* If the headers are excessively large, then we must * fall back to a software checksum */ -if (unlikely (cksum_offset >255 || pseudo_hdr_offset >127 )) { +if (unlikely (!mss && (cksum_offset >255 || + pseudo_hdr_offset >127 ))) {if (skb_checksum_help (skb)) goto drop; cksum_offset =0 ;
@@ -2186,9 +2211,18 @@/* negative cum_len signifies to the * send loop that we are still in the * header portion of the TSO packet. -* TSO header must be at most 134 bytes long */ +* TSO header can be at most 1KB long */ cum_len = -(skb_transport_offset (skb) +tcp_hdrlen (skb)); +/* for IPv6 TSO, the checksum offset stores the +* TCP header length, to save the firmware from +* the need to parse the headers */ +if (skb_is_gso_v6 (skb)) { + cksum_offset =tcp_hdrlen (skb); +/* Can only handle headers <= max_tso6 long */ +if (unlikely (-cum_len > mgp->max_tso6)) +return myri10ge_sw_tso (skb, dev); + }/* for TSO, pseudo_hdr_offset holds mss. * The firmware figures out where to put * the checksum by parsing the header. */
@@ -2303,10 +2337,12 @@ req++; count++; rdma_count++; -if (unlikely (cksum_offset > seglen)) - cksum_offset -= seglen; -else - cksum_offset =0 ; +if (cksum_offset !=0 && !(mss &&skb_is_gso_v6 (skb))) { +if (unlikely (cksum_offset > seglen)) + cksum_offset -= seglen; +else + cksum_offset =0 ; + } }if (frag_idx == frag_cnt)break ;
@@ -2389,6 +2425,41 @@ } +static int myri10ge_sw_tso (struct sk_buff *skb,struct net_device *dev) +{ +struct sk_buff *segs, *curr; +struct myri10ge_priv *mgp = dev->priv; +int status; + + segs =skb_gso_segment (skb, dev->features & ~NETIF_F_TSO6 ); +if (unlikely (IS_ERR (segs))) + goto drop; + +while (segs) { + curr = segs; + segs = segs->next; + curr->next =NULL ; + status =myri10ge_xmit (curr, dev); +if (status !=0 ) { +dev_kfree_skb_any (curr); +if (segs !=NULL ) { + curr = segs; + segs = segs->next; + curr->next =NULL ; +dev_kfree_skb_any (segs); + } + goto drop; + } + } +dev_kfree_skb_any (skb); +return 0 ; + +drop: +dev_kfree_skb_any (skb); + mgp->stats.tx_dropped +=1 ; +return 0 ; +} +static struct net_device_stats *myri10ge_get_stats (struct net_device *dev) {struct myri10ge_priv *mgp =netdev_priv (dev);
@@ -3076,7 +3147,7 @@ netdev->change_mtu = myri10ge_change_mtu; netdev->set_multicast_list = myri10ge_set_multicast_list; netdev->set_mac_address = myri10ge_set_mac_address; - netdev->features =NETIF_F_SG |NETIF_F_HW_CSUM |NETIF_F_TSO ; + netdev->features = mgp->features;if (dac_enabled) netdev->features |=NETIF_F_HIGHDMA ;
Re: [PATCH 3/5] [IPV6]: Add skb_is_gso_v6
In reply to Brice GoglinFrom: Brice Goglin <[email protected]>
Date: Sat, 13 Oct 2007 12:33:32 +0200
Quoted 3 lines
Add
skb_is_gso_v6().Signed-off-by Brice Goglin <[email protected]>
No objections from me:
Jeff, it's simplest if you just merge this in with the rest of the myri10ge patches, so please do so.
Thanks!
Re: [PATCH 3/5] [IPV6]: Add skb_is_gso_v6
Quoted 7 lines · David Miller
From: Brice Goglin <[email protected]>
Date: Sat, 13 Oct 2007 12:33:32 +0200Quoted 3 lines
Add
skb_is_gso_v6().Signed-off-by Brice Goglin <[email protected]>
Quoted 8 lines
No objections from me:
Acked-by David S. Miller <[email protected]>Jeff, it's simplest if you just merge this in with the rest of the myri10ge patches, so please do so.
Thanks!
Already in the queue (though waiting on an email like this)
Jeff
Re: [PATCH 1/5] myri10ge: fix some indentation, white spaces, and comments
In reply to Brice GoglinQuoted 7 lines · Brice Goglin
Fix one comment in
myri10ge.cand update indendation and white spaces to match the code generated by indent from upstream CVS.Signed-off-by Brice Goglin <[email protected]>--- drivers/net/myri10ge/myri10ge.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
applied 1-5