From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700058.outbound.protection.outlook.com [40.107.70.58]) by dpdk.org (Postfix) with ESMTP id C30265F24 for ; Mon, 18 Jun 2018 07:36:50 +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=fDB1WDhz2+2ux4VjrQsamHyddbWW3vWYch2z7KFGkFs=; b=Yac87QNOvp3zwn8K+7DpRK3y2U8TU3xXwhzVOx2/xpB9w+H3gUhnTuGcgO1Wx8xGk6qGAWzM2w2s7vGCdWsz0WOJ3cnVhQCXYeZT8bdTRDvVBBu/CST4ClVrTKtFs6BiggnX0j59QoJqlZjnnarm4BTPV0XoUe2JefqFFlFYgsY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rakesh.Kudurumalla@cavium.com; Received: from rkudurumalla.caveonetworks.com (115.113.156.2) by DM2PR07MB672.namprd07.prod.outlook.com (2a01:111:e400:244d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 05:36:47 +0000 From: Rakesh Kudurumalla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, rkudurumalla Date: Mon, 18 Jun 2018 11:06:24 +0530 Message-Id: <1529300184-25109-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: PN1PR01CA0105.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::21) To DM2PR07MB672.namprd07.prod.outlook.com (2a01:111:e400:244d::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e922a987-1c5f-4b7f-23b0-08d5d4dd7cb8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:DM2PR07MB672; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB672; 3:2cqxkn9AFO9FAxO3Cbu6Q2TxMO5yW37EaXAOaxaBiAvQz6GFGWGIVwUAbyIug8l4h2mv65vjQ31AkZztVD5WN7drqsfB0uhx2PY1VcYyvqcUf4wzGjnO826qANFdaeJwx7EUZNP0Cqfd4wD9U+0Gii859GeDspof1rbZnUfhdEQHYotzn79lgFK3xGN0a7FeY1bi7cc38apfCTZez6aBzLyMF3M044TXpgXCKGvoVcECCsAXTgKS6fwmSCRgXPtg; 25:jGnsC5WK0eQUZvRsGiNRxPjiv6YK/4ftgf5Xs2M4i7CTBJJElaaUVYwRXx4KDriPHL1zyE7F6cubKm0jJkRMOPda4A/dbp2+l5cKqbMOuEIQ9OjlgH0ND6tMg5k/BUqRM2vZzPI/z+uW4XjKNmOeftbUf7oMi18l9gP+COFhBHkmPLEtpi+OvdbQch26+U9nDw+xQuWQdWlxVrEGwcFNpwT64+VbX3IZCWgmfDfFdxlMipMdtcFT2iI/PwWVhXFtPVe8Btqw6Oy+PO0o0dJfbWKnXrUOY4lhkr3rGVKVLBHctrzxP57HuYdy34LtAAcH4Y4yO1cJXKezIjPXn8ESBQ==; 31:keEai7MuiK01G8zOmyIZ+A0XTFY/ZQw9ERrMhIKbQnLSzgxBUfty3HxjL5h42NtGka8BYObkoVNoYsHkhxg46Ey9YGp4lLsqJQbMzAF5nQINxjF4OgShchVsRQzQGWW3Sr2/jnC2Okz5nGjLPJ65RO9VkyQlIPDR20GKoG9MDSt9Ky3G3LZjXGnliDNJTgAgojBeNiRdgSW0moTz+Gn2KZ9PkFxbFAOYGE6+IuC+eLI= X-MS-TrafficTypeDiagnostic: DM2PR07MB672: X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB672; 20:xN0VtvP45zhShZrE3KcocJoFXF5kRBw3U+RFimPL5WeZTPx4wX5zSpdSof60URbYjjvzwrqRzp7KiVmmNm0jDhnsINhHxBRklrjNF3b4WQIhViQs/Kzx8aQpB3TN5I9YlEZSQtUfi7IH/T8f/w7MGRWnaw1pOaMoVuTkSrOIPHO/upc/s5AociNEXRDQNFz/hmMbKxRc/VoLT7c5i1W8JvPM9EqCyZW8WwK1Q+r88uRj+V5H7mO3vR4iN3zb7GqtXTyAyroRfFp5pNWq5ZPy/1ZmLRmNnLaqk6drC/QkX0TYybB52Jq7Q53DlFbkUvYNcJNkb2HL2OmqIIm5pT+om9IOeVvCNbcLg2CEToEnP2BnruDQIulIJDvSVL/UgKazQt1HK13DetaGdO/UInuU1bF17bcxDXMUPcCmWRTZkBZfM76zljqMyxEUFb8k+QRx2l6aJUVrdTKRRghVRlEYKSXz1ibETrfw62WyyuhpbQfn4WPxBAo7qUF/19E82KJtvHSVwYiUaoCPKJ/9Sdj6VYNPQW/PySQra2Q5CsuRngwdMlZkECAmw0F/2gXnBFMEA4RIFVsU85qTL5dgTgfswffJEDCVBLwQKjxho4uym6Q=; 4:TvvYA5KZBcnq/YRZvQNE6nm1CFvBFWf5ybznHPTwKqQvgv61j67zbaEo8Sb8mjjLlVLkdILF0j6cnVU0pmL5ltlsYaB6bkDp2SIczR07r2sQpCN+60hhfYOvZoH/hbKfyh6eHx6UWw1bBDMRcZk6scWE/twndh2LmsfbrYyIN6pG4rvhFGAUuviEWgEcyNdO3WCwpegaahBuYdbYI+ZPvXCC+aoDe9aMPaSHrRi0YKN+33D3zuFSFB+idSpccJjM2ELXO6Ki7BbbfJiM5W5pIA== 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)(10201501046)(3002001)(93006095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM2PR07MB672; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB672; X-Forefront-PRVS: 0707248B64 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39850400004)(366004)(396003)(376002)(346002)(189003)(199004)(16586007)(2906002)(2616005)(476003)(956004)(486006)(50466002)(68736007)(966005)(36756003)(72206003)(478600001)(48376002)(316002)(53936002)(50226002)(8936002)(6306002)(81166006)(8676002)(81156014)(69596002)(6512007)(6486002)(575784001)(5890100001)(386003)(305945005)(51416003)(52116002)(16526019)(107886003)(66066001)(42882007)(6506007)(55236004)(25786009)(59450400001)(186003)(26005)(6916009)(2351001)(105586002)(106356001)(6666003)(47776003)(97736004)(4326008)(5660300001)(2361001)(6116002)(3846002)(53416004)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB672; 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; DM2PR07MB672; 23:POW9d/HkluPqDPFkaqldqPxllGg/10N6iDOnhTnT2X?= =?us-ascii?Q?lpbbD0PM4lmBjMwpCTumzsL9xKK4uDm8YqHpIhesscSFWL5kpNfZThbB4w/q?= =?us-ascii?Q?5cXKTK4CWZyGvH/7tf7VJYuzq/gZeG359HFK+Sy1iZ0+Lu2g/UctWPIifGvj?= =?us-ascii?Q?SpoBsOVHZKiklAAMAhquoJLPTJODcSKPPtPOOKR1Zqzyq72/t8WBjB7rqEJP?= =?us-ascii?Q?nZbq3Poi/LY5eet26cddZDMfxLUoaCeh4Hgygz4lhPqDVRzui4/2jtniFOkQ?= =?us-ascii?Q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6K3+Tq8Z4DFUtDZdlx0gVnHnIUBhpFm03VZFwPnMGO+vGq0xjzCrfFZ8088RKz0bJfNltFBd+jCcZDak2TnQA==; 5:thAfzr3vfuFueInLcPsyrVaaLdH9FlJJHUBdKq9UJRXVyTyFNzWCfX3NlJdBCwaRYvV2lPWQG/IFtMy2vS2MpneAbTRM6+2uFH4o7451WR5QvPE7WHVt9sCc1lAVC9hq+yCoSx59ZYGocBWt9UajbTFFUtG6v5oTRw6QvIpZiIA=; 24:4LAZVq3rsxSStorJMNj1eAMKApYN+I9p1mEq9eTgN2NtFqmFg/IjpHLxmFvnLkS33TpcRQtHSSeeKYVTP+mq7lsKp4q76KpsfP9XOdnNXo8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB672; 7:ASGiA//G+J4g/09HCzexhCrvDzFiHNVa04lPQgOJaKBppQ1SoaaahSipgYRIQKKxUsZHTtQ+Qyf1EVZPHOda6vFvI5VGc0WxYThSmaryt0EF1qhALPujUloBFl4AV7qTKo4LBqacg1eeHjOLj+7CufmD3VbetDHoXlDkQCM668CHMDCpC/jdrx9+7isypON+FKHGwueAW1KrU7hK8sHGIJEVw8GdI0zo3TWLFobExZh0CAI3LF/+N9n9JjFgoGTL X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 05:36:47.3409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e922a987-1c5f-4b7f-23b0-08d5d4dd7cb8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB672 Subject: [dpdk-dev] [PATCH V3] 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, 18 Jun 2018 05:36:51 -0000 From: rkudurumalla 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: https://mails.dpdk.org/archives/dev/2018-June/104240.html V3: Updated code-block console with example in thunder.rst file doc/guides/nics/thunderx.rst | 21 ++++++++++ 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, 111 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/thunderx.rst b/doc/guides/nics/thunderx.rst index 2642374..e84eaaf 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 +- Skip data bytes Supported ThunderX SoCs ----------------------- @@ -312,6 +313,21 @@ 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 +-------------- + +skip_data_bytes +~~~~~~~~~~~~~~~ +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. + +Example: + .. code-block:: console + + -w 0002:01:00.2,skip_data_bytes=8 + Limitations ----------- @@ -335,3 +351,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. + +skip_data_bytes +~~~~~~~~~~~~~~~ + +Maximum limit of skip_data_bytes 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..07e6a4d 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