From patchwork Sun Jan 26 01:09:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 65126 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAC54A0530; Sun, 26 Jan 2020 02:09:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6DA4568A; Sun, 26 Jan 2020 02:09:24 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 74BE649E0 for ; Sun, 26 Jan 2020 02:09:21 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id r11so3247268pgf.1 for ; Sat, 25 Jan 2020 17:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZjzQfkqnxcUOuvLr8Gayao+KffoLw+6HiHTiNfbitYc=; b=PmnuEZuarnpSZsCDgjuJhT0d1rMr9seMAn6o4gXG2JgQLu6LinKxTRrWwtFsPi+2Or 2hJGPuNHGmk/GaA5OVF9/F2IJxcr5Cz6XTb8FozRAo6yWwa7dMIy3mi8QpDlwclvh332 Wp5a8tuguGp/2U+0TBlSUSx14yMojzH7uhbjvvGfZwMfv6kCxbsbWqHz7JBBw/c7rFf+ IZagEb6gq7h05k+U6mafiW1ae8dwa8toGetcLOJkI/pSn0sKXkZ8M6fjzLt9hfwlmatc BTq/n0kB/A3GM3b3riPvECipbg8lx3q9JAjUUFJ7SFLdG9fYFs9tYDnEAtUPuujJ5zBz DcZg== 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:mime-version:content-transfer-encoding; bh=ZjzQfkqnxcUOuvLr8Gayao+KffoLw+6HiHTiNfbitYc=; b=ftH3+nT23++GjeXopgth/LuoxLWSMb826rGUywJCMJcHtWEpU/WxW7uo7Bl8W0WARO E90fp9+JBVXpS2JNY9nnO3XrCSw8ZvWIOJVaAdWxpdIQ7+RyhV5bUB6toflN16gwRmT9 l9NZzMmLCxHUEpPdIe1P3qAsOJLSuOwtTi6RkKHNYycDfBXxMrBurIrPW5/S1k4Bdgs2 O4YiJTCFsUfraIyMgeTFgJUpCmWYXQgWlsAuXhJVHH0Mlg8i0mzj42VL++Gc7oTNDqLU Rvdh1mvM0SFEHx9GMG8TcrJxcfjDndFy7pKfizKh0HqdODRnl0f8nmpsjMBVIqsX5XFs oTbw== X-Gm-Message-State: APjAAAUEMiFx4kqaRbWqKldJRQlfMcx53HUQG8LHNgv3e3QjYHT99ybK w3rS+MfErHeMsOn+G4u/Ry6QfXltHVs= X-Google-Smtp-Source: APXvYqwue4PiErsZPVndsySjyTIygXYFK4q8AZ8Fy2ZHDC4MYnfMNqTKxwwENX6dJ3KI6E9Rk8IZEw== X-Received: by 2002:a62:830b:: with SMTP id h11mr276827pfe.40.1580000960242; Sat, 25 Jan 2020 17:09:20 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t1sm11560267pgq.23.2020.01.25.17.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2020 17:09:19 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Sat, 25 Jan 2020 17:09:07 -0800 Message-Id: <20200126010911.3733-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200126010911.3733-1-stephen@networkplumber.org> References: <20200126010911.3733-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/5] lpm: make ipv6 address immutable 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" Both the table setup and lookup do no modify their arguments. Therefore the parameter should be constant. This is not actually an API breakage since programs can be recompiled without change. This is not an ABI breakage because old programs will still run. Signed-off-by: Stephen Hemminger --- lib/librte_lpm/rte_lpm6.c | 8 ++++---- lib/librte_lpm/rte_lpm6.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index c46e557e2389..5ea818abd6e9 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -854,8 +854,8 @@ simulate_add(struct rte_lpm6 *lpm, const uint8_t *masked_ip, uint8_t depth) * Add a route */ int -rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, - uint32_t next_hop) +rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth, + uint32_t next_hop) { struct rte_lpm6_tbl_entry *tbl; struct rte_lpm6_tbl_entry *tbl_next = NULL; @@ -913,7 +913,7 @@ rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, */ static inline int lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl, - const struct rte_lpm6_tbl_entry **tbl_next, uint8_t *ip, + const struct rte_lpm6_tbl_entry **tbl_next, const uint8_t *ip, uint8_t first_byte, uint32_t *next_hop) { uint32_t tbl8_index, tbl_entry; @@ -943,7 +943,7 @@ lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl, * Looks up an IP */ int -rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, +rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, uint32_t *next_hop) { const struct rte_lpm6_tbl_entry *tbl; diff --git a/lib/librte_lpm/rte_lpm6.h b/lib/librte_lpm/rte_lpm6.h index 37dfb20249a8..042991f8cdb7 100644 --- a/lib/librte_lpm/rte_lpm6.h +++ b/lib/librte_lpm/rte_lpm6.h @@ -94,8 +94,8 @@ rte_lpm6_free(struct rte_lpm6 *lpm); * 0 on success, negative value otherwise */ int -rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, - uint32_t next_hop); +rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth, + uint32_t next_hop); /** * Check if a rule is present in the LPM table, @@ -171,7 +171,7 @@ rte_lpm6_delete_all(struct rte_lpm6 *lpm); * -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit */ int -rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, uint32_t *next_hop); +rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, uint32_t *next_hop); /** * Lookup multiple IP addresses in an LPM table.