From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690087.outbound.protection.outlook.com [40.107.69.87]) by dpdk.org (Postfix) with ESMTP id D41491DFFE for ; Thu, 14 Jun 2018 11:40:37 +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=SawQfTWYTnKTLBMTq4fWCA31WtEH1UK/oh3smUzFonI=; b=kHvOOKDErwwGXLs6hi94Tv4SFKbzkABKH78e8D7szGHakF9fJf+ErjVkTRvnlAFLLXoLl6YRpUc4OHPOcpnJWmtySzOiWp75qMlTaPptlPewl2dicFp17mF822BD0d+AkGNgojsCt2/4oYahFyavXsfsRBLsRzZElO0fauGO0Uk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rakesh.Kudurumalla@cavium.com; Received: from rkudurumalla.caveonetworks.com (115.113.156.2) by BLUPR07MB657.namprd07.prod.outlook.com (2a01:111:e400:89e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 14 Jun 2018 09:36:48 +0000 From: rkudurumalla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Rakesh Kudurumalla Date: Thu, 14 Jun 2018 15:06:19 +0530 Message-Id: <1528968979-25656-1-git-send-email-rakesh.kudurumalla@cavium.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: BM1PR0101CA0011.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::21) To BLUPR07MB657.namprd07.prod.outlook.com (2a01:111:e400:89e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c62a8683-9f6f-42d1-e893-08d5d1da5a70 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR07MB657; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB657; 3:gan7mZlr3mKu0KGzVwPgzshyVzJRgh+zH9T3zVRyEEMGbCsLts5oBTeegndiEk1yes+skPH0rEMJEVUKD/OEW6IakaLF0MzrLYCmP+uMFK1mrh85AFCMF6XCj2gHpYHWcgMVuATRKAnlGqLkM8z1dlYl1lUj/8ro3OQ1su3t+7esyBWioy22H1JAH3C0Z1f3VeiR0hBoTQ3ZfqHUh6KRy7eDM+vdFF4QnZp4qOdMvk4hvkwfYJLWpDtoR0wJ/Vew; 25:9FOQ4aPd99TdsjxrBSRy7G8K9HuyFMBSELii3+r+0c0WcBxFpmdcLlkwHNbCTKXke/ayfuJSIGHXOyy6CEULtSa5HFUx7OVNQMzIvODKIDSLdY92D6Tmv9VrvHCDwXi/HUe9K9Bnm9asFW/z40TstK/gVnrPmouAzIkr6VlaEFjec5oXMMMiCcZKdHlIQghW8d/AfVL6wjDzfWdNblZHaJj7enP5LMSMBDxGqHnYAkTpZB3FL9XVrAfG4J1BlFvO5wY5aibhHXCJv9T2+OhMGxH+yQ7TCJNWiRYV19NggGrfGpWAkseJFj6w7yKYzrIhUMAZEkrVt3R6W7ZGkGKVvQ==; 31:km0CiaRH0Dxqn26WprgKJTTpIxEbsXwp34bTAvOB4wD2/89N4AY5NRqBFfV2YWJp/Uv4n/vUOh0DXcDMlm5HDjlfhHwETyp3IL40BTYakaQSvtUdrKebv/f4oVvmnkk/Ko9Dq0QJyfJcK0yihrTQWWOcG8smzm6zUJ3n50GLmSJod8bY4EwRomeJx/1VBz0JnDRYRWTtKqrSePMW6gPwEUiMqKt4YNRJ2FcNbQAqXdA= X-MS-TrafficTypeDiagnostic: BLUPR07MB657: X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB657; 20:9nu2BJ0ch/rO+T0eUzkfILXTr6FdEax1g1gUiwkGF/FAmzPtkdzDsUArQ+1YPamkXcviKy0r+lSvh5lL0PVzNkj1AGFMVj+7o7XvWB5W/sAzO6+PA7lTglY1KFtMi0PBteP2vScoj2kmRs8lX/F/qu5mC6nkVdskcfOsQ4P8EdWQchVMeOk09hlUFGM06yghrJLsLmyOTRj7hiowLeYUCSCbUfQfmteeGVrWlt575iAJ1f2hs919iG9EQCpdjIy39SZWfbLbNLdyF5+X1/ahnfoQoS5PKresIfVfqNCxHVw2t+xjr22KB8pEOCvOYm7hoeLKt9K8D77oohg7d/xcHjZtuu58jqJ84t6WdwYk5lAzAOz9/5MThBsy82cWWznGaBEUdlfIKXYQwM5kV/R7BH2wQSHhbJ9yRq+2vMn4hqG81zCWjRWvMe0BrUDVmdI/ETruvTCs10QTtkK/BXWuxdsFbX1/BfBclfArT9nUZzNyFe8/4tWKSULnLbbkZZgb; 4:rcTJ4tE05yrEu+JGmbMS16Rv4+Tl8mOqUmaQwPdpSDvbm4uj7p4v3QoirExUVN9OoK/9ma7SLgMgiPaMwtadhNb81MwHvqfJRDiJl0OhwC+FkEzvlg8BfGWjgJjj9JeADRwxskKyiLnSDKazRbJeBZzPQHSv7EinsjKwSO9ZqHF8l9/xioDUCzG3zyoHNyJ15ksz/PK47Ls0QUBsCZi0jthZjTsq+1r/XM0u0HgazhKFTBc9+KsNRctUXfqJrZDl8GpC+k6cE5dGDaPWjogXgA== 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)(8121501046)(5005006)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:BLUPR07MB657; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB657; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(366004)(346002)(39860400002)(396003)(189003)(199004)(2351001)(25786009)(478600001)(53936002)(81166006)(51416003)(52116002)(4326008)(107886003)(6116002)(3846002)(105586002)(7736002)(106356001)(53416004)(8676002)(81156014)(8936002)(5890100001)(966005)(72206003)(2361001)(305945005)(16586007)(316002)(69596002)(6486002)(50226002)(486006)(5660300001)(6666003)(50466002)(6916009)(48376002)(68736007)(66066001)(47776003)(36756003)(16526019)(97736004)(2616005)(956004)(26005)(186003)(6512007)(6306002)(86152003)(86362001)(55236004)(476003)(386003)(2906002)(6506007)(575784001)(59450400001)(43062003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB657; H:rkudurumalla.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR07MB657; 23:ajovZkjXUIo6GCCqfSvL5cIL/9VArgNd66H26AoSM3?= =?us-ascii?Q?lzoAMoHBiEIHhfYgFt1DEqhEF0Y6+F2yQNdY5pm8cb7aQtIYuZHyjl8oJsoM?= =?us-ascii?Q?JsAj18NzVapWrkz3WEjEIEljDOgo0xnnUz26zpOIUebaDwfDIDNJpc45YeCo?= =?us-ascii?Q?79RXtSInTUk8tbwUegGwCgHrEqHadCBtEGJnOK6O23aZ3Jfhmuyf/Pd/CSg5?= =?us-ascii?Q?WzgQ7DKrlMNkDigU3bWTxTNA7za5a0xjqZKwHLXG8N4agnDO57oTVT1Ng261?= =?us-ascii?Q?Bm1QzTyerbzJkAQtz5KiIqLAhmujiSJDH/aiWsWoL2nONMiCnfFpQ5g9VTAI?= =?us-ascii?Q?VGzPH4DmNhSVOFMZLl4O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uPnuyi4rDF4gLdNw3mZEZGdhq4hVy04t+mqOCJagOKd+XJbhTnmewg8tP+cYh1v/yig=; 24:44qOezHrt1acyWsMMCXnAyPjoL/cHPybo3mojDyw5C/ghV6mXd+0vPj4wxczthvyLLliDobZ183IOAukXVg2dwlRWgIZkt2ktH/bJkTRy9A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB657; 7:neqhdoPDZ5yq6bOLjDUqo78c4ag0N636YxhAGaJgXRKYCYtYe1xbfXgrm103PyMAdPJYqKkP7fSxI9Qyku6JMHwqfybHKVQP6yTqqALC8hZIceNx+te3nGQORAIXcI78kPldybZ6GzrJVlPPeMiqqdNiu2FltESJbBWul5A8ijT3+sdMX6QMzc0geQEpLs3tRCjoRo+yka0yh65IGNcQkJfcv7gKlLekVwMJUQJcmB2ty027BWUu8M/EM4gb7bnf X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 09:36:48.0337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c62a8683-9f6f-42d1-e893-08d5d1da5a70 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB657 X-Mailman-Approved-At: Thu, 14 Jun 2018 12:47:33 +0200 Subject: [dpdk-dev] [PATCH V2] 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: Thu, 14 Jun 2018 09:40:38 -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 --- V1: https://dpdk.org/ml/archives/dev/2018-May/103058.html V2: Includes changes in thunder.rst to render outupt correctly in html doc/guides/nics/thunderx.rst | 18 +++++++++ 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, 108 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/thunderx.rst b/doc/guides/nics/thunderx.rst index 2642374..7825b43 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,18 @@ 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("skip_data_bytes") to pmd. + This scheme is useful when application would like to insert vlan header without disturbing HEADROOM + + + use ``-w pci_id,skip_data_bytes="number of bytes to skip"`` + + Limitations ----------- @@ -335,3 +348,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