From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0079.outbound.protection.outlook.com [104.47.37.79]) by dpdk.org (Postfix) with ESMTP id 1625716E for ; Mon, 28 May 2018 14:57:32 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=dLAVh+nyv3nauFfMe6h1qHr5t9wut9tMidyo8DKQFOE=; b=FqkLZ16qAcbjVhL5mNk9MO1BDbKe734WYqYP8ZhL7c6nhKwmbj4LRjFuR3uDKMrt7U6ARdFr6we/hR4DwVNcJqmLs04SpI2jLsfVk1J0lGXh7KkKwBExzEPvD+p0jH/9xncOlwtKsYI9NnxCMse4BxfS2zl7y/eC+lpnwmezZJU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rakesh.Kudurumalla@cavium.com; Received: from rkudurumalla.caveonetworks.com (115.113.156.2) by CO2PR07MB667.namprd07.prod.outlook.com (2a01:111:e400:1421::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.16; Mon, 28 May 2018 12:57:29 +0000 From: rkudurumalla To: dev@dpdk.org Cc: Rakesh Kudurumalla Date: Mon, 28 May 2018 18:27:04 +0530 Message-Id: <1527512224-13113-1-git-send-email-rkudurumalla@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::11) To CO2PR07MB667.namprd07.prod.outlook.com (2a01:111:e400:1421::25) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CO2PR07MB667; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB667; 3:rAHX/og7+5SQIebIIsGlWwoAzXBqr1gZvk7441NHYw6Yeasu/n6IKcjZhWjVrrhX5V2yF+7ky9PakZP0F9BRBK7x2HJ8pn+3akmC8OeqCfV9CLgnTTRGwc180F3/z+zBZC2bZFW9TKK8ph9/V1mrjbHHtkSGKGXLQ5oBv0M6GvXOz9wM+TMROM0FjxdF3/J9YHbM2XABgpDEqAlYrp8N6wzSIsk3mqoezSWfTcteT49Cn89j0XVig7Sl0E5vmmAU; 25:UcJLLZZFKDBU1nOYytaT+vfK5wZ7ah3hmWRJaYL7FfFAAK82K9NjDPR3Ir+qr1+nTrfI00TN22vhatnRMOwo/iODCZw1ExkKLE08GWw50ZPp0/nJMURpCnC53HUJIoPmyR7yXBuW+bjiDJ4wW84YwyEkm09KAsD/Hz14gUiR8euF/5gfLoa6jqU04zThnvo0zfxJHHh90opX6NQmG5YqyxGZI5jQxLFpYdy0Ol8/famEwFB9dXT0AjyCzPyNCShCIMzJvOnG7eWXrtKuXCdcPJ8VzXfX8EnRqFo67qUcJBGLIpLMIR6oQkMzQOb8QG7uGPjS4OAIv9zWXI1bMcBPcgToSIXmNI4ePyZU2pvs9t0=; 31:u9cOnPfOVfs/PnVdzP8dEJy+QrU24Hpgc2a7h4BcUVENSM7qYqT663PpUfeQ3DObF9mKtLwsgf/TdUoZeZNzUfltCjR5qd1gO4cCO7jsOxkL7OspwNvxoHt2EIW0XHIZv7MoZQ/6O0nBmKM1CD3AgW4rah0ptfsr465Mkpwl4DbKZmDjwLo+8gb4UbFfuwCqUZ9sjhz5io52XJpsEj3CP/+pvzoRZjcBQX+UixY2Zf8= X-MS-TrafficTypeDiagnostic: CO2PR07MB667: X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB667; 20:sUJjWsY3Apxk6rzfSHXkBaWJON2MrjzqSLiCF3UqdJTy8iHsWGZ3hEu6uEKQ3xC2+/TDm+4il6q+O4Ds7qRYsmT23YrFWAE7gNbedFPsWjCNTT4ANs6mDDy5v1iqz+X4kliJllQe3MgT7wwsZUygO1UrD1JYcNLyChNm86wD3tk40myNf8bsaoTC/l+Dj837rLgr89ZbX0ye/hcV7j6ODxfvYhdeuivkBGZOs25HcIm4mBnAuJFi5zEUHnliDeerjCWU1THsSwPHekjYTCQrcGL2ZMg0BHpo/TII9imJTY4StBEeQ0nJa26wRZJlIvt+DjkE2r4FwtA3O6f0pMlhSk2iaTgVCVgGM5MRSsGgSwhYCHqRJmxcQ8ZtfWncJ+/NEcgdV9tggNplpuzrvP8sLbT6sEkckHE0vKS5O5n26ER0O5+H8DnEkkTKgBjCP6tySbK7NmAKIIt1Xe1dpH7ptLrQL1UTMy6UMxl583DbGZGKcyuoqBh4R5VGsWPLugm6K3CgZuzl3OaY+30H3fVCllc7LLFnm0NaLe+A35qtID5ik7ikfwXYUDN83ZyHvpm/7BuxuKBOwADAMccRixBuH/Ew55jNbD0BpX+tJrufXDc=; 4:3UKu22TjAQ039BLAB24qoLkUy0N6VGRG4NqXG72L6UUIaYeU0AgHioEuHmwsMOINS8n5M1BofoHFONX90G4+2dBfvY8bYIJ6ZadD3/DO710qnvfixrlfNl/zubECqojPwq+jbFZEVVUASB4238eUhb6UBFmJFZHoN8dXFgmNcQ2MiMCg83KDtvQLcjBpXKto1l3bT+LAazvyyEi/yiA98sazdQvT7gcu6Icwi5Rp/566qTD1DAnIHLoE8pB858/mlUFgicjlZv2IdBdpi4ZWYw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB667; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB667; X-Forefront-PRVS: 06860EDC7B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(346002)(39380400002)(366004)(396003)(376002)(199004)(189003)(81156014)(575784001)(476003)(2906002)(72206003)(3846002)(5890100001)(478600001)(16526019)(8676002)(6116002)(6486002)(8936002)(50466002)(6512007)(6916009)(81166006)(2351001)(68736007)(316002)(5660300001)(50226002)(16586007)(2361001)(86152003)(186003)(6666003)(42882007)(7736002)(386003)(956004)(52116002)(25786009)(107886003)(486006)(4326008)(53936002)(53416004)(59450400001)(6506007)(106356001)(51416003)(66066001)(26005)(105586002)(1857600001)(55236004)(305945005)(69596002)(36756003)(97736004)(48376002)(47776003)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB667; H:rkudurumalla.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR07MB667; 23:YMFM3/c+61XVJsKg0oPxW1pYOoIClf7ES1qdk0gIoo?= =?us-ascii?Q?qgE0eiPjigzkPjn2LbDiEr1ZN/w7ZrZEx0zevAkeXFAwz7YngL0ZyzG2NEhD?= =?us-ascii?Q?E3guzpDiwFIwLrIxOzWbDeTr/lvpTaLT8bio8E8nklIjz3zZXHcqkRqJLfBU?= =?us-ascii?Q?L4bIQyeCovvGwmLHw2IASqyQHBqTknVpKJKxWjDYNsxAEise5mdMG+xY1edw?= =?us-ascii?Q?6JCrynQCltOc/haqnOJaKrHQpON/A8uUeReTZjcCoUIITsRrxL6YQyrI6lSJ?= =?us-ascii?Q?bkIjrYQByJzLo5C/TpfPITSI67pEQF8+/H25AndYLeUSmqJ4u3+wy68xueGD?= =?us-ascii?Q?a9W6zUm1ovbjQvKPmjy9DvIKp4tDFD5nMFGq9FY2Stb+wL2E5AWA4CqEAHIY?= =?us-ascii?Q?jfwIDEj+bdzwmjagkprUStAdKiM8tguuEk7/vybaJLbFY8v2qcOUATem+/GJ?= =?us-ascii?Q?58E0NFlyvYzwO7ek77GHsxPGqKEjlGb3DQ3Vd19gwngwU7pUXYtv5XnxqWZm?= =?us-ascii?Q?+5QSmXVek++Z/nyvuImusjdRI/l1GUnj2YkX4jH+o0Ka4wsomLLJK0P1Gbil?= =?us-ascii?Q?Fvj+ULTHS8qPBjJSsckLF818ISv2n387y4iI/cN4HeHkVcnHEzB6M2jZhMMB?= =?us-ascii?Q?Nzzj5s+f4gNl+BCNqOdi6kmmxrHRstF6vInArMp86wc/S9Y+FlMHgBH4/SYX?= =?us-ascii?Q?mPXtVCJEMshZWqv2L9JupRmHvKqT8sFqTR2UYnEyuBxVopR6B8TXDynNrBvG?= =?us-ascii?Q?2fRNQHlBJhD86cIsHwz/auVaJ2WlBHHMLZCYntMhy6txv+hBHhM0qbZ0hFfQ?= =?us-ascii?Q?ccgSda9QnQAtMJ/fNEZ1+HKxgd5cz/scWxCAk7/u1D03rB/+8LonPzJxvuHi?= =?us-ascii?Q?/S3BLDJ5Fe02l611ej0ZC6+wfLI8uCrWw5Tt+wjs585/pwXjglgqo7c4vswA?= =?us-ascii?Q?i3kiIVSHz+aXx5//oPPiekz/zwA0eLW26yZCqx+cc8w19I6pCKSBg6F0D3yh?= =?us-ascii?Q?QEoXETZ/tvqnL36HHST47boWDzqwcKWsEPyICVDdpj8UaKWyuh+4bBVWo/kf?= =?us-ascii?Q?MEiYMVb+Kv1f2MTlI5pwtTkeJ/fpRmq07M4bTFiz9Ur7eCaAUGfGrU2nyD2A?= =?us-ascii?Q?0jZdrztVK7dyw7WpBGIDFtnD/4+ia5GE/Aj+Bf6T0YhzSckgkOOvs5PseM/X?= =?us-ascii?Q?r+NnNKSH3H6mzFfhPvt1Eh4oS0vckceirq5DiwX9KAv2WXJQpb8HxWa0C1jH?= =?us-ascii?Q?EvP5d2hn5ayV02eNcroGsibsz7r+KWBWV0585F7MpwBFGByA0fFtFY/FpDvu?= =?us-ascii?Q?b3YSK8udPS5U43GgBCDhHh9EfRcvy8HgWBzJxaDX81nrI0sD1kiZoPD0dV2F?= =?us-ascii?Q?R+nNqEREbXC3VfKjsbfSxOdDfLMF+xlXxaq60j6kQSTT8d?= X-Microsoft-Antispam-Message-Info: uewQM6ec6mZs4055e82MD7dMJbvmAIlDMwmYf5r1bKBZhcXAF0qNjkCBUzzvedug9tIhOLlA08qiSy1F5SHjJfFqhDS5CdptuFvIIDz9tnKxPHbeLKwaAbY8L7ziNtD4OgsTlMkcrS+qjVP2uBCnZWEuQzh2+y/acsosJJJdxTfYe3pDmLToV+u/8UnMl+mY X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB667; 6:D653O56tqQZ52XiZCf51K30WYCXRVQtrH/KVCxntvOsVCg/Z3pqwhmYpfcHZjf73VjfH2y9OJdT+2i7Km+aeSr1+cQHV+PzE14tqzO4SIj6veI6251A6fyzJh5F/NCF7R11nYzMkkwba7sNECu2qsRuGYvzSbfo8fp1G/j6fEFsDhl8S8aXcR3kya0LQa1gIsRPsahVLQaGXAseamcRpI4Jlqq6ejlhKlDBjTMURBWLzJ1Fo3xXx94fchN5Sr7VK5C1WV0UPoavoL/9jgGZJ0Vq6i4q+Y8kqkJXOFlfilBy5jaU89v2klDwESxKJ/+0gKCGVsP3RUQ+KW5ucMyyoX1mLy3okUEorAiJcE7sU0xwIfu6Bc900K6JCu4QilQe+5Veb3URDaA3aqf7sYvbhd/m8G1KSRZkIH+isFprw6P80NB9Ni1qMVTcE41suDDF84r/w0IGSC075jNaLZacgbw==; 5:Xg533qQHRnzR/YU9zZx13oKPyyOV0fzbvQue1WoSyXlT/7Zu20PF7sUzUJ87R8pojEi2sdH7dGaY7qk/+6fE/m+E56AszG45pehK0okBtpcfQAAf1E3FapfPPB6zihhJh0N2mVBHAGCclbvewyQbqdUGmZzkwT47sbgUbnMnbdI=; 24:xh9MTvas+KQk8W6PD82kJJMLn1juUcP9PS3vtp8GUwQIkXlni6HWO0bfzsKmGDPmXbQlPXg57oZT4IjOzC0yVAZfb5+1XnFLc3F5kbM3nPA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB667; 7:VfUp7tWAAEC3PgJRWUsFRBRMta+FR2V3NZtwil5qNw5p1tWEsVcylJhLDOIiH7r5C6sScGQ412KH+2Y8bTQ8Wj804ewEza3xEzZa6JdT/iaQJNBDky8KvVaNqzvN4DcGfeiGVp1Y7BC2QCMyr7qOeLy1ZzJMlORmYMakmNeKSazgJvKxbK5FS+z31GgSQDu0jAquN0JAIni54i5If/dZLMB9foPCm5hnskPD5MfbGcMU2FXgxTIw0g8v47e7oYGe X-MS-Office365-Filtering-Correlation-Id: 66df0d1a-ec0f-450a-0f9b-08d5c49a9258 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2018 12:57:29.1733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66df0d1a-ec0f-450a-0f9b-08d5c49a9258 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB667 Subject: [dpdk-dev] [PATCH] net/thunderx: add support for hardware first skip feature X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 12:57:33 -0000 This feature is used to create a hole between HEADROOM and actual data.Size of hole is specified in bytes as module param to pmd Signed-off-by: Rakesh Kudurumalla --- doc/guides/nics/thunderx.rst | 26 ++++++++++++ drivers/net/thunderx/base/nicvf_hw.c | 12 ++++++ drivers/net/thunderx/base/nicvf_hw.h | 1 + drivers/net/thunderx/nicvf_ethdev.c | 76 +++++++++++++++++++++++++++++++++++- drivers/net/thunderx/nicvf_ethdev.h | 1 + drivers/net/thunderx/nicvf_struct.h | 1 + 6 files changed, 116 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/thunderx.rst b/doc/guides/nics/thunderx.rst index 2642374..3d68c61 100644 --- a/doc/guides/nics/thunderx.rst +++ b/doc/guides/nics/thunderx.rst @@ -30,6 +30,7 @@ Features of the ThunderX PMD are: - SR-IOV VF - NUMA support - Multi queue set support (up to 96 queues (12 queue sets)) per port +- First skip support Supported ThunderX SoCs ----------------------- @@ -312,6 +313,26 @@ We will choose four secondary queue sets from the ending of the list (0002:01:01 The nicvf thunderx driver will make use of attached secondary VFs automatically during the interface configuration stage. + +# Module params + + This feature is used to create a hole between HEADROOM and actual data. + Size of hole is specified in bytes as module param to pmd. + +Configuration and Options +------------------------- + Use ``-w pci_id,skip_data_bytes="number of bytes to skip"`` in the EAL options + Example: + + .. code-block:: console + + ./your_application -w pci_id=skip_data_bytes=bytes_to_skip + + Ex: ./build/app/testpmd -w 0001:01:00.1,skip_data_bytes=8 -- --rxq=1 --txq=1 --nb-cores=1 --port-topology=chained -i -- -c 0x1 + This will create a hole of 8 bytes between HEADROOM and actual data. + + Use case: The hole created with first_skip can be used to insert vlan header without disturbing HEADROOM + Limitations ----------- @@ -335,3 +356,8 @@ Maximum packet segments The ThunderX SoC family NICs support up to 12 segments per packet when working in scatter/gather mode. So, setting MTU will result with ``EINVAL`` when the frame size does not fit in the maximum number of segments. + +First_skip +~~~~~~~~~~ + +Maximum limit on first_skip is 128 bytes and number of bytes should be multiple of 8 diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index ea8092c..b07a293 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -703,6 +703,18 @@ nicvf_vlan_hw_strip(struct nicvf *nic, bool enable) } void +nicvf_first_skip_config(struct nicvf *nic, uint8_t num_dwords) +{ + uint64_t val; + + val = nicvf_reg_read(nic, NIC_VNIC_RQ_GEN_CFG); + val &= ~(0xfULL); + val |= (num_dwords & 0xf); + + nicvf_reg_write(nic, NIC_VNIC_RQ_GEN_CFG, val); +} + +void nicvf_apad_config(struct nicvf *nic, bool enable) { uint64_t val; diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h index 284d0bd..fd13ea8 100644 --- a/drivers/net/thunderx/base/nicvf_hw.h +++ b/drivers/net/thunderx/base/nicvf_hw.h @@ -193,6 +193,7 @@ 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); +void nicvf_first_skip_config(struct nicvf *nic, uint8_t dwords); 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/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 99fcd51..466cb86 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include "base/nicvf_plat.h" @@ -1230,6 +1232,7 @@ nicvf_rxq_mbuf_setup(struct nicvf_rxq *rxq) { uintptr_t p; struct rte_mbuf mb_def; + struct nicvf *nic = rxq->nic; RTE_BUILD_BUG_ON(sizeof(union mbuf_initializer) != 8); RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) % 8 != 0); @@ -1240,7 +1243,7 @@ nicvf_rxq_mbuf_setup(struct nicvf_rxq *rxq) RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) - offsetof(struct rte_mbuf, data_off) != 6); mb_def.nb_segs = 1; - mb_def.data_off = RTE_PKTMBUF_HEADROOM; + mb_def.data_off = RTE_PKTMBUF_HEADROOM + (nic->skip_bytes); mb_def.port = rxq->port_id; rte_mbuf_refcnt_set(&mb_def, 1); @@ -1260,9 +1263,19 @@ nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, struct nicvf_rxq *rxq; struct nicvf *nic = nicvf_pmd_priv(dev); uint64_t offloads; + uint32_t buffsz; + struct rte_pktmbuf_pool_private *mbp_priv; PMD_INIT_FUNC_TRACE(); + /* First skip check */ + mbp_priv = rte_mempool_get_priv(mp); + buffsz = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM; + if (buffsz < (uint32_t)(nic->skip_bytes)) { + PMD_INIT_LOG(ERR, "First skip is more than configured buffer size"); + return -EINVAL; + } + if (qidx >= MAX_RCV_QUEUES_PER_QS) nic = nic->snicvf[qidx / MAX_RCV_QUEUES_PER_QS - 1]; @@ -1298,6 +1311,7 @@ nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, return -EINVAL; } + /* Check rx_free_thresh upper bound */ rx_free_thresh = (uint16_t)((rx_conf->rx_free_thresh) ? rx_conf->rx_free_thresh : @@ -1498,6 +1512,7 @@ nicvf_vf_start(struct rte_eth_dev *dev, struct nicvf *nic, uint32_t rbdrsz) return -EINVAL; } rxq->mbuf_phys_off -= data_off; + rxq->mbuf_phys_off -= nic->skip_bytes; if (mbuf_phys_off == 0) mbuf_phys_off = rxq->mbuf_phys_off; @@ -1978,6 +1993,59 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .get_reg = nicvf_dev_get_regs, }; +static inline int +nicvf_set_first_skip(struct rte_eth_dev *dev) +{ + int bytes_to_skip = 0; + int ret = 0; + unsigned int i; + struct rte_kvargs *kvlist; + static const char *const skip[] = { + SKIP_DATA_BYTES, + NULL}; + struct nicvf *nic = nicvf_pmd_priv(dev); + + if (!dev->device->devargs) { + nicvf_first_skip_config(nic, 0); + return ret; + } + + kvlist = rte_kvargs_parse(dev->device->devargs->args, skip); + if (!kvlist) + return -EINVAL; + + if (kvlist->count == 0) + goto exit; + + for (i = 0; i != kvlist->count; ++i) { + const struct rte_kvargs_pair *pair = &kvlist->pairs[i]; + + if (!strcmp(pair->key, SKIP_DATA_BYTES)) + bytes_to_skip = atoi(pair->value); + } + + /*128 bytes amounts to one cache line*/ + if (bytes_to_skip >= 0 && bytes_to_skip < 128) { + if (!(bytes_to_skip % 8)) { + nicvf_first_skip_config(nic, (bytes_to_skip / 8)); + nic->skip_bytes = bytes_to_skip; + goto kvlist_free; + } else { + PMD_INIT_LOG(ERR, "skip_data_bytes should be multiple of 8"); + ret = -EINVAL; + goto exit; + } + } else { + PMD_INIT_LOG(ERR, "skip_data_bytes should be less than 128"); + ret = -EINVAL; + goto exit; + } +exit: + nicvf_first_skip_config(nic, 0); +kvlist_free: + rte_kvargs_free(kvlist); + return ret; +} static int nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) { @@ -2087,6 +2155,11 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) goto malloc_fail; } + ret = nicvf_set_first_skip(eth_dev); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to configure first skip"); + goto malloc_fail; + } PMD_INIT_LOG(INFO, "Port %d (%x:%x) mac=%02x:%02x:%02x:%02x:%02x:%02x", eth_dev->data->port_id, nic->vendor_id, nic->device_id, nic->mac_addr[0], nic->mac_addr[1], nic->mac_addr[2], @@ -2159,3 +2232,4 @@ static struct rte_pci_driver rte_nicvf_pmd = { RTE_PMD_REGISTER_PCI(net_thunderx, rte_nicvf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_thunderx, pci_id_nicvf_map); RTE_PMD_REGISTER_KMOD_DEP(net_thunderx, "* igb_uio | uio_pci_generic | vfio-pci"); +RTE_PMD_REGISTER_PARAM_STRING(net_thunderx, SKIP_DATA_BYTES "="); diff --git a/drivers/net/thunderx/nicvf_ethdev.h b/drivers/net/thunderx/nicvf_ethdev.h index ea8dccd..9af5088 100644 --- a/drivers/net/thunderx/nicvf_ethdev.h +++ b/drivers/net/thunderx/nicvf_ethdev.h @@ -51,6 +51,7 @@ #define VLAN_TAG_SIZE 4 /* 802.3ac tag */ +#define SKIP_DATA_BYTES "skip_data_bytes" static inline struct nicvf * nicvf_pmd_priv(struct rte_eth_dev *eth_dev) { diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index d4a83c3..cf98f7c 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -99,6 +99,7 @@ struct nicvf { struct rte_intr_handle intr_handle; uint8_t cpi_alg; uint16_t mtu; + int skip_bytes; bool vlan_filter_en; uint8_t mac_addr[ETHER_ADDR_LEN]; /* secondary queue set support */ -- 2.7.4