From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 1CF211B595 for ; Fri, 3 Aug 2018 15:36:59 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id f12-v6so5425254wrv.12 for ; Fri, 03 Aug 2018 06:36:59 -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=rZTlv8/S5UVprjogu8YheU4Mt0j+9W4zrSgtK/ZgQJ4=; b=VdfTzKWqOvegdzjA8Plouc89c6WLqC8jzMyh/7aZyQND4EestRR7nPkKaAQ/5uhT85 393tnox7baKhTOQbOpQVYk6z5vEhvWWPsF3m0ADu8prSvG3mMqQ2TvUXt4UONz3GOOYu mfFkU/Lp4VLU9AdWM4GBoKvKNiO3/fJ0oHr8PxfdScTKRPEYlublowKRXvFebO5qr8Rz AjnbHBnhXL9gbfd7QBPcDB1sjQQ0piZJkArUloIiOZ1c7YMf9Dy1vNPLXVmgcK5dNZSb wSn0kM12s9vF2q9kmQpjRTXBnO0uvtL7CSLv7bOydAgGTjuK2pRbM0Bn4rvdpxzFrmBC d0AA== 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=rZTlv8/S5UVprjogu8YheU4Mt0j+9W4zrSgtK/ZgQJ4=; b=FZO/dde0ewOW+oAvgAzWk+5LCrSPbL6mxScEHaMIZOkl3Gt/AyCejhby9smbSa4gn2 qiBzVh9S/CdiRcnSRNtRsUlyyL7G3nMAwKAjZYE2Py/3bVOM2y0hOTcczYoiJ65wn2qT 9ETGFjfi37b1Aqr4mS7476ulDoxhcdCO58pZDVGSdAZaZZFix+d9HUGM01Ju8x7IXCJs c+Gprbk/4CuCgfHrxCCURIYvQt5LGQLLznF6G/qDaIZ2RXM9Vvbj6BDH5dg1rUdeuniM 8pdRvePot7ZAgaqMtfN9yc2hkjtRNsdOpy35KmOAjQ2/qzl83TLcNQXL9mX8GwKwfRBJ SVjQ== X-Gm-Message-State: AOUpUlH7i1wnxLSp4O4xYGGo6Khfm9rTRkg35on3BPVi4oCnrXRAKlhD aGVgVpi7peb2/BedJSFFL4Vzc+6DkRk36A== X-Google-Smtp-Source: AAOMgpfiBt6hYcuiT6hhovL7bxuEdNkL0OLEV+6GqllNcvKulR/9zrOLm1HwvyDT5xW4tIDkQnGYHA== X-Received: by 2002:adf:b202:: with SMTP id u2-v6mr2607273wra.19.1533303418845; Fri, 03 Aug 2018 06:36:58 -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 i1-v6sm3603956wrq.69.2018.08.03.06.36.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 06:36:58 -0700 (PDT) Date: Fri, 3 Aug 2018 15:36:41 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: dev@dpdk.org, Declan Doherty , Chas Williams Message-ID: <20180803132032.29038-6-adrien.mazarguil@6wind.com> References: <20180803132032.29038-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180803132032.29038-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v2 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, 03 Aug 2018 13:36:59 -0000 This patch replaces rte_flow_copy() with rte_flow_conv(). Signed-off-by: Adrien Mazarguil Cc: Declan Doherty Cc: Chas Williams -- v2 changes: - Patch was not present in original series. --- 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 +++- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 49fa2d78d..045c907cf 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