From patchwork Tue Aug 1 16:54:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 27350 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 B8B04A266; Tue, 1 Aug 2017 18:56:07 +0200 (CEST) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 968CAA174 for ; Tue, 1 Aug 2017 18:55:39 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id m85so20319724wma.1 for ; Tue, 01 Aug 2017 09:55:39 -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=ruA68SiQqHyqQnKFHhk7gGdNk3XdHOF7tWBGNl5ck64=; b=mVZoinlU5Dkf/Yj8YIt0udKB5K2m7uJTM3MSI/VBd4CMhlWCW7lJEUeij7v49V2eOe mMEZzBoocGKWg1av2ngDVmVjPUF5VD5dFeKapki2OtSbdPuFgjhH7RMDY193xMMQFGGA eojTfArdXlDb/6LfRtrO0/uDoo/C6jj0pA0svphAQ+YSzDmTMswYkNxqmHSQlDBs+DEZ i8As4eqgtyVGCLQvL1Qxn38Elo0WugB/XIBoiVRA+dpDkhnqGp+cJMLv8zYhwt+XSH/v YNNhX3OQc0oe+ZZGVJ8CJyIAh+gwYEE3jYZWqKWlky3T/tssNwOqSXzGL9uNtiykP3fl gy5g== 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=ruA68SiQqHyqQnKFHhk7gGdNk3XdHOF7tWBGNl5ck64=; b=BdNzPaJLk0AaaNp65va1nbxngalFAvJfKeSyliL7b7tUR1AIxjlEFbuUN/WgeMpqd0 iZocoYcqEaNIhlqA0EYBwH4N6YYSmT7/E+271dpkuQXesO/G66F15uq2MgGNRssS6D5f dAboqgoRU/t4AyGt+uT7SsFkoasm5NpkJahpezjk/kssJteND4evdQHlzx+Dr5xYNA9K o9YJRuWgMoS5d3Yzn3Wel83FqoYben2cHBYC0KmtFkVjSNJSFg3YjOX+k1FqFAKf4WRh Qa8+jGFwV1X3jxCJgNtG7MhYi5NfqhXzX2nCJaH1e9Y34inkRrAdbk61vmUkXT7iDoir aM6w== X-Gm-Message-State: AIVw112fdaic981TpiVHOmzF/Igbbxz7IL5FwkLXOKyLEBNxk9/2Fm7M D+sw9XAnv5zikq/iUmk= X-Received: by 10.28.165.11 with SMTP id o11mr1925004wme.49.1501606539077; Tue, 01 Aug 2017 09:55:39 -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 p45sm34696811wrb.75.2017.08.01.09.55.37 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 01 Aug 2017 09:55:38 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 1 Aug 2017 18:54:21 +0200 Message-Id: <19ab8ff91ad9aefcfd9c8e7126c707fe4aa292a3.1501598384.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v1 34/48] 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 07a47ea..7fc9b4c 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2888,8 +2888,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; } @@ -2930,7 +2929,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); @@ -2938,6 +2936,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; } } @@ -3068,7 +3067,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; @@ -3080,7 +3079,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; @@ -3133,7 +3131,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); @@ -3494,14 +3492,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 da3e16b..087c831 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. */