From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0045.outbound.protection.outlook.com [104.47.36.45]) by dpdk.org (Postfix) with ESMTP id ADDD4F967 for ; Sat, 25 Mar 2017 07:28:18 +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=cC567TFskSIA02nlPkNV8HDzODITZctTrfT6HmJT4xnYTsQZPF8sLsO9XorfGWc0WJm4C2lJyOb3rLJ8CxHhaPiCmk0Gakv6tHnzoW1daDX7xhZdvmEBDf0Re9c1aqx+oYaXrLnCA5cey6KX5WqQJNGMkBYFNlRrL9EuoMrvUIE= 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 CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:28:14 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:38 +0530 Message-Id: <1490423097-6797-28-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-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: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 772cb4cc-1383-43c4-d997-08d473481fb1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:Ti18JnC3D7RjcHLd4kGCcWZsgr2YzBjGZKLqGvsClc+LxWuEDP8Fp9kX0cAKL9nzmsj3pfoJqufii1OmlbCVoWpmw3WFTphv+xinRMmezIlEwAYPf9krE2ydQfhbi7UB6lmTuBZOrc4fdFvtAMkgQlJyIg0cGOLV7mZzRwTTEx/SjHrn4mIy4lMxF0F+C35pdaCdb1s0bhod0bG6jLAkwjMLu6HZyVPFPUOrByfLv1WrSyxFlW+YooUFcra57T3aeuxqnu0btbzaa+ckWj9gRQ==; 25:Bd3AYQGCEFo9S6zDU+ifYGrAP0tGj0MU/s46E64/6S36CzMleQ1H4okCbyWBdGY72WA8UJ7wEYJdx9p5suwhlMeJ8/FAeYbaux9yKNPChzgXNqZJfBsYysqRn5jBEoCKRPpy2gc+8NEHk8HHXVTOSLtPV4knTlP3V+XwoZ19RsnsMGTRWNcWXzFWLNmKtOhO36v87ymk+D5pPP7rqxy756LUEMqbiLOuWe0YQ0jfuQ38ddWAYnhgJCdShcncCHFi8GKz8FWK7dFms3NLkkEGu/pCe32pokS9zD1lfxoml0JUcTR+2Q5tqyN4cCnedrnBWlkqEN4nVm1ettSdBTVdYpOPb82APZL86xPX82CsR592EhuZRJnSQi50l+drjA6fNSq6ZqfhbAfMuSNFcscBU1NopQhhI7CX/cj8JiIBfVnbIPrmtor2g48QESEPcSV8YIaNjXtOoohWnDUADqMmKg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:0O4bkHPkofQ0QsMbgDCNy+PuDIWAiuk8fNtc9YfISuC7LlSFMqlTErhaKpUfyKFv4r36UU2bOMov+H6KRRbSDoaTwXr6prsCYwE5j6XvsDaiLD+Bxceuj3amDrkyvzotR/ct2C2Lrj51Dzbs+GKemXRTYY5L7Wm3CWo22O3ZjrlV0DFHuM6A1VLBuZ3H2QN/QUmKwkPayw1tUF7fMpswFaS6GZUCDx3YJiHv1ZZHk6o=; 20:6yZ65NV10fIgoqoz1nY6Fz9xla4843Yo/jkQ4gcZAgI2YHlUMqUZbu2V7gYWPeZevDXwTiGkxL/M9na1L2WLS++dzn4P7BAHJli+fCIgxK4EkaV/DPcupCaSpe9FhRwOEJiDH22pIeIxVl/y57x88bUNKKMQgVo0Li5CKhp96exTJluLQhb6hDboewcCbmsmMHIN6KncoUGJ8W9cS7uw8+fEUJtExGT6FxvzQwWnHSP5/luuX8YyojYHqclmX/rfXRTyDidNqJBbIuPw8IZtD+8hDHZP/pJFlDDHwPUBFy+zA+fPcriBNWHxcQgqd1+KASH6MhoFeqw3as6HLKeB353Vcbla4k1jItAtAli96aVBvCsegmVYzC/B57dwmd1SZHaSRxaca3m1lPKzYonxAsKZR8uzFmIYwl0ER+olI0bP+wDnrkLC8xCpz7axf7F3+gljE1Ulsq2CpflNljBPSjnZypaoKwcGk0lKFGIm4/sTgKnysoXBTYRucIjsbWIFUYS0YC8bU58J3e1T/qSzo7E4aQYoyW9NKLEcivEWZan+WrStJcznwnnXAc5QfMDuS94F0N5QYrOgUThI8lsK9jsIUhNpVT/Q4Yn2FD1axhk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:uQpW614+9gYsKxkqpkT7Rj2CCKNKYc8lOjTFmJlW3XqnNzMf6/NLiD+AwbDdZm/ZEHxnWrqtvfDqrj4z4dQCDReZvtJamL7P6klnz3wR5N00xvg9BPP4+3Hl8c6ZVLYLbdNGnU89gClTErE1js7pvPrCl2QgTWrwTNzfW40sZnric0rkmDKv+jZ6eP18ItOeHaZXeNe+Cfaf3utnNs7qQ+YdyeQDLWhY4V+Hwp5NUllZD01jfe9Z2q6CeXI44t6EXrNDWaL32Gqc35sL8i2U/zq659v9OogFKVIi5vFijhZJtnlj3ljRre8INQykEV4NP4Jw0Li+i+dbxdsWz4IC8L2bocKqVTXdmuvncFIzy6mLZ7reGJ6gIEg+beoBBwZFTcGh+rcfl1aQ/9/b95ljZLDednptS/HeanuvDmGNEAK4ZHUatyxovJ97rcOAYFI8tKfNNhARPImar9VtrDjDny0nk33CPDuX6JshS9ugyaRf9aDoKEaTPxAwaVyM/Ko7VtCMvuUyuF60gvOqcbNbHYmNOAlcXx3tD30nUIETi8y0PAbiipG3JFsvXz8KbcgR3ggdE4bdwJFkGaX4Re4jTc+Lqh/s4iSeJ1mOegAbfVM= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(6666003)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:MId2pUx0EkskO3SJYgM+UHUOrxXhPy4MkA89hzUwA?= =?us-ascii?Q?eCUrZhJ49KfH6h04gswx/LW28oY5yOtkU4ZmZUgvUwOUlWJ3uXXxwBZ+puqj?= =?us-ascii?Q?yNghuFCjvYMEq6sXQtkgv714wTIXpIXrw1BIva3a7QsXTpbDd+EbRFnwl17b?= =?us-ascii?Q?jAqZwyXr0YDEna+U1MFw/NFpIeil8bqspVxmI1q8IEeQdVdxDX71m676x0cn?= =?us-ascii?Q?jHvuQddhuCcxtyQn8Tnr/GSxl6HslMwItTVvlW21EytCvs/Ctb36kuwN7x4w?= =?us-ascii?Q?fkqVLWhpsII7RYEYHLgcV54mkVrYxMELKwWGa0oAKhFbQdaxyyeNgQrkkEUS?= =?us-ascii?Q?DA2+fO/gsTtc4bpWkiArRXIJ4lG2HJA5Pcq5ilds9Ity9gKWEO3q5iZvyLeZ?= =?us-ascii?Q?JU8X1LVB4aNj/2JE0sXw1ZoXxrJKbhUY2Y5ICQbGo5QNE3hb0FpIUEm1u7pv?= =?us-ascii?Q?GmU/qzoq+OnFnY3EB7LvBaN5ZkOduTC4+MzyKeF3rgvHWEVMQFYPWcXr+b3k?= =?us-ascii?Q?KXeAEe3p71+46432LL6eYy/q4Oc1m14bhOKxGEEieFLaame64ostNpb/voMd?= =?us-ascii?Q?mLFea6pVVOGIvtvZca90vajL4oJK/o62e+QdTfO9MuOcMCZbwEXhCHcnduRZ?= =?us-ascii?Q?y4pMvxDhZXK/cJ8WYTJvsLOgQBkAJsEKh5UfuhhSlKSkm+yyX5vhhqxbI9MU?= =?us-ascii?Q?50vPRGo/bweAFVBo7v7qqWLIUeth6ZL7vOOtYY0qq/filvpOFgER7TKpHaA9?= =?us-ascii?Q?V+mKb23bUma4l40zXTLPrBBHwrt0Mf/Xin9wWzECyPCvyAlqd7xHYlpYOXdv?= =?us-ascii?Q?tuc5YruScCgyTac28DqN8YTS7ZKNXOAs4wSKuD4KizAH+CNXa0Z72itl/mJA?= =?us-ascii?Q?WEcvDjI+r0eoz+FuH9ncOQofUIOH/HO5IjACTEv1sSF8bUF9+0BKsA5F9uw5?= =?us-ascii?Q?5PUL6Fkxv353ARAzEFAC26oRAFzD5pPkjFi9G/nOXg7+4PvdAkVlqKKDqcAb?= =?us-ascii?Q?FtADHej67+qj+oCbG2NC4rs4GyJ/YlPecTOLYWdIkozaJa/3MUVjunniMmr9?= =?us-ascii?Q?JVFSAmxg77zB8LGeTw5hK4PCkiY?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:5jYxJx6j/awVyJWwhFT65M+b/M4cmH/0J2B6Oghe+pZs3q+xs4Fi9BHrXfWP7ZcIKnDaN/zPg6m5mHlzWeXcB+kMT9rihicDlvpAZ5JiPnI8xoX88uxif0JaVku12oMKMfz7XzoV+qAR2DgxW6Zp5TesZgLr3SOWb+UCbvCHREi0vI4QrxP8wPmPX/f7slc+ZNl2AF5mkE6Omy+scgUjO7nQDrEWO+MYQ1DYLMAVYio0xdbKxLsShUnwZysxlfYBEq/1VTWGMRYYch75MzW9LnqJU3TbbBtb8sbrjlV7iQXOM5CMvtImIrQRFKdHhY+helIOkyO8qi3KyIcOHm90exIXxfvD69Lxo4CORVUtJq0uO5YVvi88iDGZ5Vl15W0T/LpcsS9ATbVmRKVKkPtJ0Q==; 5:SNPUBvOpq4CtRplK59/4zJ940XqY+WUSv4Oixyz1ntPCvoWyfGH4AQyZnojoEPr45r4MeeZwG7kanADCkQ1MoQXkhVhY2W2VH3rK9stxZJl82PtdzFv2XpgOW916Tl+H012CTgYTHdHgcq1j3IL44g==; 24:R2foEARLkm8RXZN4UOEwgjX47YZW/7gGN2xNEWbYyJ0sjj8pvZVAfP04M/LkTOku0GlWuwsainxixtj/zmManmCd1vYFfZqfCXmfnMp6YA8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:IIwU4plw4i7lxafKTPG4p9cPzjdkZ0wu7s7EpUFc4eoOvhRTUi9NkXJYyrBXWkpq9jD2eF7j24qX/1f+ikdYSZTAllvnU2wG2W2t3VuSnK1dj7fCNdLggPWMjOq0tJ4X36Peilqow3QEH6BvsnN/3ozcFbX5+uX66z4g2g/5tJESa6++cuVfKp4XuLq/NCTlMbKn2qaRaUXADi1bPeiLFTOCWefqgPgGReSwSlSjZTNw/G/LKU0epugMXBATCha2apmA5FiXRO+gJh2hoCyx+rXeYdMTczyf0OZKeiyEngqNYWfugbe4vvP+G+taU1DkVRwZmX6AUD3wSh4MD1L1wg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:14.8712 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 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: Sat, 25 Mar 2017 06:28:19 -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