From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0054.outbound.protection.outlook.com [104.47.32.54]) by dpdk.org (Postfix) with ESMTP id DC2F0FA4F for ; Tue, 21 Feb 2017 10:29:42 +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=M7GeCwjf4bu1I0h3lq0UyYm97v9hYj2nVHn7p52kg+4=; b=ZeJSTxEG2PKpKiMNUJYwKMe5G6zmnOI3R+FGTrrtr2fdMHJrPDsJD12C6Y9tM40nBx5IFl3IsegB7HApFkedSun9v0PvnrVPO2gLY/yHh47AN1ktrckCbiZmfbts2+yy30bnMJjCM4mCEzR52Ps+KBcbXAwW65kWSyU1A3i7oI0= 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:39 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:45 +0530 Message-Id: <1487669225-30091-31-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: b37c0a72-2dea-46b0-6302-08d45a3c2a0e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:ZFBtKpw7do5rH7VUwAkUS1dwALjOt0KdcHfFlmWx8ylJDhF7mk8OEcx+OMarZB/AC2JWi7g9LGKpHMeeToPfV8aIaN5qLjH0T1MoJnAsX7MwG4V7Q5MCtr1hNCj/tNFrnquiSWzmq2V/nURzhLJhMK+0VfIvOuZ59ssgdSz4PmpUriCw9DguIcS25AW5T5SjPFz7O02c+Ga8XUjdVwt78ytAHiP8MI277accirLBulu58RNd/ggL1xEedLKKDZhmQpi4qLm1AqKu0avOxk1jeQ==; 25:rS40lEV3rGtRCWhw8YrWcgIDCz3i6uFSgD71rdEZTwdvsIubwGIxD9l62NeYTGjMvCmpjK0JaSAdpcY5DbX/0tFGbCt0wr/EkYW+fJS1qaOZqsCdZPFzvzZ4vj4jzkd5tZ446mIegSuNac9vl0fC6h6pE+8+j5sKgFgVXPRfph+7miBQwvpcD84EdYAOSGu3p0wUcYxjeQWEg1KCfbRLr9ByPzC72r8SXGFUNmnW6tTXJB+RHPifaUpPMoTZWkBjqzgX9D7+ssDEJT/odeQ6PQz998lUR6EDrRIY5iz4KJXLrGD3lpQbnsm7T8vsx6Dz1Y4/6WSJGH5OARhrJ5V4aPCmDsZ0Pr0J0rcYPun655KP62qJ2hBUpw0hbRLejFso9Mb99Dljz2MF0Xt5bymecIK7bjJIrOtnF/FiVtcXy+ZDYpbLa6D0ULgTpcUKMxDfGgLfEnntZBXqCQDMFzymLA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:bpqTCzptLmqm2ao/3WlgtOelQP4PiTxttXQ4IzUnJRN6qQpJ9NhbUlk/HPhWKh9qP++slrInXHtz0UGxIwnVhUEva3BhTM1HAjtOSS6ZPDEBBBij4YiYifolBVrwYzaPDYeiYWqUAiem+srOmk1ddDCGH4UESxRIQIKjRFLKRcPIXshfWx3i7FibRkO8K7EpINzPXS5KrE48t8ImZn4HmRAgdNoC1GypOr2lcvM2BUuIxvUIiuWj3GKlP86HOBdQ; 20:e6jW2QrwObht1oSIk4qTNfBKcEmSrdJPdfzG6zaz3o64YsMiZFYwfDJULCWjRs6wbJrwZone9Bz8dSyjvnzTRMkiGNyGgCI3fwUwAB/EtCvdBuoPqIKeSLP5L3brew+1h67X0GmMadxzn++jnQTAP8ZZ5piQZeVjCa3ceBkpIcz6Z+/wdSJxTjHJRl+sZ3/aTrtqbPZD5RazQlMw3XfcHVITsUa8Bfk7CvJej0GVEdQxlmUDzx5XoCGEfUcea14hiO+8ka2p3M768tHbE06VLoq8mEx2v6gCA04PTKrl+OjSMZfkpvLlZdQpM3mjiI1mz3HByjkQsuVkl9OefnU7UNkcougazU0vavSBRf1FOpkdsIH1OCAfCvAr6k+E53BSIDzOLt5dwz4Q4cYQvU7zJfdEXAMvs6VuozjJOayIBB00XoZZPkYnGsVsFmU5medHY/hnN76Ic5AHkbQmM42Y2+lBSTzcdcrNrqLiYsfvS6uKBUO7s1vvP6Lb7xaFhpQeeTHyzt4p0PY17RVk/1tWBg2aMRE/JPgET8pojL2XWpJF9tg/G02tslQIKjTZxSj0QmW1GfayDO99eR/Lr3R4dgGWgmVeHHH/fA+mh0W+AEc= 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:eLsiUOrWj2jrfXC0FN/MdIWXXGQhB7hSLzOwZp+mnXuAsLFGjhp6U+bq/11nn2QZBMOGXXrKmRxzGileZ5wdNpC2Pp/2jYt+aSazppDbqlSanQWSh3nBXoOMYtYVMbLulMAmUdiN7WY8ajam7ELl6OuSlqDy2rwa91/OlcUzM70yGCqW//wScXmPihlI/ky+YBcNVb70eAVMqhAtBby3+lGL/1Xeqvj24sBvM5xKqD1/hndM/O3i5YxjnCVtuGW3uOKRXJVIfbsTv57Qx74CfPjY7FGgMDw3YccWAGVpQKKaHKdCS4cXLtvL7jhwRzzT4qAGEhj0INndJwFpGrTTHttPg2ZE3SiDRXVdyY8YgvUiPf1Gx9njobcidDQayqN82GVYBryASsnoVRF7T6Odn2QgV2jbncduAystSpgCcainXKgfUUtG8DH/bFzS5k6j2aW8twTKidzq5sqEiLODZX1YTlLKITiEXfoGc0ZMoazoKRdAHjsgZBqW3Ha7uQ4kXQUguFsSb4FYLDuyCdSvhaZ226p3VdIvkevBO7QY91566OrNGXy5j9bgIa++DRj0dEFb2CxAcuSXKg49q8PhI47pj6YKbgJUzsknjmLnuL4= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(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)(6666003)(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-Diagnostics: =?us-ascii?Q?1; SN1PR07M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FlzyHSSs4m03FUaUhiLT45PF2xAFyT+XjcfqsVqSvHLajScqr2aW65K6XPnrtK3oTbcXPO3WJMicel4OqW2St6Km0KQ==; 24:BDoev28yLAzTAMW0Fh5WCzjyKmnBLAm3AonoqXu3XqOND2gdiyOCCqJi54JSpaipknETPT2XbDeBxvomj5OnSpjUPH6gqkkZX/5nvWhBoxQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:9Abhp6MRDGwG9OTjPM0p9bfaQ5ZfhHkhaWRLcIA/vJFnKT0SKvFwsOaKbKlzFJ0oUn8GVVjE1Ytu4qau90Araju7xpjWBAfeYbW6fKuoT+TfZ98lR48RjlKdpahjlNl2lWRS8/igIM/5byu7ilxLZTw/ZtdVuFQX31XOuKZcQXKYGq4VBEmBDCG14taik04nqObqpwpaXp2XE7jysnEL0pu7Y1y1eqEgDmorPNl6GPLnRlvVob3oo/ca9zfx1cNIrHeM4spmfPm6qY+sBw1N5IvCRVOenV4HSJg1KEVRLNPl9j/OnEwj8jxTbmPhH1wKjDTTA4MTq01LX5vqqrQ+6g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:29:39.2142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 30/50] 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: Tue, 21 Feb 2017 09:29:43 -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/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 94a21ad..ed6d90c 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 ff1fdad..a5acce8 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; } @@ -543,6 +544,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) @@ -580,6 +582,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 9ed0030..9ec4c12 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 3fe178a..1eff46f 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