From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50085.outbound.protection.outlook.com [40.107.5.85]) by dpdk.org (Postfix) with ESMTP id EB7691B2C7 for ; Tue, 23 Jan 2018 19:43:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5aekpp9qvtqrgLv0zbbuw1gllcm/jOgmUajPAxoI/Jk=; b=qauoVj5LIIJU1CMbjm16Ziul2Ia0CcnkmKpmlrW0+OFl1IdaTPEKn8q1UHP+xIJeJyE9/WYuD3aO6pr8bEKDX8+CBDltrqbftZc6Wbis886l6/iZNxR1Y2qS86fWb8A9MKYb6ZLM0gExiHAClRoLSWohuMNuFzz5ChgjCffxHn4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3211.eurprd05.prod.outlook.com (2603:10a6:7:36::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 18:43:43 +0000 From: Moti Haimovsky To: gaetan.rivet@6wind.com, ferruh.yigit@intel.com Cc: dev@dpdk.org, Moti Haimovsky Date: Tue, 23 Jan 2018 20:43:19 +0200 Message-Id: <1516733000-1850-3-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516733000-1850-1-git-send-email-motih@mellanox.com> References: <1516354344-13495-2-git-send-email-motih@mellanox.com> <1516733000-1850-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB3PR0202CA0025.eurprd02.prod.outlook.com (2603:10a6:8:1::38) To HE1PR05MB3211.eurprd05.prod.outlook.com (2603:10a6:7:36::33) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0609fa29-0085-456d-4de8-08d562913b08 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HE1PR05MB3211; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3211; 3:GSVTDQviTVgZBLqOiC03nvw1rNEBxcuqBa2xywlvNw3eOA0TrXNJphJwaClM1Y6EpM8ZwWNeqLEVEoPuLFbMJq5IhmqGgunW6qghDV/GoqQOy8QIKnlFhpiYsMcQmSI4OJZ/ksSt1fGOn99jdzY82bDxpmBI8S6aqGbXK0DSyf5YRvkgKddC8HovT2co2tnmY2mEkbSrRWuS2EfdWmWoS9eIo0/YtSahXwo9V4py+258iN7SQhsjAvBN+zdX9eq0; 25:24BFT4ZvVyGo3myrCoUQ+axPFha8MToreosjdsZqPa9rjCkbLqACyJUe1h7yzzJhmhtKIEaCa7BVhoeWb/LJpY3Q+wdB26kif6w9Efo2msT3UUMhkpRUOLZyiruZvADQnjaWUEhSj8BLVKmeUhu7MR4nNhyDcBfFXr/mkFhLA9o2YypkfYuQJPewwtVNB4hwNihBuGi638E6Abo4m1KMBvaEskncH4mt5H0vbiuE6RWKsqgpjiUjwbknG5MVqjRH8RhKXgxvZeOfV8rNp12Ep4mlssiQCatq+nEalM/t8tAXbBHRGoUxYtQDZUkjlxxgvrwWIHs/3wAJ6dcS8fA5sA==; 31:WkAQkCzC+/nzAOy6bgs7OuppNvRTHokOJAOARd6BbKh8lsP423UqvC3oaVReRfmOmELn63QLA3xgdinJTTTE0aOs8CtceYRiI10KNu8U0HduyCjLm7mfnxRXYOP5pR00TqntI9kHPwuhTD5ZWznQOGb0JU6KdEgh/2o3vj/Swm1AW8zhZdMtOYE17aQ6MKqkJrXfXEF/Yqt0691ZOILsYjIm/v25rZl7W+o3yzgYjSU= X-MS-TrafficTypeDiagnostic: HE1PR05MB3211: X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3211; 20:nfGOXDwx7uWlia2L+BLemTSqAV4R3QYRqJmXtiOGrv327TSO1qCXlE8caqG4dDBH/2qAFjQGmI+DHY2q7AxHzA3ln5hdRLkftvhlVPuvJG0wxi+jqiNyjSsUOce8TUPih8pgLd+AEBaLzSrpawFFosftAhWNjjO5pQqYVYfTkVOZidmPK6fG45oSnRaYrvXMsvs2MCAvRe1UCf9hk/dV79ZDA+SvST5j63htqyBAdANjCbUb54riNartyUPumFed54KtIu24ImF9Pl3wnwqGqYrWMDuVIQNGOikG7smBE8RdKrCh3qh/Dc6JB3nt1l9q4LxSaPo/P9U8sv/kPrNlfJ19vHA4+xVerOUzmBtDqYJLEiUZ7HopCGDpa0RI49vE4HnkAUnlM5YEsweLxj49vFZnY8hdPX3to2dqjsSGmdm3I2PzqXFNFx89+aU1hzLZ4jkKDi9HyQ67H8dtkgnwaJE5o2pxtd/aC+iN5lnca1JsogP9suuhrFCN2drYAXDC; 4:TodB5MlGAdmCao/YA65nWz9oGEst99g1vfYNUQvwPoiYCILwK0t7oo/JglKhRdYnGkWy87GKBE0gwoQ8pkOD6UJTztCuGJ+l7R/+Q5TL8Qj0c8x9aLhBvLZJcWLCixC2zn+P4lSml+cs0nAnaV5vuYFwtjjvUq+wbPimHdxTOfGFLlZ867hKH9nGtUg8BC6mqTN470tNXxQws0uNXAKNjwjG0p0iENbHX0Sz9wNZdjYEf+pPxJeHZMSNoaUYsOswvOmGfto2FHjSOfERVhH47g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041288)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR05MB3211; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR05MB3211; X-Forefront-PRVS: 05610E64EE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(39380400002)(376002)(366004)(396003)(199004)(189003)(7696005)(21086003)(16526018)(52116002)(51416003)(68736007)(3846002)(6116002)(25786009)(76176011)(66066001)(106356001)(86362001)(26005)(55016002)(53936002)(7736002)(386003)(69596002)(316002)(47776003)(59450400001)(97736004)(81166006)(81156014)(4720700003)(8676002)(8936002)(5660300001)(50466002)(105586002)(2950100002)(6666003)(50226002)(305945005)(478600001)(16586007)(2906002)(48376002)(33026002)(107886003)(4326008)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3211; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB3211; 23:miwCR8yWTzHFGyENa8zyecXzm8GNYu/WA7Krp160z?= =?us-ascii?Q?htpfXaAQ5fT1Y1zzugE+ACVnj/WbVEj8px4+vkl9DkTuK94oRP/CLsULSDsl?= =?us-ascii?Q?flS+MmYMr3FKVjZb7VrwTsiDsXcnGD61X8o2cvPLmHFPK4/mjJGrqOta4N+D?= =?us-ascii?Q?sIPfBA/yR1Brq41uq056ZgRHtk+OVvYNxVTHpEULUN3WgbPGn2Ox/fAbIeIU?= =?us-ascii?Q?0fGelthGuDwtFKMpVTL/1knQ2JtVwslqBXY1bt4h0rvu0hz/hJjkFRd1ALRn?= =?us-ascii?Q?GL7rGCcaP5dONdpIUscPaeVX48lYyIdLu0nyXb61mPhCs3AW8qTr1NOkxkXH?= =?us-ascii?Q?OUSDciwpgvxvh449gybc1gamXwYmhcIqsPEmjTh1fFEiVNd5GnRxQUPydxgU?= =?us-ascii?Q?Wttm6XjuAmKpHYlmUQVQBmX7sJoVLaFEsXSzDoFhRpQ4MhRR+n9+rMUZJ801?= =?us-ascii?Q?VyW34v26z0QFzEaj+dQbN4WdeKIZDA3Y/0F9hFrZs3YGVJ5Qxb3r3QrXOaWV?= =?us-ascii?Q?2E/tpIx2EqhqCdLcYtlo8WT2KJcokG5hI0TrO5idTZZ2J/0M1du7/yhu9w7/?= =?us-ascii?Q?U0txJ63Z9evmGKRL2qE6Id5mzBBBSllLZAtT7049sawbUxMt0swuJwNOtaCP?= =?us-ascii?Q?cX+eE1pHpWpK0CWJwED1JbE7stdEPDN0OOYUK6OcJemR0v7eyBsL3Vk2fPmy?= =?us-ascii?Q?yZxotoUXHFeRL8pfIdTul5+XsMrW/bJYC+4jnb5uOOOp9Zhb/TguxzUIkCtk?= =?us-ascii?Q?SslNiuujSQmiqBW95LkO5reRPwzwQ75/CeKXLIlUn5qMw1/CP/qaqA+NQTd5?= =?us-ascii?Q?kuvHUCmvMSYlLioA/tJPchSETG1Fbd2eiaVYIapxAWdITGMFcleUulP0f1Uv?= =?us-ascii?Q?Qh8hompCObMQPAjswd62dR7O5MJ0KXjEF7KdUvzdMgXPCPxTuDbX5RCT6HnM?= =?us-ascii?Q?3ko67NAr2HjfRAVBRUOEbWw9qTYRKvProyAAT+yj5BisHiB/zj8qENdh0w+j?= =?us-ascii?Q?XhUPPRy8sTrVe9FYXXCXm165lNYE+imfyPMtTKO/yq72txzzZcxQfV6UB3UE?= =?us-ascii?Q?Jk0duA2mgSCSMlgJdmBe4Q/JKGHfF4BCnihRNyLQ7CrqegrttxdqwptAXpJG?= =?us-ascii?Q?kbbtCWRy4enxzjhlqxzANTqatJ/K8NkpasdzUvjtccgLj6TIV+X4LG72eqBQ?= =?us-ascii?Q?CfLGvZjHSZE3kI=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3211; 6:k93B/2Ao3lnWXcG7KNNuElQhEAiZJ/saOqDoCIs8XImWAO5sKJHH24UWJAZW2zzH5ySdB6esp5jwx8RWG/UBpwfUeJH7T27jW53m9zlPhlD3FmHeh+JWNih83r3GtVPbLIRbYt9d955zaSpmLOvRgmPAB8n8WDPpRYwbLGhfXxF7tJb8gvxjvhBeL3E0abbh2UedC/Lpp2ebywb7TWe8gQGw4jwM46PAOzpKgwqw3EbDzP71AachKkwM/iIoT5IDFK49PeSxNtQ9qyplzTANWOQk7xwO0d7qZay9dgQvwSCLXC+7Quhps8aNy7zub6tfkjPQ2HJ7ZzzTTLgLXjdF5abVVthe8MzuIHPkRxRpKl4=; 5:f+1EvOA+LZhdgzgdxi4lbkieJMzcEvXuH6ISA3GJzmL4GHdqAziNPkhT8vQtBjySydOQk8YbCxO53WjowGAAsB9QzgUF1FJ7B6iLcypiS/JI8v2TwzHy8BhhLKJCcRdQoAmsTksgv/BCyL8dh0T0dYsgVL8VfVAYHwOZo6QKsRM=; 24:H8ge7Ka+aHEbu41DlTJnfAsYIeOKmoDrtt9X9+OWyhTO3Nab+kjJC2CSwMGwovPTxTVFv+fFW/bXMrkTbp8gxNeLiFffcV+UmJSE84OMtOw=; 7:S/S3NLl98YkeD0R6UVpYSTVXx9jhD5L2rl+5VZkQjNswXVVH97rNtP/n7fWhVuIrFCd5ORr2otVKIJY1UxHl+M2nI98WobWdxgm1hjlMipg8DYEWhvaT+mqxaJ823OWR/4HuinU2uQugxyNNYdtAsWDKN3bryg9oPyu8dL6KKODqM2eq4SjwCXthm6UqFNQU6vpQVPokOGGJAZ71RUvyCo0Z0yFhSw9wLRS3ISpkvw13L44xTAgolkDDNJBq3Op0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 18:43:43.3285 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0609fa29-0085-456d-4de8-08d562913b08 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3211 Subject: [dpdk-dev] [PATCH v5 2/3] net/failsafe: slaves Rx interrupts registration 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, 23 Jan 2018 18:43:46 -0000 This commit adds the following functionality to failsafe PMD: * Register and unregister slaves Rx interrupts. * Enable and Disable slaves Rx interrupts. The interrupts events generated by the slaves are not handled in this commit. Signed-off-by: Moti Haimovsky --- V5: Initial version of this patch in accordance to inputs from Gaetan Rivet in reply to 1516354344-13495-2-git-send-email-motih@mellanox.com --- drivers/net/failsafe/failsafe_ether.c | 1 + drivers/net/failsafe/failsafe_intr.c | 196 ++++++++++++++++++++++++++++++++ drivers/net/failsafe/failsafe_ops.c | 36 +++++- drivers/net/failsafe/failsafe_private.h | 16 +++ 4 files changed, 247 insertions(+), 2 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 8a4cacf..0f1630e 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -283,6 +283,7 @@ return; switch (sdev->state) { case DEV_STARTED: + failsafe_rx_intr_uninstall_subdevice(sdev); rte_eth_dev_stop(PORT_ID(sdev)); sdev->state = DEV_ACTIVE; /* fallthrough */ diff --git a/drivers/net/failsafe/failsafe_intr.c b/drivers/net/failsafe/failsafe_intr.c index 2c92d95..2f18b3d 100644 --- a/drivers/net/failsafe/failsafe_intr.c +++ b/drivers/net/failsafe/failsafe_intr.c @@ -7,10 +7,198 @@ * Interrupts handling for failsafe driver. */ +#include #include #include "failsafe_private.h" +#define NUM_RX_PROXIES (FAILSAFE_MAX_ETHPORTS * RTE_MAX_RXTX_INTR_VEC_ID) + +/** + * Install failsafe Rx event proxy subsystem. + * This is the way the failsafe PMD generates Rx events on behalf of its + * subdevices. + * + * @param priv + * Pointer to failsafe private structure. + * @return + * 0 on success, negative errno value otherwise and rte_errno is set. + */ +static int +fs_rx_event_proxy_install(struct fs_priv *priv) +{ + int rc = 0; + + /* + * Create the epoll fd and event vector for the proxy service to + * wait on for Rx events generated by the subdevices. + */ + priv->rxp.efd = epoll_create1(0); + if (priv->rxp.efd < 0) { + rte_errno = errno; + ERROR("Failed to create epoll," + " Rx interrupts will not be supported"); + return -rte_errno; + } + priv->rxp.evec = calloc(NUM_RX_PROXIES, sizeof(*priv->rxp.evec)); + if (priv->rxp.evec == NULL) { + ERROR("Failed to allocate memory for event vectors," + " Rx interrupts will not be supported"); + rc = -ENOMEM; + goto error; + } + return 0; +error: + if (priv->rxp.efd >= 0) { + close(priv->rxp.efd); + priv->rxp.efd = -1; + } + if (priv->rxp.evec != NULL) { + free(priv->rxp.evec); + priv->rxp.evec = NULL; + } + rte_errno = -rc; + return rc; +} + +/** + * RX Interrupt control per subdevice. + * + * @param sdev + * Pointer to sub-device structure. + * @param op + * The operation be performed for the vector. + * Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}. + * @return + * - On success, zero. + * - On failure, a negative value. + */ +static int +failsafe_eth_rx_intr_ctl_subdevice(struct sub_device *sdev, int op) +{ + struct rte_eth_dev *dev; + struct rte_eth_dev *fsdev; + int epfd; + uint16_t pid; + uint16_t qid; + struct rxq *fsrxq; + int rc; + int ret = 0; + + if (sdev == NULL || (ETH(sdev) == NULL) || + sdev->fs_dev == NULL || (PRIV(sdev->fs_dev) == NULL)) { + ERROR("Called with invalid arguments"); + return -EINVAL; + } + dev = ETH(sdev); + fsdev = sdev->fs_dev; + epfd = PRIV(sdev->fs_dev)->rxp.efd; + pid = PORT_ID(sdev); + + if (epfd <= 0) { + if (op == RTE_INTR_EVENT_ADD) { + ERROR("Proxy events are not initialized"); + return -EBADFD; + } else { + return 0; + } + } + if (dev->data->nb_rx_queues > fsdev->data->nb_rx_queues) { + ERROR("subdevice has too many queues," + " Interrupts will not be enabled"); + return -E2BIG; + } + for (qid = 0; qid < dev->data->nb_rx_queues; qid++) { + fsrxq = fsdev->data->rx_queues[qid]; + rc = rte_eth_dev_rx_intr_ctl_q(pid, qid, epfd, + op, (void *)fsrxq); + if (rc) { + ERROR("rte_eth_dev_rx_intr_ctl_q failed for " + "port %d queue %d, epfd %d, error %d", + pid, qid, epfd, rc); + ret = rc; + } + } + return ret; +} + +/** + * Install Rx interrupts subsystem for a subdevice. + * This is a support for dynamically adding subdevices. + * + * @param sdev + * Pointer to subdevice structure. + * + * @return + * 0 on success, negative errno value otherwise and rte_errno is set. + */ +int failsafe_rx_intr_install_subdevice(struct sub_device *sdev) +{ + int rc; + int qid; + struct rte_eth_dev *fsdev = sdev->fs_dev; + struct rxq **rxq = (struct rxq **)fsdev->data->rx_queues; + const struct rte_intr_conf *const intr_conf = + Ð(sdev)->data->dev_conf.intr_conf; + + if (intr_conf->rxq == 0) + return 0; + rc = failsafe_eth_rx_intr_ctl_subdevice(sdev, RTE_INTR_EVENT_ADD); + if (rc) + return rc; + /* enable interrupts on already-enabled queues */ + for (qid = 0; qid < ETH(sdev)->data->nb_rx_queues; qid++) { + if (rxq[qid]->enable_events) { + int ret = rte_eth_dev_rx_intr_enable(PORT_ID(sdev), + qid); + if (ret && (ret != -ENOTSUP)) { + ERROR("Failed to enable interrupts on " + "port %d queue %d", PORT_ID(sdev), qid); + rc = ret; + } + } + } + return rc; +} + +/** + * Uninstall Rx interrupts subsystem for a subdevice. + * This is a support for dynamically removing subdevices. + * + * @param sdev + * Pointer to subdevice structure. + * + * @return + * 0 on success, negative errno value otherwise and rte_errno is set. + */ +void failsafe_rx_intr_uninstall_subdevice(struct sub_device *sdev) +{ + int qid; + + for (qid = 0; qid < ETH(sdev)->data->nb_rx_queues; qid++) + rte_eth_dev_rx_intr_disable(PORT_ID(sdev), qid); + failsafe_eth_rx_intr_ctl_subdevice(sdev, RTE_INTR_EVENT_DEL); +} + +/** + * Uninstall failsafe Rx event proxy. + * + * @param priv + * Pointer to failsafe private structure. + */ +static void +fs_rx_event_proxy_uninstall(struct fs_priv *priv) +{ + if (priv->rxp.evec != NULL) { + free(priv->rxp.evec); + priv->rxp.evec = NULL; + } + if (priv->rxp.efd > 0) { + close(priv->rxp.efd); + priv->rxp.efd = -1; + } +} + /** * Uninstall failsafe interrupt vector. * @@ -102,7 +290,11 @@ failsafe_rx_intr_uninstall(struct rte_eth_dev *dev) { struct fs_priv *priv = PRIV(dev); + struct rte_intr_handle *intr_handle; + intr_handle = &priv->intr_handle; + rte_intr_free_epoll_fd(intr_handle); + fs_rx_event_proxy_uninstall(priv); fs_rx_intr_vec_uninstall(priv); dev->intr_handle = NULL; } @@ -127,6 +319,10 @@ return 0; if (fs_rx_intr_vec_install(priv) < 0) return -rte_errno; + if (fs_rx_event_proxy_install(priv) < 0) { + fs_rx_intr_vec_uninstall(priv); + return -rte_errno; + } dev->intr_handle = &priv->intr_handle; return 0; } diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index d6a82b3..2ea9cdd 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -214,6 +214,13 @@ continue; return ret; } + ret = failsafe_rx_intr_install_subdevice(sdev); + if (ret) { + if (!fs_err(sdev, ret)) + continue; + rte_eth_dev_stop(PORT_ID(sdev)); + return ret; + } sdev->state = DEV_STARTED; } if (PRIV(dev)->state < DEV_STARTED) @@ -231,6 +238,7 @@ PRIV(dev)->state = DEV_STARTED - 1; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_STARTED) { rte_eth_dev_stop(PORT_ID(sdev)); + failsafe_rx_intr_uninstall_subdevice(sdev); sdev->state = DEV_STARTED - 1; } failsafe_rx_intr_uninstall(dev); @@ -413,6 +421,10 @@ fs_rx_intr_enable(struct rte_eth_dev *dev, uint16_t idx) { struct rxq *rxq; + struct sub_device *sdev; + uint8_t i; + int ret; + int rc = 0; if (idx >= dev->data->nb_rx_queues) { rte_errno = EINVAL; @@ -424,14 +436,26 @@ return -rte_errno; } rxq->enable_events = 1; - return 0; + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + ret = rte_eth_dev_rx_intr_enable(PORT_ID(sdev), idx); + ret = fs_err(sdev, ret); + if (ret) + rc = ret; + } + if (rc) + rte_errno = -rc; + return rc; } static int fs_rx_intr_disable(struct rte_eth_dev *dev, uint16_t idx) { struct rxq *rxq; + struct sub_device *sdev; uint64_t u64; + uint8_t i; + int rc = 0; + int ret; if (idx >= dev->data->nb_rx_queues) { rte_errno = EINVAL; @@ -443,10 +467,18 @@ return -rte_errno; } rxq->enable_events = 0; + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + ret = rte_eth_dev_rx_intr_disable(PORT_ID(sdev), idx); + ret = fs_err(sdev, ret); + if (ret) + rc = ret; + } /* Clear pending events */ while (read(rxq->event_fd, &u64, sizeof(uint64_t)) > 0) ; - return 0; + if (rc) + rte_errno = -rc; + return rc; } static bool diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 419e5e7..ff78b9f 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -63,6 +63,13 @@ /* TYPES */ +struct rx_proxy { + /* epoll file descriptor */ + int efd; + /* event vector to be used by epoll */ + struct rte_epoll_event *evec; +}; + struct rxq { struct fs_priv *priv; uint16_t qid; @@ -158,6 +165,13 @@ struct fs_priv { */ enum dev_state state; struct rte_eth_stats stats_accumulator; + /* + * Rx interrupts/events proxy. + * The PMD issues Rx events to the EAL on behalf of its subdevices, + * it does that by registering an event-fd for each of its queues with + * the EAL. + */ + struct rx_proxy rxp; unsigned int pending_alarm:1; /* An alarm is pending */ /* flow isolation state */ int flow_isolated:1; @@ -167,6 +181,8 @@ struct fs_priv { int failsafe_rx_intr_install(struct rte_eth_dev *dev); void failsafe_rx_intr_uninstall(struct rte_eth_dev *dev); +int failsafe_rx_intr_install_subdevice(struct sub_device *sdev); +void failsafe_rx_intr_uninstall_subdevice(struct sub_device *sdev); /* MISC */ -- 1.8.3.1