From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0077.outbound.protection.outlook.com [104.47.40.77]) by dpdk.org (Postfix) with ESMTP id 2C78EFA57 for ; Thu, 2 Mar 2017 12:39:12 +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=QzN4MkpTdnXM+uPvq2FHqF4TAIYCuBqL8KfIZJ4CGWo=; b=hkv1wkLTs+xEUgAf8AyaKVS4vT9lAGjuhQXDagEWdqCHOXLXzMpm/NosWmGnuj1KbQdUq1sTuUyvQzLvakgbQjUf4Gv5OATJ+NHorgxX82Kj4y50PcjTdfOS56vc48B8xXey7whjJeBXaPj4Pf20066qKKA/msz8IRDZsjKSOk8= 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:08 +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:29 +0530 Message-Id: <1488454371-3342-25-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: 5b642997-1e50-4df8-7409-08d46160be97 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:uHAZ760FFYjSWtXOC/yR2yB4NrgD8wIZ5lRMJ36+4FuPdhuf5Cg0zKqXW6Nrk3UP2cTsk8ol4bMGaHJpz1QrfiR+9cGcFcBOY/KFwv8mpTUtcbleCb9n4dlkSjKBehS7cg0ZwdzsPuTho95PygZUb5vByA1mFFd/CSKhJOxBgl64XMgvSOaFT7x2VVcqXe7/8PDqOAqxDgOWMnwAON4jURrd+T87vObbeviSzjeKOkbCxYZZi0Nlvy6NqXhg/jsR0caudMZALf4IU2ROIqNG6A==; 25:vgQ0pp1iIJHW/PKi5AQQeqHDnNwaM8YoIxDf8y5yeqWBSJAxvDIHqkGXv9g0NqPNkveyf7HL1126XiboQRGzX1enaPrYnAr7+1V7k+WHVbVgrsDnpaFx32rm1AI6xMeJIkQsGm9rpJNc+MU+GOuzbPfBwrtc7gPlalaA5zKMSCYiVAnwlu/ts6L1jvpVL6Pghjiex9lyKgWB0MBJ84iUmyFL3xk0gFsKFB3SwuYnogqDLyhis6517lBb9M5plNyHOK9HNhVDW9CewdvT9MPnAtAhb5FpKRptE7MXwSP4DVgcNm4N/gQzei9WOhyvuHINoE4KbiWuYnjeSiBSo5DtFVLpmRnGgcE9ni9cwRmaX8vzoePvUZcgmvC729zs94zicG4V1rDMDSic3eNmBz9tA8fp2xRWyzQurvAmhwYg9UgbB6rnddChjIux4l3MBXTRmuD3986NLDwGF3W7ehwRHg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:0Wt8+yvZt2iUUmF61vIgsF/o3lvagip0Iwn5NSUS/NDLtfvWva3b/wLshq/4NMRWOT0mIv97e84icQkzruTom+XMze+h56U4W59fFGLYbiEkyba4KFkVE6s1e+STfIvIi6YbNw8GD5T59gWE3+CR70PQSEHxF5VudcXq4c2z3qH4gnqn+u0ynqw9o32f0Kl27vJhuyE0fAXJGaAnh1v2lnL+aZFq/8fPuyYWTbCdCjI=; 20:SzsImyT/2tbPDYKNQqWtKyGucgGQtjPiBi9bBDtHBwFQwsAMJLef+XmnYe8RKETGjrpK/iLKePRsIBbd0ptkmMi5yUFKeJ++tGQrBbDfuK5USh6k7uCpLzfZxWl5GnkOy9hTIh7kggChqyaFywniE1xOFWUE3WqkRi7u/O15Xfk97gF+HnVgJDeynrntqcOOoEKuwP/ttbgyAFteVXDJe31lqp/l9s2uyr9SjkY7mo/mcS1lIRpT62pZ0CO3AjYMEBljUKjC4Z7h/0oruDMg8qonXX5IoNcefxAvEGcW60isAZhbJaVwh37Xb9WEUynkSyej9INCRvJzPW5vDv3r4pjKHm4NnUQ1Vi/uZRLyscCgh8i0swBAHnn0dKQU2OpK0fq6Z0zk53jiYfRUuvD0gFU5mfB9hfQgQ/ctVJsFsONqGdhlHin8C4IGFWSWNcp8A0doLnFbckSGcYzFourbuT43ZToyoz/7Y41C/dgYAN1zEEE35b2YqBtFwnzl+X5Y8pbnWPl2fWBmRHNGykUwpxR/4Rtg/BNHIzEyMZymp54+lWM9mo8BFNc2aeoc1oARFrvbO5QmY2oFEy8vFwH2SvSYJClsYCDA6bEDJGhhedk= 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:1+9SeqcCSeoryZA3LRshD+f/dg+MjbGR0MP73o5fwh0/WYdwuYDPT0i2AqXm784Lj/lPbgRgrBGQi36fr5VvEBkTQ2k5mDVDngySkDmWAV6FE/HFUKFUCyff2ziFiOMOMTVl1Y9fstXjRg4E3ZK77YhyLN1iEkUmr2ybEQjgzbIklq0IFoUqD8j9LDVRf9ZekPgwugDeOcdKFgO8oWYBiyQWaWvVfLz1o32+KN3gNUu5WZvEuW00/y99jmnXahvJCX39iHQkBcQngCdIohFKPPgbv88f/rVqtFL++GOxBThY5EhHysadAhEhwmUj1dixFKdNWQSPwNgoFeTRb0m7iJcrdUzbIDPP97J3baEQLrrIo+PmgJktCWyLymTcCaEFlrsCkXWD4MuPq8d7FwfIkmmTmxBKDVsTETpDI3vb2gecDRA5qBpnSKi2kSnhfGpqYqWvWvUr/PDlr0pFqHyxz4zFNzQVAEf86D86U9T0CrpYYzHR5nq/vYk+u2mmrJEKeSfQpzTvijcamO0EXrHVaxBQ6y0WUCwhDqZAoumsHFE7LxTpu6vgpRX9PozyBhkWGpLgYmJ8XkICuzxoCRXI0vKUsMixa7w0BW5hyQ7aCfg= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(575784001)(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:mn0LgmdVve0oG2P4ergZrILZUCd8azZUprdbJs3+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F4VJ0r/WuDvmpxnN0eR4Frb2lroZFfwAz/K/Fr5LpO6fge3Sel6pVwDkWcxWyYu8lZHxCtxFF5RhXy0KyWLLDg5rNkUvMM9kF9vXWTnCBJbjTrekDX6i5cljY3HvSSXrplxuTXAQ4a7ir+hbMAXKz2aTZNY5715jb5p896wUyuJqH2rSz5loDkMO0b5Hi++PNIcmkOSFEek/VxxGwRtgeVgGX1MSIeSR+IEswe7YIkYUkVIV05WCuE/51XMdro7nd1Zpzjc2/IOA6+D8H3dNKhP9quqz04OMYF+kqi6btRVhAeVTLCLq0PtjVQqWh9eT2n74/+4k9B/8u8VHQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:39:08.4214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 24/46] net/liquidio: add API to setup Tx queue 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:12 -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_ethdev.c | 60 +++++++++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.c | 39 +++++++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 3 ++ 3 files changed, 102 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index d5f650e..9e2d3f8 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -148,6 +148,65 @@ } } +/** + * Allocate and initialize SW ring. Initialize associated HW registers. + * + * @param eth_dev + * Pointer to structure rte_eth_dev + * + * @param q_no + * Queue number + * + * @param num_tx_descs + * Number of ringbuffer descriptors + * + * @param socket_id + * NUMA socket id, used for memory allocations + * + * @param tx_conf + * Pointer to the structure rte_eth_txconf + * + * @return + * - On success, return 0 + * - On failure, return -errno value + */ +static int +lio_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no, + uint16_t num_tx_descs, unsigned int socket_id, + const struct rte_eth_txconf *tx_conf __rte_unused) +{ + struct lio_device *lio_dev = LIO_DEV(eth_dev); + int fw_mapped_iq = lio_dev->linfo.txpciq[q_no].s.q_no; + int retval; + + if (q_no >= lio_dev->nb_tx_queues) { + lio_dev_err(lio_dev, "Invalid tx queue number %u\n", q_no); + return -EINVAL; + } + + lio_dev_dbg(lio_dev, "setting up tx queue %u\n", q_no); + + if ((lio_dev->instr_queue[fw_mapped_iq] != NULL) && + (num_tx_descs != lio_dev->instr_queue[fw_mapped_iq]->max_count)) { + lio_dev_err(lio_dev, + "Reconfiguring Tx descs not supported. Configure descs to same value %u or restart application\n", + lio_dev->instr_queue[fw_mapped_iq]->max_count); + return -ENOTSUP; + } + + retval = lio_setup_iq(lio_dev, q_no, lio_dev->linfo.txpciq[q_no], + num_tx_descs, lio_dev, socket_id); + + if (retval) { + lio_dev_err(lio_dev, "Runtime IQ(TxQ) creation failed.\n"); + return retval; + } + + eth_dev->data->tx_queues[q_no] = lio_dev->instr_queue[fw_mapped_iq]; + + return 0; +} + static int lio_dev_configure(struct rte_eth_dev *eth_dev) { struct lio_device *lio_dev = LIO_DEV(eth_dev); @@ -294,6 +353,7 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev) .dev_configure = lio_dev_configure, .rx_queue_setup = lio_dev_rx_queue_setup, .rx_queue_release = lio_dev_rx_queue_release, + .tx_queue_setup = lio_dev_tx_queue_setup, }; static void diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 4e63a50..b0dfc9b 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -861,6 +861,45 @@ lio_dev->num_iqs--; } +/* Return 0 on success, -1 on failure */ +int +lio_setup_iq(struct lio_device *lio_dev, int q_index, + union octeon_txpciq txpciq, uint32_t num_descs, void *app_ctx, + unsigned int socket_id) +{ + uint32_t iq_no = (uint32_t)txpciq.s.q_no; + + if (lio_dev->instr_queue[iq_no]) { + lio_dev_dbg(lio_dev, "IQ is in use. Cannot create the IQ: %d again\n", + iq_no); + lio_dev->instr_queue[iq_no]->txpciq.txpciq64 = txpciq.txpciq64; + lio_dev->instr_queue[iq_no]->app_ctx = app_ctx; + return 0; + } + + lio_dev->instr_queue[iq_no] = rte_zmalloc_socket("ethdev TX queue", + sizeof(struct lio_instr_queue), + RTE_CACHE_LINE_SIZE, socket_id); + if (lio_dev->instr_queue[iq_no] == NULL) + return -1; + + lio_dev->instr_queue[iq_no]->q_index = q_index; + lio_dev->instr_queue[iq_no]->app_ctx = app_ctx; + + if (lio_init_instr_queue(lio_dev, txpciq, num_descs, socket_id)) + goto release_lio_iq; + + lio_dev->num_iqs++; + + return 0; + +release_lio_iq: + rte_free(lio_dev->instr_queue[iq_no]); + lio_dev->instr_queue[iq_no] = NULL; + + return -1; +} + static inline void lio_ring_doorbell(struct lio_device *lio_dev, struct lio_instr_queue *iq) diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 76d067e..86d5864 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -548,6 +548,9 @@ uint16_t lio_dev_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t budget); void lio_delete_droq_queue(struct lio_device *lio_dev, int oq_no); +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); /** Setup instruction queue zero for the device * @param lio_dev which lio device to setup * -- 1.8.3.1