From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id F2FAD4CC3 for ; Fri, 31 Aug 2018 11:01:28 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id j192-v6so4604372wmj.1 for ; Fri, 31 Aug 2018 02:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WL1ZCGXmmmOi1dEv8prvXA3nQwRxNiW26HZHh7kqZKI=; b=xnnDmbQYhDMRv8SZiZhrdSnACRRucdjp6eJF389xwQF1CuVOwmw9uL9i5cgbQyvLy2 4x5+5+zxfCTPsEhHEHwclcd2kNlNDEsYg4SZQsYEMlfID49x+yCHABcr+naJqZc6pE5n LJ8iQzDTAlfzvo+F8SYvb5pUjc3piKyDsvQTnMeSSXQARZ3Izd4AigDnRPV6ypV94/Jy tyIQpwDp9mRxeDJYJ2eODuFalKdAcZ8ybj4Otkui9nIQvLikeccqvX3Oc3BkqN4nw4U4 97Uax1E1QuIwBer7V+QTuz+DDePWvPHqa6eqLYM47d76EWGcbCFuXhkaFsSdh0xqsOSE XkmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WL1ZCGXmmmOi1dEv8prvXA3nQwRxNiW26HZHh7kqZKI=; b=r198qaVg2ox8/qWbzrUVu4KQurNEH3i2Qyi8BoosY3XHQTbrHTEw6Ye6Hvf+XtxA0p eEeRD0OChBqIVLTgY+cZqsVedV1tjTRwxDz1G6XSlU7CdCgSIoIdFiIHB7obv1Y71KuH ccfEf3NxqvcEkmC8MHECODF96HHb6FErYpoWgbmGutwG2YI7m81Ohsv/MeM748X8iLCB Z00XhZ+gWuQ9xBmCOHFi36JFHYiQ7ppRKKwAKLeR+YFjbyOix//gTmXItz1QlweUq6zk hhkkL/I2wbXyf2N+28GVYdirrQSTQvDCDbD/VBtcY2pF1Kf5ZuNwzeQpG0pXmYBsOY9d EK4g== X-Gm-Message-State: APzg51AzmfGLbP3FsBz4MIGThT23r+3Eo0rUXUfZOYqhq86B4umbMGH3 jtuO4GjXyyhXsdBZ//h0sor6zA== X-Google-Smtp-Source: ANB0VdbZX+Z8q6LAtTHwX6ljAU78kKotvwhEYakPXlxl/qGCD+xJhb7f9Q3PwyuK8eu05381N5dJhg== X-Received: by 2002:a1c:3e8f:: with SMTP id l137-v6mr3951783wma.132.1535706085720; Fri, 31 Aug 2018 02:01:25 -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 e5-v6sm3021656wmh.29.2018.08.31.02.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 02:01:24 -0700 (PDT) Date: Fri, 31 Aug 2018 11:01:09 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: dev@dpdk.org, Declan Doherty , Chas Williams Message-ID: <20180831085337.21419-6-adrien.mazarguil@6wind.com> References: <20180803132032.29038-1-adrien.mazarguil@6wind.com> <20180831085337.21419-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180831085337.21419-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v3 5/7] net/bonding: switch to flow API object conversion function 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: Fri, 31 Aug 2018 09:01:29 -0000 This patch replaces rte_flow_copy() with rte_flow_conv(). Signed-off-by: Adrien Mazarguil Cc: Declan Doherty Cc: Chas Williams -- v3 changes: - Added build directives to allow experimental APIs, now needed for rte_flow_conv(). v2 changes: - Patch was not present in original series. --- drivers/net/bonding/Makefile | 1 + drivers/net/bonding/meson.build | 1 + drivers/net/bonding/rte_eth_bond_api.c | 6 ++--- drivers/net/bonding/rte_eth_bond_flow.c | 31 +++++++++++++++++++------ drivers/net/bonding/rte_eth_bond_private.h | 5 +++- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile index acad16a1a..1893e3cad 100644 --- a/drivers/net/bonding/Makefile +++ b/drivers/net/bonding/Makefile @@ -8,6 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_bond.a +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring diff --git a/drivers/net/bonding/meson.build b/drivers/net/bonding/meson.build index 602d28803..00374edb2 100644 --- a/drivers/net/bonding/meson.build +++ b/drivers/net/bonding/meson.build @@ -3,6 +3,7 @@ name = 'bond' #, james bond :-) version = 2 +allow_experimental_apis = true sources = files('rte_eth_bond_api.c', 'rte_eth_bond_pmd.c', 'rte_eth_bond_flow.c', 'rte_eth_bond_args.c', 'rte_eth_bond_8023ad.c', 'rte_eth_bond_alb.c') diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 8bc04cfd1..a438fc509 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -245,9 +245,9 @@ slave_rte_flow_prepare(uint16_t slave_id, struct bond_dev_private *internals) } TAILQ_FOREACH(flow, &internals->flow_list, next) { flow->flows[slave_id] = rte_flow_create(slave_port_id, - &flow->fd->attr, - flow->fd->items, - flow->fd->actions, + flow->rule.attr, + flow->rule.pattern, + flow->rule.actions, &ferror); if (flow->flows[slave_id] == NULL) { RTE_BOND_LOG(ERR, "Cannot create flow for slave" diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 31e4bcaeb..f94d46ca4 100644 --- a/drivers/net/bonding/rte_eth_bond_flow.c +++ b/drivers/net/bonding/rte_eth_bond_flow.c @@ -2,8 +2,11 @@ * Copyright 2018 Mellanox Technologies, Ltd */ +#include +#include #include +#include #include #include #include @@ -16,19 +19,33 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr, const struct rte_flow_action *actions) { struct rte_flow *flow; - size_t fdsz; + const struct rte_flow_conv_rule rule = { + .attr_ro = attr, + .pattern_ro = items, + .actions_ro = actions, + }; + struct rte_flow_error error; + int ret; - fdsz = rte_flow_copy(NULL, 0, attr, items, actions); - flow = rte_zmalloc_socket(NULL, sizeof(struct rte_flow) + fdsz, + ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, NULL, 0, &rule, &error); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s", + error.message ? error.message : "unspecified", + strerror(rte_errno)); + return NULL; + } + flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret, RTE_CACHE_LINE_SIZE, numa_node); if (unlikely(flow == NULL)) { RTE_BOND_LOG(ERR, "Could not allocate new flow"); return NULL; } - flow->fd = (void *)((uintptr_t)flow + sizeof(*flow)); - if (unlikely(rte_flow_copy(flow->fd, fdsz, attr, items, actions) != - fdsz)) { - RTE_BOND_LOG(ERR, "Failed to copy flow description"); + ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, &flow->rule, ret, &rule, + &error); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s", + error.message ? error.message : "unspecified", + strerror(rte_errno)); rte_free(flow); return NULL; } diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 43e0e448d..61202845e 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -5,9 +5,11 @@ #ifndef _RTE_ETH_BOND_PRIVATE_H_ #define _RTE_ETH_BOND_PRIVATE_H_ +#include #include #include +#include #include #include #include @@ -93,7 +95,8 @@ struct rte_flow { /* Slaves flows */ struct rte_flow *flows[RTE_MAX_ETHPORTS]; /* Flow description for synchronization */ - struct rte_flow_desc *fd; + struct rte_flow_conv_rule rule; + uint8_t rule_data[]; }; typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, -- 2.11.0