From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0058.outbound.protection.outlook.com [104.47.42.58]) by dpdk.org (Postfix) with ESMTP id B1B47FA73 for ; Thu, 2 Mar 2017 12:39:24 +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=U2I9BRpRycSgxRn3Z1el8L933EfUpivPD6DAdTiePVk=; b=SfWA10UsPJZvpkB9Kg1xxA3evgSpWHohsub5VE36cetZkvud4UQqphQLoY3HSqPElsJwNogDYJc2V5Q4BN/vERhg3NEuimNxjqBCTdfykQFfmIEfiTdzim4DUqxKvDDajzc7ELJZuuei3uM32SQjebzhiRGsrn+PliFm2Gj7C98= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:39:20 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:33 +0530 Message-Id: <1488454371-3342-29-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: ebbeb592-938d-41a3-3e1f-08d46160c60d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:WMKrak4vcU3mJW1vpDBOkbnxPUN+HXgLNTtWTMUx9FI6b2k2BeI94sPuWpg5+Uf48qvAqfwjfJLMF7L7db73xsHUrDjPXfm2RQ9leMA/yn1ts6qKcIGlMgLQd6RIFKzdmEAsPM7Qbk6daxe1YExBIdaZpYH2oe/ekWj/HQbeoNbb8a7ntCbF+br9eig66BQaHqRBKkq6P4Gsck1tZHt5TICw/lQCJvYa3tTugSXabgviHm0rd4kjwcng9lJuuI+3O3kOAeqdlkw3uRIXbV8uaQ==; 25:Wdaft7UGLxZvfdkTPD/u3qye9NJvekqI57TKnYHaoy8KXauUSc60JOUSbxVBg0QrNNWiS9MRKjw+maHRh2Imz/Y5Uu6/Xb8lzQJECJvsEK3WqXWD+S6yR423mh4lndBEiteIS/H4umUrSI/qGfI/jQG7hejLvuyET4U/u11QL9wedKUtmrbNwKGf6a25PBkw02Xz8tdNYvw86GFCzp15CNOcJeCf7yaum2LxE9T638NzMZ4FTOIYyrs1HDBg3yYe7DG4MVC2foSATsWzC2HdpVxA68I2FpU6g7MHQ92dPui7GwV9AGdneCq7Kf8hq+iCYpLGMLZFC/UGbsf0MXjaRqcm6XIvdVRPy9HjtlRPiCULvPga63N79xqvGekcfWwsFIxi0Smmf+5K+SHkOgG2z4+8GbT0KnumucXPF50cplkQEs9RMp0917JNS0DixGzDLNmZ2wyQG3WaTLoygkK9kg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:fOGO5PDDr6hEFL462kwOmhHqEKtT96wESfHYueG6VqciSMGzQQCuQSlTS2ONXpAzWE2U3PhZyOph8yNF2G6douXr/74OSao4ryxf2poiqTGvWrd4RVwGT6hMEvTLtjJjUZFyYEXbtda+HxpdW94L3fCpAMubb4egNkjpFcCvlCA8Jz0o35YD8nNX6nLLe5+SruFIcR6n9NngrQZwyAIVq6OL224H0/2VdzQLfMEljS8=; 20:SuHUTxX0TDGxT/dah9wvhJ2yCGqvCtypdBMuTOhzDqZB1IbjJjNEZ382wD5Ki1FG7DRc3I876HxKrtlhdO2AAKKTwlpzOreDO1vWSq4f4LMg5Q1WieqBRa1vfHF28Zzu8Dj6szT7coKCIrn5s7RsOtNLk5EzIVBlJOyOUETP/NCc5tUHwEdeje/zwdlj6J97Rm1DeLOwNE6WuSxJxP/s4j2N9to6i9rA7kkaTkG5i/1brddbofDPC7tKy5vyIDjfn79BeCVlkSTXSae7LyHY5MyWVB5fHK9nnakZrT80+C7hgqRh/GpuZ0ynYYyKSx5uVI09voXuSOJgx5+JUX0TYXSZJyFk2LxjOIhmZa4/AvxMOq9UdBY8OW9lNJiN1uO1wIPRIOYRsUyW5992qQVyCBij04LZGy7FEx36kaNZ2tXuuZNxUBQ7mYXeCCkTaHB/NmomeAixoQ2yO60wdFt3SDXvTFU5EgL2i5X8DSOsti6l17YupVr9ktund+nYCs7B3ZiaC1A44bPcbKFMTOCKyiubN6kExN7sWXA8U/SV7bvz0ATnYNpdsiRaMgh6vCfCNhnvvW/v3bmJMWDMI0bBY5L4FP3Dr0rS28cMXFuZcqU= 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)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:9h5gzAOrSw6M2GAXuqpCTbUcFLrzw/RUvZh9R63y40NdAaas8AAf5fqXpjGh/OfW/q9C/muKt+aPq0O89pzKrTEHkA93YG7wMzLxdfsZ+YsXDfT2dPyoqQOTE8TA1rZirtIRvXiPxBYqoOEmzjFStk9JeAJL2fLKKF1esXCnPNkchSj6A4T/S39AuB8F2hbOXjCKTrkywrMdA5c9P0+B7r5t8Tx8h754R3NVAmMDCjfnXWMWuBcuEFlhEYHzFfrERyGsBXSTN1UPjfcXv9u40sRjfsw40gYGqbrpo3wVzUlcOOpydQNPKJbvaNqdbfq6TOyGcn9bhLqSXaHOiSlAK3t6zvJ2oC+dkv2y+RGbalKegGePAJoecqkZt+DJnHn3MvPH37POJk5moefKUJVEKZMsig6ktktxeYegI4vcLUD94otQrRLhIAHjaSIXMqOYDQMcmuf5/qhjz9wqI/uvOKNMWmVsZnB72Q7FFEHkWK6B2w2SmnCqpZiiYk3iKd7z2fCGOEiSZ+gyEjputRs+HqZm24GJyPHph+h63lG6rKbLcFA5gtd/FFkZvKBLkP6fqnJrPquNsusFcspSbPCxssT52BUMKjaWA9K6kdfsDb4= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:yDM3kW31IpehcMSeTHm2gxcw/hAtJ/Ew8e+YFInbs?= =?us-ascii?Q?DuENN4aAB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dUYI7rO6obqNp2d?= =?us-ascii?Q?x1TCsN59+5AIZReNxt4hjdaGhPBqmR40kXUD1Q34h84R8yi3Yamo/rKAF/hC?= =?us-ascii?Q?Or3n2s8qhuMYzjSsJiOPuNzqqtftgMNsHzhpdsPunemimJ9GNAO6KKA09k5s?= =?us-ascii?Q?Fndr6rqPqDaiawExDZorJGHiIU0gW+NJsK3v7QoRuFK9Gfz9g=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:TBa/ujgmlG1FJqnyI4TZISwlHYSJFcaywiNWCpYH9dt3jyCVEt9sIVB/9SwHdsdSwYWfbDFUL0zKU+Jv/UvCuAgd8ExqtPaeawYLXYRhPq1vgJxbjYnaMXGms542LhP37dFrvEiwmJPnkoscfe3eBvzdpQqDshybaJmwSjIPbye6UZ4NntB29cKWXTTldcvDCOIWvy5bu/rspZ3HevKnt0ctg+nXNqxdWqwalevi6841tVrAn3z6pXs5Sx6R/xpc+kgmzxpq18Vn1v21NmZwcJAR9AHkRdZsn+z+ZanMI+Ygt2D7g8FPx5NgC3DW1wLpRUqM6T4yDDXVS1BIw+f+yFZzPIFs8rMwoMgy2vclbcK7JN0o0TcB6wZrUXGkrSmEwttN/ARAxtFmbOauNyHShA==; 5:9RLlOe3lmBz5f37SbxLUiUPQFxnHejx5PCKctjBGv7TqFbSZ/z8UPCApvliNl+kX277VzL1VKBgkwfVwkiTbYPjp+neOZhjwdu04zUfpD2a3cMONe652zBpn570fWq+xBJD6chYmqjNWkKL7/FgCXA==; 24:fHhViYsJE5NKKZYsZpjUMMfaWKXbdvAGGB1YCl3YzwHC+3Cn+ll8yP7jQIZKNiYLB3A+XDiTCWUloe9KdYZiIU1/7wNG72Nqx3Tk67MbW4U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:WrJ6QvI78yQOUIPM0+TgAlXOtlj1ibNPONRf9Y4Ot6YxyN07IcrWIlxe2rqPfPI7BE5hgC0ANgc6SRPBiJAXruerIii/F640W056mjxMY1ME9l0Np/Khl0A3YgQeN4Qirh3ocMpqat86ho5d7DUuQ3TSD34qjtAsPXpw0fM6Xh5r2vuAMmWqXVEZP5B/na8nAM9VTE5ETP9wRX0QkBOm4/RVJsN1T4n0FB8YxrDKqLm2RPCLBqVndlK1w/hY6JFa+KZwow93hqxFvX9n2xVNt6MIeJdgEjjuU6nRJsVdXmLZkDlBlkgR7CHCxyuVhl/aRqfW5KdhrwCfPaXt9ClSuQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:20.9530 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 28/46] 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: Thu, 02 Mar 2017 11:39:25 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S 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 14113e1..75ecbd5 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_first_node( + &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 6813aea..b555bde 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 906553c..478a290 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