Received: with ECARTIS (v1.0.0; list netdev); Thu, 30 Dec 2004 00:47:54 -0800 (PST) Received: from smtp.knology.net (smtp.knology.net [24.214.63.101]) by oss.sgi.com (8.13.0/8.13.0) with SMTP id iBU8kPYj024578 for ; Thu, 30 Dec 2004 00:46:45 -0800 Received: (qmail 19791 invoked by uid 0); 30 Dec 2004 08:53:07 -0000 Received: from user-69-1-45-93.knology.net (HELO ori.thedillows.org) (69.1.45.93) by smtp8.knology.net with SMTP; 30 Dec 2004 08:53:07 -0000 Received: from ori.thedillows.org (localhost [127.0.0.1]) by ori.thedillows.org (8.13.1/8.13.1) with ESMTP id iBU8mb3J009839; Thu, 30 Dec 2004 03:48:37 -0500 Received: (from root@localhost) by ori.thedillows.org (8.13.1/8.13.1/Submit) id iBU8mbhi009838; Thu, 30 Dec 2004 03:48:37 -0500 Date: Thu, 30 Dec 2004 03:48:37 -0500 To: netdev@oss.sgi.com Cc: linux-kernel@vger.kernel.org, dave@thedillows.org From: David Dillow Subject: [RFC 2.6.10 21/22] typhoon: add callbacks to support crypto offload Message-Id: <20041230035000.30@ori.thedillows.org> References: <20041230035000.29@ori.thedillows.org> X-Virus-Scanned: ClamAV 0.80/638/Tue Dec 21 14:41:34 2004 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 13219 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: dave@thedillows.org Precedence: bulk X-list: netdev # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/12/30 01:05:45-05:00 dave@thedillows.org # Export the xfrm offload callbacks, and let the world know we # support IPSEC offload. # # While we're at it, allow this to controlled by ethtool. # # Signed-off-by: David Dillow # # drivers/net/typhoon.c # 2004/12/30 01:05:27-05:00 dave@thedillows.org +23 -4 # Export the xfrm offload callbacks, and let the world know we # support IPSEC offload. # # While we're at it, allow this to controlled by ethtool. # # Signed-off-by: David Dillow # diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c --- a/drivers/net/typhoon.c 2004-12-30 01:07:53 -05:00 +++ b/drivers/net/typhoon.c 2004-12-30 01:07:53 -05:00 @@ -33,9 +33,12 @@ *) Waiting for a command response takes 8ms due to non-preemptable polling. Only significant for getting stats and creating SAs, but an ugly wart never the less. + *) Inbound IPSEC packets of the form outer ESP transport, inner + ESP tunnel seems to fail the hash on the inner ESP + *) Inbound IPSEC packets of the form outer AH transport, inner + AH tunnel seems to fail the hash on the outer AH TODO: - *) Doesn't do IPSEC offloading. Yet. Keep yer pants on, it's coming. *) Add more support for ethtool (especially for NIC stats) *) Allow disabling of RX checksum offloading *) Fix MAC changing to work while the interface is up @@ -100,8 +103,8 @@ #define PKT_BUF_SZ 1536 #define DRV_MODULE_NAME "typhoon" -#define DRV_MODULE_VERSION "1.5.6" -#define DRV_MODULE_RELDATE "04/12/17" +#define DRV_MODULE_VERSION "1.5.6-ipsec" +#define DRV_MODULE_RELDATE "04/12/19" #define PFX DRV_MODULE_NAME ": " #define ERR_PFX KERN_ERR PFX @@ -1406,6 +1409,8 @@ .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .get_ringparam = typhoon_get_ringparam, + .get_ipsec = ethtool_op_get_ipsec, + .set_ipsec = ethtool_op_set_ipsec, }; static int @@ -2253,6 +2258,9 @@ tp->card_state = Running; smp_wmb(); + if(dev->features & NETIF_F_IPSEC) + xfrm_accel_add(dev); + iowrite32(TYPHOON_INTR_ENABLE_ALL, ioaddr + TYPHOON_REG_INTR_ENABLE); iowrite32(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_MASK); typhoon_post_pci_writes(ioaddr); @@ -2327,6 +2335,14 @@ typhoon_clean_tx(tp, &tp->txLoRing, &indexes->txLoCleared); } + if(tp->dev->features & NETIF_F_IPSEC) + xfrm_accel_flush(tp->dev); + + /* tp->card_state != Running, so nothing will change this out + * from under us. + */ + tp->offload &= ~TYPHOON_OFFLOAD_IPSEC; + return 0; } @@ -3183,6 +3199,9 @@ dev->set_mac_address = typhoon_set_mac_address; dev->vlan_rx_register = typhoon_vlan_rx_register; dev->vlan_rx_kill_vid = typhoon_vlan_rx_kill_vid; + dev->xfrm_state_add = typhoon_xfrm_state_add; + dev->xfrm_state_del = typhoon_xfrm_state_del; + dev->xfrm_bundle_add = typhoon_xfrm_bundle_add; SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops); /* We can handle scatter gather, up to 16 entries, and @@ -3190,7 +3209,7 @@ */ dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - dev->features |= NETIF_F_TSO; + dev->features |= NETIF_F_TSO | NETIF_F_IPSEC; if(register_netdev(dev) < 0) goto error_out_reset;