From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0068.outbound.protection.outlook.com [104.47.38.68]) by dpdk.org (Postfix) with ESMTP id 11B2037A8 for ; Tue, 8 Nov 2016 07:32:15 +0100 (CET) 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=cxQp7CmOnDjOz8CLHLyhQA4LEbHBq31eKZhvMbQfxU4=; b=KHU0ZRz7dUvHWnOq4hWij25mDVhikNdsMU+2PBk4hY5aD7fvOaAkSaGhXv3koDy+nkaefDKgDR1JF4TeLcVGAxbS9Hv8uAtP3UtfaOivZd4INTegsrckUeermAv6IkpGYrvX0eqvLQcKDSd3NEftotwVdCcVPcD33VHjI9gNJRc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (14.140.2.178) by CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Tue, 8 Nov 2016 06:32:11 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob Date: Tue, 8 Nov 2016 12:01:25 +0530 Message-ID: <1478586686-14109-2-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1478586686-14109-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1478586686-14109-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MAXPR01CA0068.INDPRD01.PROD.OUTLOOK.COM (10.164.146.168) To CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) X-MS-Office365-Filtering-Correlation-Id: d4d901cb-3a5c-42a4-6e3b-08d407a0f9f1 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 2:aawAib2Nawo+d8LNGN6DGgEXvEZxRvbrEVq9SBgBxxiD1svuM1PwjXfqlQ9i4OfszE4Fu7KzPC0BTBkBl7w3+tYzwvA2Jg5oVR0QoXPDhcENg76Ah7mmrZT/cGh0eJYFGRON1YUHKtUUIBFs+vfGB8KF3joK1HwF/LPTkox1bX84US+mMSoMDD1VkQrcT784bNQOoDSg5shoR0XaHYE/GA==; 3:7TjH0+h9/K7i03DOtM3FjEAnGVY3K6G/i9K/B3yZyU2grkw7JAoUBNrisQ5a+3G2WwlxdPqZgcDBzmzMYJegnuwhaey2uz1atwdZvWHj0b9v75rua440FugMl/LKvJ9krAzjOoZaACnmfmLBd5LodA==; 25:t8fZovscZCzDlk8VPTtIynQdhx6pfxLkr3JuE20jePezAnqHqeQrdOoWfcHtNVzGI/o5TsaFmwTnfFY81YilBah7ZezWTZtkxM9Ipb6KL8ihSeWRVDR7jGjGbILjHvHrajnBN0RxB718xOMjK4j6QhdCLcZhLS9EAVz+7ztIQP0Q1x884iBE3ydc336G2Xs5n89PcggwTtrpD2337/+s9k3Q3m1N7M1kHKn8sum1DnMsDDwCd/UTjcE015Z9HJnFrGZO/ZQ3xqIQm7TnS0w2CO5NP9+aObgnbrYBx5jAUBbfJP/PkGiAb/vdxOAclZZtl9bhcbtAv06k8NWXnmTIBj3UhrJPXOYavH0CZR5RTVNyMqUo+EKnzIZs2qTZz+Q+9omLWhaky4CMI4SXQWtZRwGPaFJgF7i+rwhpg5ubYfpnRsuigLurR2HeXsXj4Ud0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 31:IRSJxt9lbEEjK0TYstJ4sG3X+Qv95TY9ImIWGFBYz3uy5n53UnqJwKn6PJ1sI7J7We9TK1YrRX/NUaOxR5/nB+MNJfV9n1C9Q8PiX9JFygNbjQrVvILHsdZLY+Qm1Cz5e/LgeOROLLRjMTxLALdsMToKeugZifenpRzr6jAQy0LCERTk47Iyc/lst2912u3oXNwRDXc0goSjiq+LYEMiEVjoF4jHoL/iBDvxXtE6K++bG3NA7+uyknPOjsCmFcqd; 20:owg3GTX9MOOK4/s898aNm1gN5ZBO1KtQGzjwHeNMjCTGumZiiajiztVayD9Gi3xTH3ANY4zo8vtXgGwDoU2EsXF4fxGgv4PfbG3fFr9Ps2SsPSiowwK61fhUSJT2AtAR0EvOFGGcRTyHZjTyxmo5daxkvVxcvflqTnyTyyodM6zGw6BpBFfUp7niDe3JjoTj+AH66HHVrLGAplsgmiEFhoxPVtGIkoFlWrUttksg9hetY8UTdp0SksvxXihal8Xc8INtGfk4aghv51lDybR+xUKQF3f52KfnfBVOopW1IZ7+E84evd895pqBqYL/pghUWu4OemsH7nEzsHK6k/pDWCZhjzjesNmkCLiwhfqFNOnaJu8xHShfH2L4tBN82BI9gbLpMLL5bdUynOMHtAGNv3uU2GL914Muo8IFis0lAlbNALFfq9PuywrhyFrrz6KofpPvgDKgHL/RA5SlClMpsM/ShTHGerCbNlOtpaHgd4hresBvGw5WL9t6n1szeF99tyfcEQrv87Yq1jjWJFbaha0YNaq4Q8feZkB+tP3kr0ffcwLphXr+XMLSzmBNnhRDB8p+JJYKRnWTWzFlmjupgIKePzAIliTvEwA/6IXL2nM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR0701MB1727; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 4:VwQHC6XC9gVOesdqoZTSWIip46WuZnqBkWIP8slFvn8uAhpwOOzY+eJs9nbG18yfhvnXwj1r2enrAi4Bh3iwabxIkPUlXClfdqWXrSn9U157lgLUE1O3ng3WL58NWwXfyXkQfqzzG09iZboSiiFwLXi4QIhr2LX2FC/t7PRxMlSf/EtdKqNQ3EXLIcwrPHLsn2uBcdbDgKZfqq0glHca8u2NB3g2wiCQQ/ichaOD4e2yy6RS/6BzdEDMSxVSOlj9nKV9LvDgxmLY3Gm+NhkDao32PsebMfeqTpfeA8N8FBZrVIDcdOYXu9DGH7l0aMiHGA3ICvwDChtnvTIbgc42Cek2RGC5gbHxGypGbnzogK1hUQfe/AYxjdB402vQpIoEXhg+6fBvfZx1c0lsSN3prg== X-Forefront-PRVS: 01208B1E18 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(47776003)(4001430100002)(68736007)(4326007)(97736004)(50466002)(5660300001)(101416001)(229853001)(2351001)(6116002)(77096005)(107886002)(48376002)(2906002)(3846002)(33646002)(189998001)(36756003)(50226002)(5003940100001)(42882006)(81156014)(6916009)(8676002)(2950100002)(81166006)(76176999)(50986999)(586003)(92566002)(42186005)(6666003)(110136003)(305945005)(66066001)(7736002)(5009440100003)(7846002)(105586002)(106356001)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1727; H:localhost.localdomain.localdomain; 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; CY1PR0701MB1727; 23:VZ2relazCm/UeYfeqc5s8dWnMVeCjaG2HE2j2Ut?= =?us-ascii?Q?pzOkfEhNBL5nhBhA+GIca7wBoTkX+TwTIVBtVgnwkp2ZWnVPkYJd4SfB3lQf?= =?us-ascii?Q?zdYTpOfHAsic6WWKyI+QF5JRXriAbkbZSRwEnXuDE7Qpvz8W7ijdFFo6aic/?= =?us-ascii?Q?skWO5GQPOExY58hPGhPXJ1IL/prKl/T7b0NmazWd46VmyQxUKRzrPlPSdLss?= =?us-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kloRk78ktFJ3R81/?= =?us-ascii?Q?dvkS2+Xf0/RhyRCcsAB/ohr+ggT0vUbNQFV7KatYpa61e4v4407bkoiwSbQj?= =?us-ascii?Q?uorsS7xLL3WOrkgXlZib54k9wcALzmdP5bkKfH86/pjIjGX3smfJRrPzauA?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 6:avyZLFj50w7lonDb7uzUQf2mFbSsXt0gHPS1X+McIQiTKCgA61Yyr/eWvmoIXDHFLwQ9BMfkq8yI3zcFYI7k8ih836tFWZsDCrKm3Yvd6MHvQ3/CuRN0HUUgYdHNOkRxGYU6zfy6MGNOER1ruqQ64BNx2F6XYQvow80YNElZH/VvUHAfbN8qqNUKPq9wDdNCh2xgM+sK4OLqeKF0NrljztCvTRGUEbZ3ckfwF0EO69vw+WMJLjVPshCFAy6Bk4YrYGqola0uJMC3QDT8D4F/3gfc5tbYMjHHAY5RSU5zV2oQ8fEsEefCcPBbYwRiiB1W; 5:UoYTkEDY5p3jsiAm7FFHaMdqI+E0bx0/fyRLbes3Ak49UxFgbENafNt5VLKsjqMfSPAy+eoBga6hOvT29A2Ly6Egi3TSZ49Sd0y52BWCcAqts2w6iM7VXaxdSLHmzfNqRt58CaAfZXey3ivOLHKJ9NbnbRpsNZNX7h3E4NDqJCY=; 24:g1bS6J5foDmYRBIUr2R/7793C8cH0X9BD2T76u0dzHPwqfbaVocCuxnmbzFSAL6NPji/EPz450A0acUHq+1NG6svbitckngMDh6PdiEbVtA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 7:5u9pn6jPhAfdSTqGe6CScMeqjjByufj+Ws0dt8Az4K1Pm0VUBgCC0Nnh4OLKwEroulrxX6duGONTyYUZQtCk3FjmhnnaPoyjDt48qX/635rQ7bVt1N6MipTIoRfu4m7obU8mI6FAnnBUe4NpFaajGLRsFLJ2DRCrsNMrLm6Ef3UDsJ2fS6FjSQ0hQc+8JK4ixyyeHoLbATSdcIZqr4fOxlpJk8poiZ+VyDOwFjM7z9cMOy30YBDDAMzhvA6mCZ0ozdO7u6shhzZ0n9eTy5lZ/41BMbdnxi+Iic4oxRyUYs88GiqzMPQJMZejNHC4Zjiumz5btHYtdaaz1+uerKXdYu36YdhevlqQdNHJ4v99Rrs= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 06:32:11.4193 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1727 Subject: [dpdk-dev] [PATCH 1/2] net/thunderx: disable l3 alignment pad feature X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2016 06:32:15 -0000 Based on the packet type(IPv4 or IPv6), the nicvf HW aligns L3 data to the 64bit memory address. The alignment creates a hole in mbuf(between the end of headroom and packet data start). The new revision of the HW provides an option to disable the L3 alignment feature and make mbuf layout looks more like other NICs. For better application compatibility, disabling l3 alignment feature on the hardware revisions it supports. Signed-off-by: Jerin Jacob --- drivers/net/thunderx/base/nicvf_hw.c | 18 ++++++++++++++++++ drivers/net/thunderx/base/nicvf_hw.h | 4 ++++ drivers/net/thunderx/base/nicvf_hw_defs.h | 2 ++ drivers/net/thunderx/nicvf_ethdev.c | 10 ++++++++++ 4 files changed, 34 insertions(+) diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index 1f08ef2..a69cd02 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -725,6 +725,24 @@ nicvf_vlan_hw_strip(struct nicvf *nic, bool enable) } void +nicvf_apad_config(struct nicvf *nic, bool enable) +{ + uint64_t val; + + /* APAD always enabled in this device */ + if (!(nic->hwcap & NICVF_CAP_DISABLE_APAD)) + return; + + val = nicvf_reg_read(nic, NIC_VNIC_RQ_GEN_CFG); + if (enable) + val &= ~(1ULL << NICVF_QS_RQ_DIS_APAD_SHIFT); + else + val |= (1ULL << NICVF_QS_RQ_DIS_APAD_SHIFT); + + nicvf_reg_write(nic, NIC_VNIC_RQ_GEN_CFG, val); +} + +void nicvf_rss_set_key(struct nicvf *nic, uint8_t *key) { int idx; diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h index 2b8738b..cf68be9 100644 --- a/drivers/net/thunderx/base/nicvf_hw.h +++ b/drivers/net/thunderx/base/nicvf_hw.h @@ -54,6 +54,8 @@ #define NICVF_CAP_TUNNEL_PARSING (1ULL << 0) /* Additional word in Rx descriptor to hold optional tunneling extension info */ #define NICVF_CAP_CQE_RX2 (1ULL << 1) +/* The device capable of setting NIC_CQE_RX_S[APAD] == 0 */ +#define NICVF_CAP_DISABLE_APAD (1ULL << 2) enum nicvf_tns_mode { NIC_TNS_BYPASS_MODE, @@ -217,6 +219,8 @@ uint32_t nicvf_qsize_sq_roundup(uint32_t val); void nicvf_vlan_hw_strip(struct nicvf *nic, bool enable); +void nicvf_apad_config(struct nicvf *nic, bool enable); + int nicvf_rss_config(struct nicvf *nic, uint32_t qcnt, uint64_t cfg); int nicvf_rss_term(struct nicvf *nic); diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h index e144d44..00dd2fe 100644 --- a/drivers/net/thunderx/base/nicvf_hw_defs.h +++ b/drivers/net/thunderx/base/nicvf_hw_defs.h @@ -105,6 +105,8 @@ #define NICVF_INTR_MBOX_SHIFT 22 #define NICVF_INTR_QS_ERR_SHIFT 23 +#define NICVF_QS_RQ_DIS_APAD_SHIFT 22 + #define NICVF_INTR_CQ_MASK (0xFF << NICVF_INTR_CQ_SHIFT) #define NICVF_INTR_SQ_MASK (0xFF << NICVF_INTR_SQ_SHIFT) #define NICVF_INTR_RBDR_MASK (0x03 << NICVF_INTR_RBDR_SHIFT) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 094c5d5..501c8c2 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1527,6 +1527,16 @@ nicvf_vf_start(struct rte_eth_dev *dev, struct nicvf *nic, uint32_t rbdrsz) /* Configure VLAN Strip */ nicvf_vlan_hw_strip(nic, dev->data->dev_conf.rxmode.hw_vlan_strip); + /* Based on the packet type(IPv4 or IPv6), the nicvf HW aligns L3 data + * to the 64bit memory address. + * The alignment creates a hole in mbuf(between the end of headroom and + * packet data start). The new revision of the HW provides an option to + * disable the L3 alignment feature and make mbuf layout looks + * more like other NICs. For better application compatibility, disabling + * l3 alignment feature on the hardware revisions it supports + */ + nicvf_apad_config(nic, false); + /* Get queue ranges for this VF */ nicvf_tx_range(dev, nic, &tx_start, &tx_end); -- 2.5.5