From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0052.outbound.protection.outlook.com [104.47.33.52]) by dpdk.org (Postfix) with ESMTP id 53EBBF94D for ; Sat, 25 Mar 2017 07:28:09 +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=k5sqszR1JR7PjwC7umhQ9EC640HPTp7KJKpao5/ScdWJSIIFO1Ma81B5zAb2NC9S1GhJaNR8rLLTmqWDsEIj2nqSnJYZYc8Z0obvnN1B7VgHc6KiK20MxI6zGyfqPVTxc2/fRFlynS5a98pGdFAL/fRuMTK7sCoSGRlOLKkocbs= 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:05 +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:35 +0530 Message-Id: <1490423097-6797-25-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: 5c4a1909-b7f2-4150-fc5c-08d473481a35 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:rPFDxD1rz1yQNJjfcN/Adej9grem98ZKiLTnv9pmq+xxFOx6j1Q+hWyYHFg2s3fy8M0ZNs0Nkv6LXxwsfK1F+UyYZIZF5GAs4ZibjwPmhdWx/AkaB8EENDsrudVxuPCvpqWy7g+uFn0BE0R+7KqXX41IsRSQ2DeuIF6g263kxx/5z3IQnlqQF9pSGymOAjUEzM5BEa6voy3OypmMFh4N7RyPd4mB/7NRf/gKo0/MJUXEJRuMNpAEvBiXMe2W/lkL3F3ycEZ1yeeGOMD6nQCs8w==; 25:0gew3FySBy6yFCcJSO7gdh6RvuFfvTrw3HLTz8EkEzahjHop/MVGHkq7Jy3O1yzjXMOErw6jFO0BVodG47rR6QtsFqUbtQ4TXTmKFIF0yFg3sP8Lj/yzlQyy6vKY7r2cYRNGbODQ4qmFaA/GREPZQrffKzGKzJLW6wPas5tdMbb0GK0gFHFnV3RuwFqtqRrIJoZcCDxnMN4kVl7uENEOHWWTMjR5wN8z8IjDV5pUus/dzTuoL4IuBlBNQ6puVT3I2zl43QRvhDsaKFL4JvfjN6REi+swuGFzgaR9wzRROXkhRdBUogrAEOlQXFEj7zyeRSBB9DIMUzFcJUOr65Z99qO0msQl+IBkRiJUzx7ODTY6Q7GqE1c3tt9istDU96s0Zy7cgXApUlmkVQ/3WPtP2zDhi3z9Psn6FAaKWOQzasiu/7n35WcJI5AwE72v24KoLr8sCEPpv9lyDl4oAFiJ/A== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:S4SxXi2cRoRH0nLaT2A5e/a2mSMe0kpQ/rgDo25KDfJcf7dnsfBuHM/ntox2Ka6Ehp3tomZtf/pDEKpH6WHGOoG/9paLd7e1QbU6cwgDbqq50u6NCxmWa2llI74BXOEzPKZAad+DlCsxPVBYz+cfzZrW5u0jevyq9RQgMOB6R33oyqUjL1TN1QTIDZGzn1+uvcV3eU3FN5xMu4ZK0Ptym/o/EuiiNvH8KXHMIwxez28=; 20:iJvNQUXVYr0OY9FDgp9Waz9nPrQuJj8zJKvMrUTVwuasiKRx0wqP49UoTY4u1O6yWh2sBxQMTiSH40nvwb16b2beJDxdjFqkD8pyXxtBTbAkYDJH9XwYc3SVK69CM7iLHuxRY6/lb1ro+B4tBWkcTRDddL2c9pB4wrck7r5ZG4U6qFhpcfN6K1OSyOMyrXt0+KSv6lm1lIpKYf/BC5yDfNPLZVZt+B3PCjWvr+TRfTdqS8u+l0/bkaTzvPdSqPV/F2jjB1/gfLt/PoPQrar/Xny3qu+Z+westzTqXJVcO5AeZ/nWfzi6ZHXBoU+3MOjk/qNUi/fBtS8bx8j6z/MgbF2tTgVAIzqIxxHCtfKl/i3IwtOjc2ZO7KwaZvRyy38wT3xz4YLt21fHbOWtNeWaDEs0sVpTzOx6PZm+DCNLYsNByUPkHQu6pRLLUj2ARXBk7+mysD3DOq8tzzcoOc74td209WaGh7IVE3gy5rmjgY+7KFk7JgMDF+N5QcxJKE1ifJIpU3X9Xo8m3KmlvAL+pneLxmhXwPM8C75L2H82lapcZOYXdTUB1kkjGBxrYJ/2cCYCYhOTsQz3dVt7bP1CIAp3xhjgD+1BxlYfSmM2Qwo= 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:EwrS40nHk1M+SuyFCVr9TOF7rzIv9pp3aQJUNGcZotwIRJqfDej83+R+I1WZ6mGRHkt/FLvxILvjFOuljkDdRCdsmysOD6LaBalES3bsYao5cl8ycoa4Vn8mGC9z3L4E7oLwM8mEmu5ZKzSsiFAYFBRoBRrdj2qOSFRcwGXmgxWTf2CPS9Z/HOUnxJrioqk+0CpeILRmYCMI6SbZlSQnWwIiPj4iR0l6ogsO2FTJbP5G7DQg/ENMSuwML6nv+DIfdcucPhJDXwIC7KIcSOdUNLX5pzy/CMhd/kg8W7mlQN6hBAzMiQjLwrI/fgizFkBLpzVMaFH544y1g9z1juqc0Mo4NUbd3GfxK1KmqGBb8Twm6nRDKZ4lXPDlLJNfEdbs6ttKgpEHbvyggC0Mo92Hp2C2oaq7qw85S8DIzINyIf5G4wRWhOmBKUmFSdDxYEkux8SzXbTwSuuoCv7N3/0AzOisIqzwvNgFZLOzt61TzjWXY4yQ2ij+gDKk5rjKuGeW5O2USqmY9kHI8mBmk2npYO6AeDuJBKdX4dQ6berVhC26eUeHE6NafKETN8WWlPjzDtJY3LuXRtZ7V2A6oRgOXhKASCLS/mVeXoKFFjg8aY4= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(575784001)(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; CY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?= =?us-ascii?Q?XRDpCKBB5faRj5ehJnZMoRbcKPmboo1X0wTd7/+/kRjx25xOX8M9+mfPAmXv?= =?us-ascii?Q?cvQi6rnCZmZA0krPx0mqhcUU6vV/0QYRQmEkfVX/uDvFsa0sY4sFGbuy8MuZ?= =?us-ascii?Q?0KrwyCEj7O9uT4KOh5KZC3C8aetpdwwrI08k6Zn9Gd/ySvuJDWhZS+Fd/0sm?= =?us-ascii?Q?bJcX3rAhq6olQjfMt2bBPD51OE9iMP3BWgIgJCzSb/d2HsQDw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:ddc06alXFNJI21OovT6pZ8I8WOL0ySpr+2KFX53u3LjYjTlK6fEuvGJnv4irVG4hUfUA6gEcrC5qKRvkNARESYWwH7ZnYmCOOv6JT8oDof79wOUj/YEL7y/FjH2EqBrxBjLMxYWNAX0J/jqdYce827otiTnUqTYuL982aSginep7uIUCNcOORVftOdRRLb4/bSEbOMc496G/HvqZY28ZpqGxPI6v61YfSWrZQfM1pcnnRy1KBjC1xRavitBRCn2J2A4TkzyWMxRIVo/BnPCA1JE3IxY7ImBkLu2+KbnyzNHJsvEaUr2pV5AabcOB7JCcxktd46e612oeaiLLxfWunNyALsusdDpOrJX2l8jfxeJVntB6fTnxaW806TCbgCd25Ik0ggTqy3zLhGz0YmgTmw==; 5:oz49FwSWJ/0oi2kLYYO7PUr2we9/M75qe5nM8+El6oDS8lhyStMdk2vUlE3nmJ/IfA3pQhQbvU1Gfdu1YwG1ei9W/KxHXa0eu4fcjvzE6afrTk3m3VGsgeisED8IOomBPxjZ4Jsg2M4ba7Tfu/7AOQ==; 24:k5okxyUF25t+OpSBECltWiqyi46zSUQLP39L41YPATRTeJ+ovHApPeCFrn588Jul225rkgEgfxnP73lIS9qJMNE6nXdeACf/qTX6NNTrAKw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:vIWyxV0wLZUwDKixjaWX/ZfuazdaaAugdSgZGeaCMO84OHtyMjAQIlP14xGywG/8HPZ2L8FArBJ9zz3Tv013UvHD1x8A/zqsNRR+bY3KESXCshon3iG+LUKGFal4E48P2Ikc61xP/zhJOltGwP3XUHA9F0F6cSoWOcCndMJRnr/oOK9YJLTl0DQ1XYFog2hBJCQsj2VFtMOasl9F+ufWbDhFKihr4U8b3nQNjWOFrxOFoaoiSeOE79O3ch+w5tWVi14Q/5DkBBVbzxQSD9HNNl0lU4bqXyXTRV1HRADOsiYfrVKmKc6dY4QwZ4Ok/3E+I2aV3kw+TD9oJVkF8/g90w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:28:05.6848 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 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: Sat, 25 Mar 2017 06:28:09 -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