From patchwork Thu Jul 12 09:30:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?N=C3=A9lio_Laranjeiro?= X-Patchwork-Id: 42950 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D38521B57A; Thu, 12 Jul 2018 11:31:34 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 2C7ED1B526 for ; Thu, 12 Jul 2018 11:31:28 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id h9-v6so20974489wro.3 for ; Thu, 12 Jul 2018 02:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qjBo8v3AxKvoiPxec9Q3pQKBaqGYlE1KG6Z5NSIWHgI=; b=lPZKTKy5gxKrq79N8kvsyPEsbs5dFkA0xQZFY74s9WC6FS01fUKMzOZZOdqM/7jUbK V0P0cL8UI7fvVHVCC7yySiwDxGzww0OwTwCn+zJI7+pzDHfMi8fOmF9ZE5NLjoHkTWtn 7p01w9qyS0+T2E+EH7DP7PAtL+7eFiBiDmWL+jtF4LKlCM/hurAcizH3EueXHISWXW/d aN2GTKpgbELOOax/zRWnSU+IKfNz8t8w3tuJSrf2I53G89PCwf1hFPfGvWB3coLsgznu ftRjKzsu9iCTu067g4ETDKJwxHjy8n02dQE3Pyl2Zq8ZwygLlmw1FGOecwGGvw80DB+T 8Nmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qjBo8v3AxKvoiPxec9Q3pQKBaqGYlE1KG6Z5NSIWHgI=; b=e2WpShyrqeL8TDKtU6t7K9inVEoWqO+77GQg2JQNE015vsxrGXqpShr9wVp7JyxXLB qYcIAHI0AFrAvophNEVVlVU0BJAXSQgyOuxCXOuWhtzVMXCZdIp1loGy511SyWBz561U 0eVHCha82J3yXKToB3Aesahmyne3FIH0jjEoTDuWn+JSvKROqSuU7df/SM8D3eRco/F4 qjQg35KqHMnU0+TvUSmnO7+E2+1ZOo0hSzfxQWD+BC9g1BB60O/nM0tQbhjeW1R5fNbh 4M7NkdG7xS50wFbSuHHBr69t456NrKXD1xqlILTaHRnDj5K3YpP53fRWocAhgELwSZ1z TJyA== X-Gm-Message-State: AOUpUlHctxPeOyHP9aP5FfK6e8rC1ToxEVuQYtQihkoeOqKBIHahg/SV uGwTaSKqyyxx8zPLcsGVUVJUj5TVlA== X-Google-Smtp-Source: AAOMgpd3KbK3nyrZEe6uMWjrPxoXzlm6AmQ93oc3fBkEwFMwxhvc/czh0Br+GG7L/0YvgVasoIehsQ== X-Received: by 2002:adf:c78e:: with SMTP id l14-v6mr1124631wrg.230.1531387887712; Thu, 12 Jul 2018 02:31:27 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s2-v6sm18717603wrn.75.2018.07.12.02.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 02:31:26 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org, Yongseok Koh Cc: Adrien Mazarguil Date: Thu, 12 Jul 2018 11:30:49 +0200 Message-Id: <8404fe64d562a672f999591e77abcdb1881d83b6.1531387413.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 03/21] net/mlx5: replace verbs priorities by flow 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" Previous work introduce verbs priorities, whereas the PMD is making translation between Flow priority into Verbs. Rename this to make more sense on what the PMD has to translate. Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5.c | 15 ++++----------- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.c | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index e9780ac8f..74248f098 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -717,7 +717,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, unsigned int tunnel_en = 0; unsigned int mpls_en = 0; unsigned int swp = 0; - unsigned int verb_priorities = 0; unsigned int mprq = 0; unsigned int mprq_min_stride_size_n = 0; unsigned int mprq_max_stride_size_n = 0; @@ -1139,16 +1138,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, /* Store device configuration on private structure. */ priv->config = config; /* Supported Verbs flow priority number detection. */ - if (verb_priorities == 0) { - err = mlx5_verbs_max_prio(eth_dev); - if (err < 0) { - DRV_LOG(ERR, "port %u wrong Verbs flow priorities", - eth_dev->data->port_id); - goto error; - } - verb_priorities = err; - } - priv->config.max_verbs_prio = verb_priorities; + err = mlx5_flow_discover_priorities(eth_dev); + if (err < 0) + goto error; + priv->config.flow_prio = err; /* * Once the device is added to the list of memory event * callback, its global MR cache table cannot be expanded diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 227429848..9949cd3fa 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -122,7 +122,7 @@ struct mlx5_dev_config { unsigned int min_rxqs_num; /* Rx queue count threshold to enable MPRQ. */ } mprq; /* Configurations for Multi-Packet RQ. */ - unsigned int max_verbs_prio; /* Number of Verb flow priorities. */ + unsigned int flow_prio; /* Number of flow priorities. */ unsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */ unsigned int ind_table_max_size; /* Maximum indirection table size. */ int txq_inline; /* Maximum packet size for inlining. */ @@ -317,7 +317,7 @@ int mlx5_traffic_restart(struct rte_eth_dev *dev); /* mlx5_flow.c */ -int mlx5_verbs_max_prio(struct rte_eth_dev *dev); +int mlx5_flow_discover_priorities(struct rte_eth_dev *dev); void mlx5_flow_print(struct rte_flow *flow); int mlx5_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 5e325be37..8fdc6d7bb 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -76,17 +76,17 @@ struct ibv_spec_header { }; /** - * Get the maximum number of priority available. + * Discover the maximum number of priority available. * * @param[in] dev * Pointer to Ethernet device. * * @return - * number of supported Verbs flow priority on success, a negative errno - * value otherwise and rte_errno is set. + * number of supported flow priority on success, a negative errno value + * otherwise and rte_errno is set. */ int -mlx5_verbs_max_prio(struct rte_eth_dev *dev) +mlx5_flow_discover_priorities(struct rte_eth_dev *dev) { struct { struct ibv_flow_attr attr; @@ -106,25 +106,25 @@ mlx5_verbs_max_prio(struct rte_eth_dev *dev) }, }; struct ibv_flow *flow; - uint32_t verb_priorities; struct mlx5_hrxq *drop = mlx5_hrxq_drop_new(dev); + uint16_t vprio[] = { 8, 16 }; + int i; if (!drop) { rte_errno = ENOTSUP; return -rte_errno; } - for (verb_priorities = 0; 1; verb_priorities++) { - flow_attr.attr.priority = verb_priorities; - flow = mlx5_glue->create_flow(drop->qp, - &flow_attr.attr); + for (i = 0; i != RTE_DIM(vprio); i++) { + flow_attr.attr.priority = vprio[i] - 1; + flow = mlx5_glue->create_flow(drop->qp, &flow_attr.attr); if (!flow) break; claim_zero(mlx5_glue->destroy_flow(flow)); } mlx5_hrxq_drop_release(dev); DRV_LOG(INFO, "port %u flow maximum priority: %d", - dev->data->port_id, verb_priorities); - return verb_priorities; + dev->data->port_id, vprio[i - 1]); + return vprio[i - 1]; } /** @@ -318,7 +318,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, struct priv *priv = dev->data->dev_private; const struct rte_flow_attr attr = { .ingress = 1, - .priority = priv->config.max_verbs_prio - 1, + .priority = priv->config.flow_prio - 1, }; struct rte_flow_item items[] = { {