From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 747A8C656 for ; Fri, 29 Jan 2016 11:32:36 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id 128so46812235wmz.1 for ; Fri, 29 Jan 2016 02:32:36 -0800 (PST) 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=0DYnwKoM3uKJ+NWh0bLvsG/tQs0Mts/WI09Xx1QsvG0=; b=V14wP9HxZjCFigILwAn0Ezj2yyWZ7rtOEW4ZyF2u8djLttguiqb3OAo/8WC52onD6a 5vqkX2mfzmjVf/2TpkW6J2uVwPDuw2GhDsjcj8d2g69N3cb5j1tXmRPhM6SPxqN4m12o 3CuOQJuqgc7KZci1uFqa1wtXHAsxWetQeRiLjsxE2+mli3fNH7pE35yZhGLIgO5uOrmL Tb/K6uhAzgRyo7NcrZtU5Nll3y+H6a8j2NP4O8QLnPEfbZbydQYC1RWaHoIUbxxUi1vB VrnD2YWy1Z4tAK7ERaQfD4QqpRsiuCeV8VIDgVNdgnToOsNPzrYPiRryc42G+QpKauPS M9bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0DYnwKoM3uKJ+NWh0bLvsG/tQs0Mts/WI09Xx1QsvG0=; b=DvcbmI3Pjx3OfF8q4QSQ4tu1ID9Jh9UMHdSJdTN5bAb5KURJdgbwYf+5Fbn6ikmYmY vM6YlQLjKcfh4rNxmX32RxdJVlU2vataCEQGMhvFVG1qTWcLvzMwx5jE8pOyl9+6qFpL E5helCP1vnKkBgHL2E/aqSi+HmQWCGsmGAPGvVb3lPKZzOHLwcWu2Kt8wqfco2vfpxDW 3L4MI0VKYLpN5kh6Q4IqxCii6ZOQ6VZJBjyu30NCL/zogWLqhmDKmY6d15XmD6xgR8ii JXDw2RW3GnFjRGN4xJecNGQW/P3udkg+SUU/R86mapZM8jg3qIwkRWShz8t4xNlq9604 5Fqw== X-Gm-Message-State: AG10YOTcE8TMS4fVb1CZVTvcqUUMDcir8awnb3btG6ZJNMBsi+NPeKFowF8FS+OQXByUIhvb X-Received: by 10.194.22.167 with SMTP id e7mr9328738wjf.29.1454063556301; Fri, 29 Jan 2016 02:32:36 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id e198sm6892186wmd.0.2016.01.29.02.32.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Jan 2016 02:32:35 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 29 Jan 2016 11:32:00 +0100 Message-Id: <1454063522-1948-4-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454063522-1948-1-git-send-email-adrien.mazarguil@6wind.com> References: <1454063522-1948-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 3/5] mlx5: make flow steering rule generator more generic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2016 10:32:36 -0000 From: Yaacov Hazan Upcoming flow director support will reuse this function to generate filter rules. Signed-off-by: Yaacov Hazan Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_mac.c | 4 ++-- drivers/net/mlx5/mlx5_rxmode.c | 5 +++-- drivers/net/mlx5/mlx5_rxq.c | 16 ++++++++-------- drivers/net/mlx5/mlx5_rxtx.h | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 1a0b974..f952afc 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -241,7 +241,7 @@ hash_rxq_add_mac_flow(struct hash_rxq *hash_rxq, unsigned int mac_index, const uint8_t (*mac)[ETHER_ADDR_LEN] = (const uint8_t (*)[ETHER_ADDR_LEN]) priv->mac[mac_index].addr_bytes; - FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0)); + FLOW_ATTR_SPEC_ETH(data, priv_flow_attr(priv, NULL, 0, hash_rxq->type)); struct ibv_exp_flow_attr *attr = &data->attr; struct ibv_exp_flow_spec_eth *spec = &data->spec; unsigned int vlan_enabled = !!priv->vlan_filter_n; @@ -256,7 +256,7 @@ hash_rxq_add_mac_flow(struct hash_rxq *hash_rxq, unsigned int mac_index, * This layout is expected by libibverbs. */ assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec); - hash_rxq_flow_attr(hash_rxq, attr, sizeof(data)); + priv_flow_attr(priv, attr, sizeof(data), hash_rxq->type); /* The first specification must be Ethernet. */ assert(spec->type == IBV_EXP_FLOW_SPEC_ETH); assert(spec->size == sizeof(*spec)); diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 6ee7ce3..9ac7a41 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -129,8 +129,9 @@ static int hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq, enum hash_rxq_flow_type flow_type) { + struct priv *priv = hash_rxq->priv; struct ibv_exp_flow *flow; - FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0)); + FLOW_ATTR_SPEC_ETH(data, priv_flow_attr(priv, NULL, 0, hash_rxq->type)); struct ibv_exp_flow_attr *attr = &data->attr; struct ibv_exp_flow_spec_eth *spec = &data->spec; const uint8_t *mac; @@ -148,7 +149,7 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq, * This layout is expected by libibverbs. */ assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec); - hash_rxq_flow_attr(hash_rxq, attr, sizeof(data)); + priv_flow_attr(priv, attr, sizeof(data), hash_rxq->type); /* The first specification must be Ethernet. */ assert(spec->type == IBV_EXP_FLOW_SPEC_ETH); assert(spec->size == sizeof(*spec)); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 27e3bcc..641ee07 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -210,27 +210,27 @@ const size_t rss_hash_default_key_len = sizeof(rss_hash_default_key); * information from hash_rxq_init[]. Nothing is written to flow_attr when * flow_attr_size is not large enough, but the required size is still returned. * - * @param[in] hash_rxq - * Pointer to hash RX queue. + * @param priv + * Pointer to private structure. * @param[out] flow_attr * Pointer to flow attribute structure to fill. Note that the allocated * area must be larger and large enough to hold all flow specifications. * @param flow_attr_size * Entire size of flow_attr and trailing room for flow specifications. + * @param type + * Hash RX queue type to use for flow steering rule. * * @return * Total size of the flow attribute buffer. No errors are defined. */ size_t -hash_rxq_flow_attr(const struct hash_rxq *hash_rxq, - struct ibv_exp_flow_attr *flow_attr, - size_t flow_attr_size) +priv_flow_attr(struct priv *priv, struct ibv_exp_flow_attr *flow_attr, + size_t flow_attr_size, enum hash_rxq_type type) { size_t offset = sizeof(*flow_attr); - enum hash_rxq_type type = hash_rxq->type; const struct hash_rxq_init *init = &hash_rxq_init[type]; - assert(hash_rxq->priv != NULL); + assert(priv != NULL); assert((size_t)type < RTE_DIM(hash_rxq_init)); do { offset += init->flow_spec.hdr.size; @@ -244,7 +244,7 @@ hash_rxq_flow_attr(const struct hash_rxq *hash_rxq, .type = IBV_EXP_FLOW_ATTR_NORMAL, .priority = init->flow_priority, .num_of_specs = 0, - .port = hash_rxq->priv->port, + .port = priv->port, .flags = 0, }; do { diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index d5a5019..c42bb8d 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -270,8 +270,8 @@ extern const unsigned int hash_rxq_init_n; extern uint8_t rss_hash_default_key[]; extern const size_t rss_hash_default_key_len; -size_t hash_rxq_flow_attr(const struct hash_rxq *, struct ibv_exp_flow_attr *, - size_t); +size_t priv_flow_attr(struct priv *, struct ibv_exp_flow_attr *, + size_t, enum hash_rxq_type); int priv_create_hash_rxqs(struct priv *); void priv_destroy_hash_rxqs(struct priv *); int priv_allow_flow_type(struct priv *, enum hash_rxq_flow_type); -- 2.1.4