From patchwork Tue Jun 14 23:54:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghu Vatsavayi X-Patchwork-Id: 635657 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rTn3l13hnz9t0d for ; Wed, 15 Jun 2016 10:10:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=CAVIUMNETWORKS.onmicrosoft.com header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b=kfaueFZA; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932130AbcFOAK4 (ORCPT ); Tue, 14 Jun 2016 20:10:56 -0400 Received: from mail-bl2on0087.outbound.protection.outlook.com ([65.55.169.87]:43936 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752494AbcFOAKy (ORCPT ); Tue, 14 Jun 2016 20:10:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bXIftIJkgpI/Zg9sSc9FDdlurDxg6DT6Q/J6lHakI8c=; b=kfaueFZAqayehzfC9dHcT/cUn7sikd6fs1gWG5xp1rHtU96wPy3ciX4NstaMsCenvDiQBhVMd8Sy9T9SwpR0/dUwglzEukkUmxqm4z8BjdjNw42xQ77JF2Yegx0wAgvDaJtH3xsp2ykh6XXz3NOL972WnpEaL4ZhGepyrMHT6Qo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Raghu.Vatsavayi@cavium.com; Received: from localhost.caveonetworks.com (50.233.148.158) by CY1PR07MB2133.namprd07.prod.outlook.com (10.164.112.11) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 14 Jun 2016 23:55:48 +0000 From: Raghu Vatsavayi To: CC: , Raghu Vatsavayi , Derek Chickles , Satanand Burla , Felix Manlunas , Raghu Vatsavayi Subject: [PATCH net-next V2 7/9] liquidio: New driver FW command structure Date: Tue, 14 Jun 2016 16:54:49 -0700 Message-ID: <1465948491-10541-8-git-send-email-rvatsavayi@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1465948491-10541-1-git-send-email-rvatsavayi@caviumnetworks.com> References: <1465948491-10541-1-git-send-email-rvatsavayi@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: DM3PR14CA0038.namprd14.prod.outlook.com (10.164.193.176) To CY1PR07MB2133.namprd07.prod.outlook.com (10.164.112.11) X-MS-Office365-Filtering-Correlation-Id: feba3050-4e4d-4207-325a-08d394af691e X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2133; 2:F8p8BkOXaombn5o+JnjG8tWQ16607cLKoyi4iG/TF+axhnsXC8r7VGUbHPnbGH1u2UbXLbPaMDiMQn3BBqC6ngOLVZ8intUPayGjlgE80rihwfyHbyYKufSglnnrb8v30D8kMXJ+aIDn1IUkoO5AH9AcjjPn0HCrT0B8LOTsT3TvG5tphc23Dq6/XbrcxiIf; 3:WC27NIe8DVkYEgcL8GL7Ie8HWcSBO0vYbTu9OKWY+wy+pPxHzHVJi69lUUZ3XitOEpAe7o2yHziDBv40E+HHp9Kr/Z1LOnxRXLE0GZMCbSen0aJjlFuPzMv/FuIYRymU; 25:rU4rxh77AnAASEBBzWtdrVqXH/idBOYnNECaqcerFWtL/mSPRTW0T9/QCAybSgBaGOgU7xDTwx/QyXaoWj9bpnVR2pGVXyAGszrp+HrdV6bcWhs/NS2pqELcvZPFjOsp0xhlGoLtdwIOveTs8o0L5K1FLVmFgrn5WaYl4edshsNx5LUpPRkli5I5W4mfSR+kYPlY2cPXyK4+HSv4rOyPRg25OOLTZ5n6ov2u2Wyjw9bu3jbcLd3ABUTjd9N+lkcKFdP38iFbjtj+M0Nzr3S2/X4I3cj9EXL6MNfNnIbiDe+FoOQCHnPO2bfH7Pzc/NvEx1yHlDXH7CaInr4ZrRNnVamXwp21Agfae5DZQhK9bXTlHQaIjtQbKrUtjQEzUy+FogLLeW7Xq0Kq01+R46XPapMhQEj+aOb4tldUIV8aiT0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2133; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2133; 20:tDc19q8VFQ8MYx/Sxevz3FdDU3mCXtCAZzdybSpTStF4JllRzjpOE/DYp6f9MSoOTTGDl6Y+dLaw33FZCoRQtsChsEEm0GrBWrEQiUW9QsxojFnaiYNcm74wcKVsGKvLr/FGNP9Ux6w6almo1qb2PwS3dcU7PzqeEzB4/1mSXVZA36desUsqHkK7FGLz6liM+x8F98PvyQsD+X4xJAwC5En8lRmapaK4dyfbWtlgPZlXFBSV/OvntIIri2eoGBYCyea1V6yHlQK7spFnAWBksixokLrXaP4ZU5e8TBFsj/T3zV/FbjqWDKcfC6zepud8NFCqT+hDc7ESpj9xT52J4ANL7+I3qGgHn3U08k1b28eZXvBI592TxDMUN90UIf2ze/TS5QQizAUzGXEHkBcRPdqLoYW7rP5jt8imyk+kSOeqN1WKhULroWkhb7v+QvO9pvuLuLa5s2kMlNEVBla6bKJRr9EXKsp/ZFpjLJqtP5ls9yxVOcKHU6EosucCmqQRxh7vXv6G+kctu30NYYdNdUOFpLU+SMf2cmOdtDbwQGKrlQt4OBv0rN9BGWU0Nbr8bFE8N1Z33CXAbVEQ7DinKdvnBnIAWiu2w+8MzcENRHw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR07MB2133; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2133; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2133; 4:oWjGuRWgK9DXF9iuty1jnHV6vtS9aRl8yHry+J4aWPG9iHmYWfOzTPKW9AHH7/hCXG7R+ymMv8WkVF/ea8vTA8lAsgP2fAvj4DdHTT/f0vQ7bJgQdgQYKBwFjAAkotmYOFU623lcHtQX8OHDHYwChfsPU2LxDtsYKCyFAWQ05vU+ReSge5M3k/ldFB/sMNlT1114ZNC1tyeCylhtLj3eqmZDdB5CBpiDFxyCQ9Vtft0HTVNUx/JGb2z0WuPXOEc0GNILevsWOicYKYxKkhaJmHB+0IEtJp0K2QWzYG/tfjgvDw8XYpwjk2oiaCP3nIboX2FK3DoevwVcE9Ue0knhMQBT/KrRuPLuHd8wbUHnhRWdOWiYLSwPJQrV5XQOB+Zc X-Forefront-PRVS: 09730BD177 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(69596002)(189998001)(2950100001)(48376002)(36756003)(77096005)(19580405001)(5004730100002)(19580395003)(76176999)(4001430100002)(50986999)(97736004)(68736007)(5003940100001)(107886002)(110136002)(5008740100001)(101416001)(92566002)(81166006)(81156014)(8676002)(229853001)(6116002)(66066001)(4326007)(50466002)(2906002)(105586002)(106356001)(2351001)(47776003)(53416004)(76506005)(42186005)(33646002)(586003)(3846002)(50226002)(4720700001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2133; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2133; 23:MaAtPaPi4jeTvHuH8w55wIDDPYEZsy5ArKqkjOT7H?= =?us-ascii?Q?f6NgybKVhspwa33jD+ZThHx+3h5y7Z+sVCbufU9DA6vL2NwLB7acEY078N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9RGbROVqb9wuHp1L0Ijoths?= =?us-ascii?Q?GDyW0HuSlM06Mav5lqnzzfoXaHWMr90m4eN2IQmFSZQOHQxNUdTMEsNsnGoR?= =?us-ascii?Q?HFqO9+h43S3vf2mhX7DIxSppigCWgyoRgK1pIQAkVFYTNXh75GFcFl7IhnL6?= =?us-ascii?Q?nNG1FB0w8tYGdBt3KKupmiONtk4wGo5FGhsKSw8HgEJawfUUmL2DUrO1UFDr?= =?us-ascii?Q?03xc3QpsOmakrBbtDZR7+aRuoH3Kgf/jhkH?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2133; 5:1Ks51CqUguIllr9sAeOgSfrL8b7HSbgwzENrf+MIC42uqEjojiBEwfdv7Jp8i66cdEvHsD6cSfu44FShQuBDHPMWUmn+LPjX+eeA568zvjbLgtOLet406+4VlXl21lNEd3S+yCoAvRR5mBNOBj8UXA==; 24:n3I7GOCmbYtLdmBmQnciWf49+DMCEmGD0YU0QCv6NpKi6Std5NTtBqw1UwAJ38mvXI9yksQj7BMKyonDnAn/HuiHNGYvlE35/TnwRoV8Wi0=; 7:zd65KMn4jgTrkbGyjC0l1DlIcfCzoSd8f3bPOigcyRtzGSjaCVOrW7y5ytnnNl8CosNOFOTOTYDuuWnv7C1UVj5oyUwMWsf7HBkn5dB2NmKpwqBB4LPDZcsunPAnStSOiFd58TdPlhH0CArjho072zBkSK7vv9lgW3gVN6x04Z9U8PkiaaoYwuABoz383IpE+28RCVTTDpSBdGXLbSl9Cg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 23:55:48.6896 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2133 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch is for new driver/firmware control command structure (octnic_packet_params and octnic_cmd_setup ) and resultant code changes. Signed-off-by: Derek Chickles Signed-off-by: Satanand Burla Signed-off-by: Felix Manlunas Signed-off-by: Raghu Vatsavayi --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 109 +-------------------- .../net/ethernet/cavium/liquidio/liquidio_common.h | 25 +++-- drivers/net/ethernet/cavium/liquidio/octeon_nic.h | 15 +-- 3 files changed, 19 insertions(+), 130 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index aa28790..1f1a28d 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2704,68 +2704,6 @@ static inline int send_nic_timestamp_pkt(struct octeon_device *oct, return retval; } -static inline int is_ipv4(struct sk_buff *skb) -{ - return (skb->protocol == htons(ETH_P_IP)) && - (ip_hdr(skb)->version == 4); -} - -static inline int is_vlan(struct sk_buff *skb) -{ - return skb->protocol == htons(ETH_P_8021Q); -} - -static inline int is_ip_fragmented(struct sk_buff *skb) -{ - /* The Don't fragment and Reserved flag fields are ignored. - * IP is fragmented if - * - the More fragments bit is set (indicating this IP is a fragment - * with more to follow; the current offset could be 0 ). - * - ths offset field is non-zero. - */ - return (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) ? 1 : 0; -} - -static inline int is_ipv6(struct sk_buff *skb) -{ - return (skb->protocol == htons(ETH_P_IPV6)) && - (ipv6_hdr(skb)->version == 6); -} - -static inline int is_with_extn_hdr(struct sk_buff *skb) -{ - return (ipv6_hdr(skb)->nexthdr != IPPROTO_TCP) && - (ipv6_hdr(skb)->nexthdr != IPPROTO_UDP); -} - -static inline int is_tcpudp(struct sk_buff *skb) -{ - return (ip_hdr(skb)->protocol == IPPROTO_TCP) || - (ip_hdr(skb)->protocol == IPPROTO_UDP); -} - -static inline u32 get_ipv4_5tuple_tag(struct sk_buff *skb) -{ - u32 tag; - struct iphdr *iphdr = ip_hdr(skb); - - tag = crc32(0, &iphdr->protocol, 1); - tag = crc32(tag, (u8 *)&iphdr->saddr, 8); - tag = crc32(tag, skb_transport_header(skb), 4); - return tag; -} - -static inline u32 get_ipv6_5tuple_tag(struct sk_buff *skb) -{ - u32 tag; - struct ipv6hdr *ipv6hdr = ipv6_hdr(skb); - - tag = crc32(0, &ipv6hdr->nexthdr, 1); - tag = crc32(tag, (u8 *)&ipv6hdr->saddr, 32); - tag = crc32(tag, skb_transport_header(skb), 4); - return tag; -} - /** \brief Transmit networks packets to the Octeon interface * @param skbuff skbuff struct to be passed to network layer. * @param netdev pointer to network device @@ -2852,52 +2790,11 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) cmdsetup.u64 = 0; cmdsetup.s.ifidx = lio->linfo.ifidx; + cmdsetup.s.iq_no = iq_no; - if (skb->ip_summed == CHECKSUM_PARTIAL) { - if (is_ipv4(skb) && !is_ip_fragmented(skb) && is_tcpudp(skb)) { - tag = get_ipv4_5tuple_tag(skb); - - cmdsetup.s.cksum_offset = sizeof(struct ethhdr) + 1; - - if (ip_hdr(skb)->ihl > 5) - cmdsetup.s.ipv4opts_ipv6exthdr = - OCT_PKT_PARAM_IPV4OPTS; - - } else if (is_ipv6(skb)) { - tag = get_ipv6_5tuple_tag(skb); + if (skb->ip_summed == CHECKSUM_PARTIAL) + cmdsetup.s.transport_csum = 1; - cmdsetup.s.cksum_offset = sizeof(struct ethhdr) + 1; - - if (is_with_extn_hdr(skb)) - cmdsetup.s.ipv4opts_ipv6exthdr = - OCT_PKT_PARAM_IPV6EXTHDR; - - } else if (is_vlan(skb)) { - if (vlan_eth_hdr(skb)->h_vlan_encapsulated_proto - == htons(ETH_P_IP) && - !is_ip_fragmented(skb) && is_tcpudp(skb)) { - tag = get_ipv4_5tuple_tag(skb); - - cmdsetup.s.cksum_offset = - sizeof(struct vlan_ethhdr) + 1; - - if (ip_hdr(skb)->ihl > 5) - cmdsetup.s.ipv4opts_ipv6exthdr = - OCT_PKT_PARAM_IPV4OPTS; - - } else if (vlan_eth_hdr(skb)->h_vlan_encapsulated_proto - == htons(ETH_P_IPV6)) { - tag = get_ipv6_5tuple_tag(skb); - - cmdsetup.s.cksum_offset = - sizeof(struct vlan_ethhdr) + 1; - - if (is_with_extn_hdr(skb)) - cmdsetup.s.ipv4opts_ipv6exthdr = - OCT_PKT_PARAM_IPV6EXTHDR; - } - } - } if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; cmdsetup.s.timestamp = 1; diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h index 84ffcae..ebdb802 100644 --- a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h +++ b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h @@ -463,30 +463,27 @@ union octeon_rh { #define OCT_RH_SIZE (sizeof(union octeon_rh)) -#define OCT_PKT_PARAM_IPV4OPTS 1 -#define OCT_PKT_PARAM_IPV6EXTHDR 2 - union octnic_packet_params { u32 u32; struct { #ifdef __BIG_ENDIAN_BITFIELD - u32 reserved:6; + u32 reserved:16; + u32 ip_csum:1; /* Perform IP header checksum(s) */ + /* Perform Outer transport header checksum */ + u32 transport_csum:1; + /* Find tunnel, and perform transport csum. */ u32 tnl_csum:1; - u32 ip_csum:1; - u32 ipv4opts_ipv6exthdr:2; - u32 ipsec_ops:4; - u32 tsflag:1; - u32 csoffset:9; + u32 tsflag:1; /* Timestamp this packet */ + u32 ipsec_ops:4; /* IPsec operation */ u32 ifidx:8; #else u32 ifidx:8; - u32 csoffset:9; - u32 tsflag:1; u32 ipsec_ops:4; - u32 ipv4opts_ipv6exthdr:2; - u32 ip_csum:1; + u32 tsflag:1; u32 tnl_csum:1; - u32 reserved:6; + u32 transport_csum:1; + u32 ip_csum:1; + u32 reserved:16; #endif } s; }; diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_nic.h b/drivers/net/ethernet/cavium/liquidio/octeon_nic.h index 0238857..a61dea3 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_nic.h +++ b/drivers/net/ethernet/cavium/liquidio/octeon_nic.h @@ -94,15 +94,15 @@ struct octnic_data_pkt { */ union octnic_cmd_setup { struct { - u32 ifidx:8; - u32 cksum_offset:7; + u32 iq_no:8; u32 gather:1; u32 timestamp:1; - u32 ipv4opts_ipv6exthdr:2; u32 ip_csum:1; + u32 transport_csum:1; u32 tnl_csum:1; - + u32 ifidx:8; u32 rsvd:11; + union { u32 datasize; u32 gatherptrs; @@ -172,13 +172,8 @@ octnet_prepare_pci_cmd(struct octeon_instr_64B *cmd, packet_params.u32 = 0; - if (setup->s.cksum_offset) { - packet_params.s.csoffset = setup->s.cksum_offset; - packet_params.s.ipv4opts_ipv6exthdr = - setup->s.ipv4opts_ipv6exthdr; - } - packet_params.s.ip_csum = setup->s.ip_csum; + packet_params.s.transport_csum = setup->s.transport_csum; packet_params.s.tnl_csum = setup->s.tnl_csum; packet_params.s.ifidx = setup->s.ifidx; packet_params.s.tsflag = setup->s.timestamp;