From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0055.outbound.protection.outlook.com [104.47.42.55]) by dpdk.org (Postfix) with ESMTP id B71CCFA70 for ; Thu, 2 Mar 2017 12:39:21 +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=rdSE8BRD6FGrrEhsJfNVD/g7sVX97PyYYVMsFcEPYow=; b=CsBdyRnfAlQs55Z5JugZunWBv6t19LjnMFQUzkejuWy1tcE2vsSjtVm08HE6e2GyHpnrddSoDYhn8HmxywQQU0Motmz97ucrCzwf/fyhq+gqeVA+A9u/ASo5H36ljbI2h/H0gCkcrz40d+Q2E/TD1WSI5rOmS7MkOFkXkwmTPSY= 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:17 +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:32 +0530 Message-Id: <1488454371-3342-28-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: 042448f0-a76f-45fe-8b50-08d46160c437 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:8g2CdcpGHQsUH79t8IMTWXYpnBH10MgfCZwUtI8lmIR6w9lkAsYyiyOCsAalSIdqQLyY/vE0WlWVau32gkCMJtejqO48rkBQ+zvGD3m5rqK+44quE/p0QaF8bW3yvbEyD8sAbVO1U8T+QWZaG7ky+oE66iLROXO2CVnlWgLQXzThjzzk0nKY6fajxYbPgiv0yqEOt7NzBU+nleigfx8uRkfhgxJXqEWy0aLrkF+AWv0e3+OCF5/6dLWgocTU7dxloU07tvscZadecI/EacU/PA==; 25:0c+K9BZ8Fds4ztSr/4inm+Vx+znZzrQh4V2HzUB4cW0uDnoz3apDBSIQAV9sjvug+de5n8RpLP7xlW1Quq8y3mEdhXkvPjkG3FWFOaHBYcCJzbygDZm8HX4gsmwqJqxu49AbCUV4L6IG91VT2LZe20eQgtNoxW56QlDZKBxMcjVJcwqb31ikr0cdVoLW0C5aXeI8PwMIvrardAGnvGdaDZ56wQeQRsJtghAud70Iv3yEqqQYrJ1x3Am5C6heCR7TpyTOTahUG3N9nRlT6V3HYECHen38k+0ZxypnYq/LjdFK7OEilo4Fo17y+YXeJafTMB752mUy87VEJTjI3tKJfz3epYI+8GtxvNThMW5YmVSP+oR+ci2+qdVfYrT3af2ndWM9iG+/yGVODQt7OuGAn5llSm89ivh3PlzBI201aLo3dR6HMDZayLaEgNGkqC1vOPVjWVFfQI0d0LFS7Z2OQg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:4I0iw7H1m2b7cioTF1jMp2eUD1hJqZd7WoiaSm/tLSFLWm38kYRojctuE32ZTviXIRkWRsXoQqq1FSyBxSM2XkMmIjAdyJBjRQWZ658hWLIhNYuh8fcd8hOQiM7hMJtkNjf5MuCds+JyIwOlEUWs6B/hxSheXb+9atsQOFfP8BcykzeH9zAgjcuASjkk4UFGq6XAK1CZHL3nzsmZnDvV00Gh3Yhx3QNUxmDfRr8p333rL363jUlUk99nsAjo8lUV; 20:momX1tH7zwG3mT6SlE5BYYPkpHLWQk5+PwuDFk4uWqOYIEDpn/EB2DKyobqeoxQ2Em9b8SGMqu3HXgug/T3u6ddZ7SGI0OLHmuIdeFvywyrBGlc5cMt/Qa2MpS+9LvF6LicSbZGMgGVWVqxMYZTAcWcYiTgD+1PALQbvIAFEUeS5k/kAGkxPSn89Avi5oYq1i6pp3NCjG9oRszTC8Osu0eD0ZQxFSGv0aNttM2noSmTbY8P81iy9MeMFtUyI98+JlT3iBEKOmwvBsBoIQgKyiBXoVBetIA2TJqc0HBSTBsz7K70HgPFE1s6Jd/CeT2qsX5l060AOdv0RgCvi7wTeXijKDBj7C/6yXgV349TZqNG0P3F5Opp0eBBJyZ542TsUKq12is4ZR2NMAVzbeRfDEgTB24YRCrb0TMPjIV5Zqfiot8DgYxTlcacM49pDOe8D8cLJUKUTK0rCHgA65xNEjRxiIdZq/lAr8+QNgDuUoq+AtBriRAw5T2rq3SxUOJ6fx4ebgWgUw/tkYNwHEHkBAU+ZMTjPeTuu9iNET+m81s7x+C8zJjV+4zR64EfvaEbPAEwaUae+r+FUk8byvhYMjJPU5UjN/JzN4ztvRiknkjw= 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:543zdLyj1c6iyZD/Ps5lyGgKAmlheEStIF9hA1bqSpiS/Xbxr91IZ+c3Krd+ha7UfpQriVSciQs3iSoxzCiXvAMofmziiorj/lckbsTSEwm4FUyvj55B/7d9DhRJUKFLWdm+bmxC9M3hGahDZpNKK3sVimEF2TBRFW+wAA+zmwFOkjFvVofbWnj2KTP/gcL3uedLXqrY+PTbnoh0VwaHWNl8Gf7vhNpKBhy1yj+nPMaiDT/TJez3Z7AF6ZKBy5zgNAe0NVYRfS4H2TbYk6FjpSmqGA+vE3lHBfZegGR8JrYDmyTVWh1O42G7y0fM6w/2K94mc9APhnbjLWCclpXqm4aWyISjKjM7VpBYkA7IkTeBUykn8miEjqDJ1KESrEeep81P5wKmej98HVG5R+M5CtM4LTFpCLkf2/c8p3FfrOs/LZ4//YY/SfK1NLsi1MhFnJx+Hr0RkrKKrIcGifJDE8r7JZcJ50D/tQHl+33GNlhMS3qWH4qjiKDuClJAGlsetzbPyDUMoaZRHBPLoqzx3taawNaC7zgxAMhevbwNbyi1ZgYelWgL1tRegXXHDnvD4n6I18n7iuYxN1dvHxQ7XjShJxvZB1Mo33qgiIX7ql0= 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:iGSpk+ub7nGzBbJ3gSjPf/3FNniceq+hylykK31wl?= =?us-ascii?Q?VYZANDz0VTVtfi4RN+UhfmdD2vyOfWAQDUQ9TaQO/Bhtr8mxJCDavJ1/qJ4T?= =?us-ascii?Q?7yzFMgl2IxvM4zQtgO3DZZ/cCmPD2Wi9Wn3p2N2VuEpQiJ/suJJnHLluUCYQ?= =?us-ascii?Q?lVi4JqxyiOHdQJM9fG4rPdsSPk6bcqQRUZG9sWw6KScPgA/GJ7dEbJ1t6C6S?= =?us-ascii?Q?eKfurj5zSz7vTqIaCSQ56AvH97JR1fXuthRW9NBhccP2YTO7KoZSAsioU6x8?= =?us-ascii?Q?CF/DK5hnW+tyGmJONyachJLE2MQBc5tH63TXyF3hk+pKr3e3rQIMEIB6+4RP?= =?us-ascii?Q?oWEKhaKK7qPe7mVBUEk6V7gjLsLpa+vY77ilvb96O4Jy98ulazTp1hJb/vZn?= =?us-ascii?Q?ki9Xzxgu1rIE4L/iOYs55/rdoYM3iAX4NYsg7uSvJNL5Htdq9kmA4pD7hCYh?= =?us-ascii?Q?1G3OdpvcNa+RL6V8s8y/uaokA7RY2x3NsMiqWbxUy6kHIQS+QOmhRyfIZ5AJ?= =?us-ascii?Q?T73PDZ6Jb5VJkblUX7IR3DjMibGP/YCAV2ikejIP35dXzBzD3v0Ru02k0pCK?= =?us-ascii?Q?AFp/lH0guH5zJKltEkY3F0KUc/blJcgES8yEVH+v4+2EQhzSlJVBR0G2DoDW?= =?us-ascii?Q?FqibFkKQJhW8HTzHDqwq4bd6wD4kHVedyvTlFGzBgvjfzlKe15d6gq/Vg+rR?= =?us-ascii?Q?XZ9wG/dr2TXd1rO3xkX/lgAQwJKDz8wslZR568FopMwlogBZpRNTM3WmvMcz?= =?us-ascii?Q?yvgZMXcwBKWjgKLwhf53N5ahlj28o0ikyWBDz7GsNiSeW87lH9feX8xwt0G8?= =?us-ascii?Q?eC5QTJ9sjeZCWJ5YIsMnQd8866iyQxKvaM9FbZiRpg/ChL9LadNNQN0lb11Y?= =?us-ascii?Q?PS/mQmCxMBrx780cyVEgyC2qPTT72pW/vJarACkykRZ5yGB+OWHYIlS6usuF?= =?us-ascii?Q?eXZQoylPNuF8TjCNWZH9LSReFzIQvnPaN0MUBgk8v5CtKr71HL7Lb3xvBz38?= =?us-ascii?Q?7lEekfBGCEUWO8VDUVN5qgZvOx997j+o961v6A9jf9U7dFCkTOPOEqlFg9ym?= =?us-ascii?Q?516slg8jGWosP72D353U2Wm0F1EnqmHGYrX8gN+IUBfyKuGIg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:pkN6stQFhuI1s0lro1OUORtzZbYCShklmpY51FZ9Wy9SK0g8d4mPRs3tA9hlpzd4ids+ozO2zvu8C/8bjSTcBB0+q8gJi1LiwPB3vARP1D6VKkxF/yDDyMxz3Ij6fp3j4vVJZxMJ/EQHomEvVGNlnWpUDkGEjyYen2ZTFcZlRMAVHcxVpzoAS3zoUMF7cUhN6Bf0/rZtuA9W6GbfsGHSGfwtB4g4wJFv1Q6H8lw39nuAV+O0HbI9uN+5xk2RQjqHlp2MUVxQI1kweefEKMBboEiz9ysebzBFwH12Ck3TMy7QI2X6WhrjcOCZcEm3L3wvOpqxB/W6GBIzIH2fu3c6fAMZfN0I+VEo4MPXlQmNijYNWw6TWVXPMcO1hZumXInen9nkw/Nq85nRbngHGzfznA==; 5:jhKbx9E+r7TzvA5ujlVKqlcdaBLu79Me7geDJkOOk2z0RxLG0mOnw44upcpPZW+znYdc0NGq2QZtpw8CPQvVWzyF6TjMR7+jw4IoVIhk1/L/xReX50IXLvQ6gNtfjO4TrVvP3kI905W7bWAxW00xLg==; 24:z5nSIrrx0SSUqmbWp9cOslZhhwuNmH+vX7KkCLgeIKeuc2KbhVgBArNX6dgwId434n79iGuPF8iWa2DvRvd3OhquIGr+taSk4o6/Ua/+bwU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:yRkgO5l8JMuh3K5a9HEG6DwRCfTvRm2A1JmnnJwGdlvM91iIRdxL++TMzueJzb8R1cqM8Ei1YVUhQ0sjQBwTq1DpE8J30Nv29x4Ffp/+A+h2jb/oNFrK5LegFRO65ZBGsTai6XeVfXlCG+Riun2UfpOFvRKRnKBwhJCi51p5oXIECLNekeZhip2MyJ3mtNsXCDHEhFSpmtpMUvMnI6U0pMwIeiJ0DTeN2zkw0p8+lRRO9u192qnZQkkpJNm2karc74busIBUf9WrZOVU5l86zsd0cpfgVuo/PB42GnFU3Z2UGpRfA+JPHgfcQMepa0QHi/6fxE+5URVgCkDlgo/mgg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:17.8748 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 27/46] net/liquidio: add Tx data path for single segment 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:22 -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/base/lio_hw_defs.h | 1 + drivers/net/liquidio/lio_ethdev.c | 3 + drivers/net/liquidio/lio_rxtx.c | 89 ++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 138 ++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+) diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index 2db7085..1c1ad8e 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -108,6 +108,7 @@ enum octeon_tag_type { /* pre-defined host->NIC tag values */ #define LIO_CONTROL (0x11111110) +#define LIO_DATA(i) (0x11111111 + (i)) /* used for NIC operations */ #define LIO_OPCODE 1 diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index b2e7a29..5c5aade 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -529,6 +529,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) eth_dev->data->mac_addrs = NULL; eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; return 0; } @@ -542,6 +543,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); eth_dev->rx_pkt_burst = &lio_dev_recv_pkts; + eth_dev->tx_pkt_burst = &lio_dev_xmit_pkts; /* Primary does the initialization. */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -577,6 +579,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) "MAC addresses memory allocation failed\n"); eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; return -ENOMEM; } diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 63d8896..14113e1 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -1384,3 +1384,92 @@ struct lio_soft_command * lio_dev->instr_queue[iq_no] = NULL; lio_dev->num_iqs--; } + +/** Send data packet to the device + * @param lio_dev - lio device pointer + * @param ndata - control structure with queueing, and buffer information + * + * @returns IQ_FAILED if it failed to add to the input queue. IQ_STOP if it the + * queue should be stopped, and LIO_IQ_SEND_OK if it sent okay. + */ +static inline int +lio_send_data_pkt(struct lio_device *lio_dev, struct lio_data_pkt *ndata) +{ + return lio_send_command(lio_dev, ndata->q_no, &ndata->cmd, + ndata->buf, ndata->datasize, ndata->reqtype); +} + +uint16_t +lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) +{ + struct lio_instr_queue *txq = tx_queue; + union lio_cmd_setup cmdsetup; + struct lio_device *lio_dev; + struct lio_data_pkt ndata; + int i, processed = 0; + struct rte_mbuf *m; + uint32_t tag = 0; + int status = 0; + int iq_no; + + lio_dev = txq->lio_dev; + iq_no = txq->txpciq.s.q_no; + + if (!lio_dev->linfo.link.s.link_up) { + PMD_TX_LOG(lio_dev, ERR, "Transmit failed link_status : %d\n", + lio_dev->linfo.link.s.link_up); + goto xmit_failed; + } + + for (i = 0; i < nb_pkts; i++) { + uint32_t pkt_len = 0; + + m = pkts[i]; + + /* Prepare the attributes for the data to be passed to BASE. */ + memset(&ndata, 0, sizeof(struct lio_data_pkt)); + + ndata.buf = m; + + ndata.q_no = iq_no; + + cmdsetup.cmd_setup64 = 0; + cmdsetup.s.iq_no = iq_no; + + /* check checksum offload flags to form cmd */ + if (m->ol_flags & PKT_TX_IP_CKSUM) + cmdsetup.s.ip_csum = 1; + + if ((m->ol_flags & PKT_TX_TCP_CKSUM) || + (m->ol_flags & PKT_TX_UDP_CKSUM)) + cmdsetup.s.transport_csum = 1; + + if (m->nb_segs == 1) { + pkt_len = rte_pktmbuf_data_len(m); + cmdsetup.s.u.datasize = pkt_len; + lio_prepare_pci_cmd(lio_dev, &ndata.cmd, + &cmdsetup, tag); + ndata.cmd.cmd3.dptr = rte_mbuf_data_dma_addr(m); + ndata.reqtype = LIO_REQTYPE_NORESP_NET; + } + + ndata.datasize = pkt_len; + + status = lio_send_data_pkt(lio_dev, &ndata); + + if (unlikely(status == LIO_IQ_SEND_FAILED)) { + PMD_TX_LOG(lio_dev, ERR, "send failed\n"); + break; + } + + if (unlikely(status == LIO_IQ_SEND_STOP)) + PMD_TX_LOG(lio_dev, DEBUG, "iq full\n"); + + processed++; + } + +xmit_failed: + + return processed; +} + diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 10bca4c..6813aea 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -249,6 +249,50 @@ struct lio_iq_post_status { #define OCTEON_CMD_SIZE (sizeof(union octeon_cmd)) +/** Structure of data information passed by driver to the BASE + * layer when forwarding data to Octeon device software. + */ +struct lio_data_pkt { + /** Pointer to information maintained by NIC module for this packet. The + * BASE layer passes this as-is to the driver. + */ + void *buf; + + /** Type of buffer passed in "buf" above. */ + uint32_t reqtype; + + /** Total data bytes to be transferred in this command. */ + uint32_t datasize; + + /** Command to be passed to the Octeon device software. */ + union lio_instr_64B cmd; + + /** Input queue to use to send this command. */ + uint32_t q_no; +}; + +/** Structure passed by driver to BASE layer to prepare a command to send + * network data to Octeon. + */ +union lio_cmd_setup { + struct { + uint32_t iq_no : 8; + uint32_t gather : 1; + uint32_t timestamp : 1; + uint32_t ip_csum : 1; + uint32_t transport_csum : 1; + uint32_t tnl_csum : 1; + uint32_t rsvd : 19; + + union { + uint32_t datasize; + uint32_t gatherptrs; + } u; + } s; + + uint64_t cmd_setup64; +}; + /* Instruction Header */ struct octeon_instr_ih3 { #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN @@ -418,6 +462,98 @@ struct octeon_instr_rdp { #endif }; +union octeon_packet_params { + uint32_t pkt_params32; + struct { +#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint32_t reserved : 24; + uint32_t ip_csum : 1; /* Perform IP header checksum(s) */ + /* Perform Outer transport header checksum */ + uint32_t transport_csum : 1; + /* Find tunnel, and perform transport csum. */ + uint32_t tnl_csum : 1; + uint32_t tsflag : 1; /* Timestamp this packet */ + uint32_t ipsec_ops : 4; /* IPsec operation */ +#else + uint32_t ipsec_ops : 4; + uint32_t tsflag : 1; + uint32_t tnl_csum : 1; + uint32_t transport_csum : 1; + uint32_t ip_csum : 1; + uint32_t reserved : 7; +#endif + } s; +}; + +/** Utility function to prepare a 64B NIC instruction based on a setup command + * @param cmd - pointer to instruction to be filled in. + * @param setup - pointer to the setup structure + * @param q_no - which queue for back pressure + * + * Assumes the cmd instruction is pre-allocated, but no fields are filled in. + */ +static inline void +lio_prepare_pci_cmd(struct lio_device *lio_dev, + union lio_instr_64B *cmd, + union lio_cmd_setup *setup, + uint32_t tag) +{ + union octeon_packet_params packet_params; + struct octeon_instr_pki_ih3 *pki_ih3; + struct octeon_instr_irh *irh; + struct octeon_instr_ih3 *ih3; + int port; + + memset(cmd, 0, sizeof(union lio_instr_64B)); + + ih3 = (struct octeon_instr_ih3 *)&cmd->cmd3.ih3; + pki_ih3 = (struct octeon_instr_pki_ih3 *)&cmd->cmd3.pki_ih3; + + /* assume that rflag is cleared so therefore front data will only have + * irh and ossp[1] and ossp[2] for a total of 24 bytes + */ + ih3->pkind = lio_dev->instr_queue[setup->s.iq_no]->txpciq.s.pkind; + /* PKI IH */ + ih3->fsz = OCTEON_PCI_CMD_O3; + + if (!setup->s.gather) { + ih3->dlengsz = setup->s.u.datasize; + } else { + ih3->gather = 1; + ih3->dlengsz = setup->s.u.gatherptrs; + } + + pki_ih3->w = 1; + pki_ih3->raw = 0; + pki_ih3->utag = 0; + pki_ih3->utt = 1; + pki_ih3->uqpg = lio_dev->instr_queue[setup->s.iq_no]->txpciq.s.use_qpg; + + port = (int)lio_dev->instr_queue[setup->s.iq_no]->txpciq.s.port; + + if (tag) + pki_ih3->tag = tag; + else + pki_ih3->tag = LIO_DATA(port); + + pki_ih3->tagtype = OCTEON_ORDERED_TAG; + pki_ih3->qpg = lio_dev->instr_queue[setup->s.iq_no]->txpciq.s.qpg; + pki_ih3->pm = 0x0; /* parse from L2 */ + pki_ih3->sl = 32; /* sl will be sizeof(pki_ih3) + irh + ossp0 + ossp1*/ + + irh = (struct octeon_instr_irh *)&cmd->cmd3.irh; + + irh->opcode = LIO_OPCODE; + irh->subcode = LIO_OPCODE_NW_DATA; + + packet_params.pkt_params32 = 0; + packet_params.s.ip_csum = setup->s.ip_csum; + packet_params.s.transport_csum = setup->s.transport_csum; + packet_params.s.tsflag = setup->s.timestamp; + + irh->ossp = packet_params.pkt_params32; +} + int lio_setup_sc_buffer_pool(struct lio_device *lio_dev); void lio_free_sc_buffer_pool(struct lio_device *lio_dev); @@ -554,6 +690,8 @@ uint16_t lio_dev_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, int lio_setup_sglists(struct lio_device *lio_dev, int iq_no, int fw_mapped_iq, int num_descs, unsigned int socket_id); +uint16_t lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, + uint16_t nb_pkts); int lio_setup_iq(struct lio_device *lio_dev, int q_index, union octeon_txpciq iq_no, uint32_t num_descs, void *app_ctx, unsigned int socket_id); -- 1.8.3.1