From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 259EF1BF9C for ; Wed, 27 Jun 2018 17:07:37 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id f16-v6so2408810wrm.3 for ; Wed, 27 Jun 2018 08:07:37 -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=60xI5M+vRxd4EpeGx71HPnAEEJfS/TUlZpd0pfrPlP0=; b=TZ5ix9TjogwO3JCYTO8/H5NFn4nrbgCV3Y/DBL5kHN9ZKhmU/UqGC3UJL5e05/NiRp K0fgIdjSzBjh+EZc/5jLGUuexyk/wUUuNJjx9gIr1grOnOy90H9ngzpRcNMgprLzEn6X lEFmeG+nOhGkXGnKdciU6ja8b7ItiT1hgAIg6DG9q0pXLk4j2WKMfUhjoY4QT6SKLbIb 9ezn8fklGI3ws33s/4NoaQxSJtUOYsIT0D5nbCnzZdiETORoLeGrn9h3q6t5y2gt9nh9 45DnwbwmNmFHoWJpEULfGe46mkD3cfC+4tdo6mG8CmXmjl0pn/RAYa/HBkSW6OsUZRCC cL4w== 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=60xI5M+vRxd4EpeGx71HPnAEEJfS/TUlZpd0pfrPlP0=; b=Gp49/7BcRfv1h8BKDH69X3E6lZR/+DpDdH/syjovx1E/TnNwph9GO4XQ07ezOuzq9d DFyRB72P1SB/Ps7JsxcM8JbenhaUJJJDsHjMytx7zAeLPgx/XCORv0jAt2EIRZkenMty UkjG9Ay3960avRr4DyyhWrF5exwRL9nB+xCpdDFtftadwYaLIs0hyBezSK65Xozw91BU m7m7dfqnJS9jZrqvR0E95bxgfOkwRSY+T/7vtdQFed1j2wlpdOVx9ydnnWak2QgoVRho S+wfQTMqUpYpphEXsRdJvOxBIjoz4+VWYGrgbUTdZjOO7o8F4fvhYnwWubNF4aHFANba 83VQ== X-Gm-Message-State: APt69E1EKY8RRjfQRqtimQINtZ404c2iqhimuAK7UXSzCPqQekJaooqX jITahpIMNj6oucau4PB1EjrgnmiYlg== X-Google-Smtp-Source: AAOMgpfidZOhevN8HAVvdxMXSyjopUsLfi7C5hECsMqCe/4SRXjJUIfGOv6hvu/bfD/56Z81JTzYPQ== X-Received: by 2002:adf:9148:: with SMTP id j66-v6mr5739976wrj.118.1530112056547; Wed, 27 Jun 2018 08:07:36 -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 k17-v6sm4872513wrp.19.2018.06.27.08.07.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:07:36 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org, Adrien Mazarguil , Yongseok Koh Date: Wed, 27 Jun 2018 17:07:35 +0200 Message-Id: <3c8d9a28a2627c3bde7eaa1a059704c9cca50f1e.1530111623.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 03/20] 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: , X-List-Received-Date: Wed, 27 Jun 2018 15:07:37 -0000 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 --- drivers/net/mlx5/mlx5.c | 15 ++++----------- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index aba6c1f9f..c3c8dffae 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -703,7 +703,6 @@ mlx5_dev_spawn_one(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; @@ -1100,16 +1099,10 @@ mlx5_dev_spawn_one(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_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 11aa0932f..ed8c1c9a2 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -114,7 +114,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. */ @@ -309,7 +309,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_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 8b5b695d4..5d3bc183d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -82,11 +82,11 @@ struct ibv_spec_header { * 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_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, drop); DRV_LOG(INFO, "port %u flow maximum priority: %d", - dev->data->port_id, verb_priorities); - return verb_priorities; + dev->data->port_id, vprio[i]); + return vprio[i]; } /** @@ -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[] = { { -- 2.18.0