From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0052.outbound.protection.outlook.com [104.47.36.52]) by dpdk.org (Postfix) with ESMTP id B1242FA75 for ; Tue, 21 Feb 2017 10:29:46 +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=Qf406/5D2EP/f1hNpdtVW/zctReNwFx/ShRRSS3yNok=; b=Y6Njn84E7oD/YlKiRP5iqxPpaWH4EuSPTmL9xFqjybHOM9fywSj2/4Vop66+fzZu5/AO2zJMt9JnQKhAfnkdCrq/HMTfZpgk0tdCbYI7xADpDzvn0npK7YOvL8+RixbfYpgzVlxLWVpA1gNSRICQxnVtfpawWwsuPyUanr5dKx4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:29:42 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:46 +0530 Message-Id: <1487669225-30091-32-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: d8433b59-586c-4a02-f0ec-08d45a3c2b9e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:F+BtmUVoXUmLXL/0PGhtWa5d73FMFhnG5CZyEXdHiw/xWLbpSvEhe0tKFBPc86r9QQxI6jsSI3rBqgAp79orGnCGPJ7UTp945HC7jsfELqbSBPS1Pn2Nwz3zPfTvigaXNcdMYoWCpmG8kSd4/5x44e5lL++ps1BiDC8qlukcMZE/rxs6/8pi65rn/fHfUzTEKN23/CD2s7UF5fMf4Xkj0Ik9jTHsKQPPr0MOWhJEGTcHNGWKczwXnVo339F1obF/m4XgVy2RPd8teGT1kay6RA==; 25:v5aijVmlnyvA03sbuTXRPs3aumjEEpABslWsdvuFFslSO8ltBpCtbvia0mK0IL34KndGHOZuUzcgQUTwBOQGtAWvDTC7WmXS8cR5VNUcGi6UqsyCs4WUPYVQY3nN84q5wQNThDp4DQbJYVaRfSbA0Pv41HMfIclv1FRzxoBRK86g6IJ8N2NsjASQe9vWHCukfaXcwcIwWWiAgYCE0D/bi04Tkx5jb8jC0VgPo3XWJye26ujD2yw3m9vEsvXYTRdAfiDmZ6OndzROeEjH6vRExQ7iixjflvr62rzK5VzcYPKj+u3g770XAAlDO4tfxdEPGgtXOeWoaLLxaZbpMO5DUqZ5TRnioxEYuPHrbeIKZQgOfA//72XN843HgfBEXENhn7DXjyeuPoRrUcTVctTD7R4CWN4kjqNbU08aX8aOi2gbizgKZMZh9fqmvrkiKubv+EFHON+LBdlpHxKFQCl5VA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:1gLNL4cNfGKAPlEbkwQ0Qcn6PUXwknVlVFiP5jyco9Sm2meSWTC8dzfOdsVv2fB8f98rFoNR1OXn0201v4wZHsNdw2iYqfqJLv3egzURdsSRcb2JsFveYT0aOTweRqlxNXWwbSWx5cLadiCSrRq37mMvzRb28dWjQbL61Wr+l5PB5FNM149OzFvOXnw5+hhZpEbaoVwVtEJunRDdNumJmXRRS0ycOVixjH10U4e1wzeR1B6tYdH5rDriTQADCcLWmQ1gE3zTy+NwUVHmPXpdzA==; 20:mBxN0Rt57yh295oOQvLIivey0clI6xihVBU1mq1r2Vd3SLNbScOLsGkY5G0U9iaMYb/PUmzQLft00FfuJRijCasHh6FkK4UK5V8PYHK7fPYAIGm/EIS94bOQ5ZlQwb+rLJjPyXXvgrocHbDGSrxIRgusPM3mhua6oeoRE/Vc0ETbxz+XohkLUxzs2M8AB5FTATkj8uOTdEVeTd9L8VkHhtRaL7N4pHo+cKDN69Ya2iuoBSxyKBa5TE/0+m0CGgRtKTJb3T2KpdgVzf2YBFsYswSTX3d92jl4dIWRasp592N/3g1FP6FVAtIbTXhjbs4W2u+sDW2aWy5jGPQMwpi8D2PGLS5cJDEw5XDuCvYh/7mVRG7mN3VXXo+WlMIr3QKXNNZIud1qaMqrwUi/kWxccmr1gMXIz/YL1Gc3MfL2W3pIKmIsO0P24Hc6wUggfiYG43k/FNg8AFEfYTDFjRyJh1NmmksevJdNQRKaHYsHmaEpyLnTdBMYS4Buv66Gyux/xGopDqj/XHXSbBVg8emFa/wCJMuIb2kDQsIuV12lgqs+EVR93pOgDY4SitAdkQIHy3ffKBTb7s5LsaHOViA7PBsrBdb7MLOG5HxoWYnr1J8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:sTOLhsqx3NKsTOf8KtzvuZEfYIvnz4BT0JrNlG2v2mJOugctBUgXqzuIlUD8OQo/Ge5Uvf+P1qyPqfPesgd7ZQqB3iRclN6Xgn6+Zz21Z9QW5xYZHTaI2MHeQyJcW2gxB2zMQ4fZGAgdYZZpx8vdG9gBHpKfMidKSPssExgvcenCrxf4xiqn1pf2ZP/M6s0gGc1L7SpmrWJ115pBENHx9PxgeKMzQEhYjeFScJd9SwRm7vbaMViV6YO6tYmT+QzlPKo5EKUrLCmD4FFtPnc9WiSiPr9I6C1FJZMI7grgYawBeTpkHY9RzGMa23292kLuCKorLjcIm4M913+dopuuZiBoe9RpbUk45E77AOJJjz/rXgsS9UjzJs4Po3gF4ddVqxQP9mfexACm5RfvwIhV4HOaU8olX5S/VAcIqtC5espwQ0IWBdSp8KjYQgEXBE+ayg6JWdtn5NUC+wGFAYyzzQvXCW1eMXKAM3QGekfV3ZYj0v9oVHWRbtwG8z1NSjx+n53HYfWJ5uC6TlJtXCCoxJkIB/vwZ8RFuyGnkHrBGQoYNNoo9Dn9VjACTbtMDApoiR7vldQTsns68cbkpIoZ3j+TEhmKdxasO8/PMTVgx9g= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(575784001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.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-Diagn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jHQ9v+MWgMUYILh5tka1syI2XTjIsnkMVjfU7plLnrS6R4Y3UF0YeBxG6gl6EFfZk1lQy5xhVEHoS//tXJg5SKyk8k5igK7QsE/l2SfGumef+0R2rXjWA==; 24:zgjxC6ivk1qe8/pwIe8hfcljfkuCCW32ShCGwV9STSY6ivy3sS2hOCxZHd8l19nrGpNzJyhkAqSDm5ThJpm8KQBAm4VKAvTSyxnt9dTJJ2c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:EiJ5JwAYrXF5y8SnFD1CAyIPuQW3U6638oY9RYDBNPVMvtESMEynjIU32VID38Jz30H/+Bq9j7a3A7SwSl6hIw3RXE01I14lK+jincWlzUkSqd8Tcc0M+gM+G0rmdfmVfeUizkFjzyCSUGR7oY/7uScapJdOv2mc94hraF/S0HHpJPV9TwKsvLb3wBh6+hTetHaV6Y6TwANXatuKwVibcKzOGUl4MnTSlhEtW+g++8ZoukSWaQ55vEpq2Ov0pj68lZXnCpflwluPt4+IK/XgTsyAZ0ooJ0+mb8UxJ0EBpC++OBJt2nxeUQt3fzJfEnEBWUYc4+l6zBaFgcWoLpylUg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:29:42.3550 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 31/50] net/liquidio: add Tx data path for multiple segments 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: Tue, 21 Feb 2017 09:29:47 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_rxtx.c | 62 +++++++++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 11 +++++++ drivers/net/liquidio/lio_struct.h | 24 +++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 9ec4c12..32ef0fd 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -1451,6 +1451,68 @@ struct lio_soft_command * &cmdsetup, tag); ndata.cmd.cmd3.dptr = rte_mbuf_data_dma_addr(m); ndata.reqtype = LIO_REQTYPE_NORESP_NET; + } else { + struct lio_buf_free_info *finfo; + struct lio_gather *g; + phys_addr_t phyaddr; + int i, frags; + + finfo = (struct lio_buf_free_info *)rte_malloc(NULL, + sizeof(*finfo), 0); + if (finfo == NULL) { + PMD_TX_LOG(lio_dev, ERR, + "free buffer alloc failed\n"); + goto xmit_failed; + } + + rte_spinlock_lock(&lio_dev->glist_lock[iq_no]); + g = (struct lio_gather *)list_delete_head( + &lio_dev->glist_head[iq_no]); + rte_spinlock_unlock(&lio_dev->glist_lock[iq_no]); + if (g == NULL) { + PMD_TX_LOG(lio_dev, ERR, + "Transmit scatter gather: glist null!\n"); + goto xmit_failed; + } + + cmdsetup.s.gather = 1; + cmdsetup.s.u.gatherptrs = m->nb_segs; + lio_prepare_pci_cmd(lio_dev, &ndata.cmd, + &cmdsetup, tag); + + memset(g->sg, 0, g->sg_size); + g->sg[0].ptr[0] = rte_mbuf_data_dma_addr(m); + lio_add_sg_size(&g->sg[0], m->data_len, 0); + pkt_len = m->data_len; + finfo->mbuf = m; + + /* First seg taken care above */ + frags = m->nb_segs - 1; + i = 1; + m = m->next; + while (frags--) { + g->sg[(i >> 2)].ptr[(i & 3)] = + rte_mbuf_data_dma_addr(m); + lio_add_sg_size(&g->sg[(i >> 2)], + m->data_len, (i & 3)); + pkt_len += m->data_len; + i++; + m = m->next; + } + + phyaddr = rte_mem_virt2phy(g->sg); + if (phyaddr == RTE_BAD_PHYS_ADDR) { + PMD_TX_LOG(lio_dev, ERR, "bad phys addr\n"); + goto xmit_failed; + } + + ndata.cmd.cmd3.dptr = phyaddr; + ndata.reqtype = LIO_REQTYPE_NORESP_NET_SG; + + finfo->g = g; + finfo->lio_dev = lio_dev; + finfo->iq_no = (uint64_t)iq_no; + ndata.buf = finfo; } ndata.datasize = pkt_len; diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 1eff46f..dbf8685 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -666,6 +666,17 @@ enum { return subcode2 != subcode1; } +static inline void +lio_add_sg_size(struct lio_sg_entry *sg_entry, + uint16_t size, uint32_t pos) +{ +#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN + sg_entry->u.size[pos] = size; +#elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + sg_entry->u.size[3 - pos] = size; +#endif +} + /* Macro to increment index. * Index is incremented by count; if the sum exceeds * max, index is wrapped-around to the start. diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index be3bf79..de4c1f3 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -298,6 +298,30 @@ struct lio_instr_queue { const struct rte_memzone *iq_mz; }; +/** This structure is used by driver to store information required + * to free the mbuff when the packet has been fetched by Octeon. + * Bytes offset below assume worst-case of a 64-bit system. + */ +struct lio_buf_free_info { + /** Bytes 1-8. Pointer to network device private structure. */ + struct lio_device *lio_dev; + + /** Bytes 9-16. Pointer to mbuff. */ + struct rte_mbuf *mbuf; + + /** Bytes 17-24. Pointer to gather list. */ + struct lio_gather *g; + + /** Bytes 25-32. Physical address of mbuf->data or gather list. */ + uint64_t dptr; + + /** Bytes 33-47. Piggybacked soft command, if any */ + struct lio_soft_command *sc; + + /** Bytes 48-63. iq no */ + uint64_t iq_no; +}; + /* The Scatter-Gather List Entry. The scatter or gather component used with * input instruction has this format. */ -- 1.8.3.1