From patchwork Fri Sep 1 08:06:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 28235 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D411E9994; Fri, 1 Sep 2017 10:08:13 +0200 (CEST) Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id 7EED79971 for ; Fri, 1 Sep 2017 10:08:07 +0200 (CEST) Received: by mail-wr0-f177.google.com with SMTP id p14so4470698wrg.3 for ; Fri, 01 Sep 2017 01:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=AWrRuQX7SohKNjF0aBCfBd3eQMFFAUx+qOE9BDFV5F0=; b=1xc30qBCsV2/kW0Ib7SSZZ9Q5T4SJ3chstlikExCgTWyjnBtPQSFCEpgrA2a1wfT4o x+Xg0UCn+pFfNxTCCe0hcJEBXJKQhHudG19kmXNozj96DU+Lg9jALRdKKadumKvbK81v GRRtTK3tLjD7VXGvfwlMzUiHQl9h7wykyN5/Ji91eM91UY4sk1E7nI72to3hjelTLAty Cbf7e2fi2KrLfYZfOX5egbzcGhlkiP62bma6Y3htZAt7LaPzckWO+5HkR0N8XmQ3OlOO qQKT6kDbnr2v1vD/eO8mQYuOjfK76tT06wpW6vIAnDywqXrvpLUEkLWv4CLyKIDkVXcj FdPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=AWrRuQX7SohKNjF0aBCfBd3eQMFFAUx+qOE9BDFV5F0=; b=GGKcTypdaZoJa0cCh6jAXIMzEKL2bAMn05W2JAN3BLrL8VWEv+sV54bYbEDTIB3bhm jCAvHCJX9zlsuj9u88eQHob8NVb8G/I4awJ0zGwiZv9Q5du4KjI7nWyyYuBSI9WdfO2O M/12MmIen99ijxeh+mt2qJOJd2zn8BHJH0abd6/l5ux9hnsh8NgL/kTdBE6fBUGaDosA e5XcrLkiRnrCPfG385UIZdAvGGmf5a+JzQyqDV6j/QDjxozSy3qkw6/XTbmqAbWe4k1w aqYdEDcLR68naogtR6XKOvUPrOo8TX08GoN8UG5SxJIGkExVsimhuiun5fd/4yAPYKPo 7hsw== X-Gm-Message-State: AHPjjUhJfrsinjTLYzadR0cOpFsvdSMpPca1iEZrAsUGkA/QdigESoSS wD9VbrTzfjdDuJIQZKc= X-Google-Smtp-Source: ADKCNb718kepalKU6x/N9UeChZSaSWw4hgx7aILhYlfb7QpoI5t3//UbxEWT3yY9NarkmD3qOYWQkA== X-Received: by 10.223.172.119 with SMTP id v110mr309400wrc.145.1504253286899; Fri, 01 Sep 2017 01:08:06 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id t98sm1383268wrc.34.2017.09.01.01.08.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 01:08:05 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 1 Sep 2017 10:06:50 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 35/51] net/mlx4: use a single interrupt handle 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The reason one interrupt handle is currently used for RMV/LSC events and another one for Rx traffic is because these come from distinct file descriptors. This can be simplified however as Rx interrupt file descriptors are stored elsewhere and are registered separately. Modifying the interrupt handle type to RTE_INTR_HANDLE_UNKNOWN has never been necessary as disabling interrupts is actually done by unregistering the associated callback (RMV/LSC) or emptying the EFD array (Rx). Instead, make clear that the base handle file descriptor is invalid by setting it to -1 when disabled. Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 32 ++++++++++++++++++++------------ drivers/net/mlx4/mlx4.h | 3 +-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 7e71d90..21762cc 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2817,8 +2817,7 @@ priv_dev_interrupt_handler_uninstall(struct priv *priv, struct rte_eth_dev *dev) ERROR("rte_intr_callback_unregister failed with %d %s", ret, strerror(rte_errno)); } - priv->intr_handle.fd = 0; - priv->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; + priv->intr_handle.fd = -1; return ret; } @@ -2859,7 +2858,6 @@ priv_dev_interrupt_handler_install(struct priv *priv, return -rte_errno; } else { priv->intr_handle.fd = priv->ctx->async_fd; - priv->intr_handle.type = RTE_INTR_HANDLE_EXT; rc = rte_intr_callback_register(&priv->intr_handle, mlx4_dev_interrupt_handler, dev); @@ -2867,6 +2865,7 @@ priv_dev_interrupt_handler_install(struct priv *priv, rte_errno = -rc; ERROR("rte_intr_callback_register failed " " (rte_errno: %s)", strerror(rte_errno)); + priv->intr_handle.fd = -1; return -rte_errno; } } @@ -2997,7 +2996,7 @@ priv_rx_intr_vec_enable(struct priv *priv) unsigned int rxqs_n = priv->rxqs_n; unsigned int n = RTE_MIN(rxqs_n, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); unsigned int count = 0; - struct rte_intr_handle *intr_handle = priv->dev->intr_handle; + struct rte_intr_handle *intr_handle = &priv->intr_handle; if (!priv->dev->data->dev_conf.intr_conf.rxq) return 0; @@ -3009,7 +3008,6 @@ priv_rx_intr_vec_enable(struct priv *priv) " Rx interrupts will not be supported"); return -rte_errno; } - intr_handle->type = RTE_INTR_HANDLE_EXT; for (i = 0; i != n; ++i) { struct rxq *rxq = (*priv->rxqs)[i]; int fd; @@ -3062,7 +3060,7 @@ priv_rx_intr_vec_enable(struct priv *priv) static void priv_rx_intr_vec_disable(struct priv *priv) { - struct rte_intr_handle *intr_handle = priv->dev->intr_handle; + struct rte_intr_handle *intr_handle = &priv->intr_handle; rte_intr_free_epoll_fd(intr_handle); free(intr_handle->intr_vec); @@ -3429,14 +3427,24 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->device = &pci_dev->device; rte_eth_copy_pci_info(eth_dev, pci_dev); eth_dev->device->driver = &mlx4_driver.driver; + /* Initialize local interrupt handle for current port. */ + priv->intr_handle = (struct rte_intr_handle){ + .fd = -1, + .type = RTE_INTR_HANDLE_EXT, + }; /* - * Copy and override interrupt handle to prevent it from - * being shared between all ethdev instances of a given PCI - * device. This is required to properly handle Rx interrupts - * on all ports. + * Override ethdev interrupt handle pointer with private + * handle instead of that of the parent PCI device used by + * default. This prevents it from being shared between all + * ports of the same PCI device since each of them is + * associated its own Verbs context. + * + * Rx interrupts in particular require this as the PMD has + * no control over the registration of queue interrupts + * besides setting up eth_dev->intr_handle, the rest is + * handled by rte_intr_rx_ctl(). */ - priv->intr_handle_dev = *eth_dev->intr_handle; - eth_dev->intr_handle = &priv->intr_handle_dev; + eth_dev->intr_handle = &priv->intr_handle; priv->dev = eth_dev; eth_dev->dev_ops = &mlx4_dev_ops; eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 5ecccfa..ce827aa 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -169,8 +169,7 @@ struct priv { unsigned int txqs_n; /* TX queues array size. */ struct rxq *(*rxqs)[]; /* RX queues. */ struct txq *(*txqs)[]; /* TX queues. */ - struct rte_intr_handle intr_handle_dev; /* Device interrupt handler. */ - struct rte_intr_handle intr_handle; /* Interrupt handler. */ + struct rte_intr_handle intr_handle; /* Port interrupt handle. */ struct rte_flow_drop *flow_drop_queue; /* Flow drop queue. */ LIST_HEAD(mlx4_flows, rte_flow) flows; struct rte_intr_conf intr_conf; /* Active interrupt configuration. */