From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by dpdk.org (Postfix) with ESMTP id 531C4B62 for ; Thu, 9 Apr 2015 23:29:42 +0200 (CEST) Received: by pddn5 with SMTP id n5so182786pdd.2 for ; Thu, 09 Apr 2015 14:29:41 -0700 (PDT) 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=lxmaEDo30IjImc/Y0ajQPxqzSCVL1uvbKvOcO1RXPeg=; b=d6G5uMrGXXcHaJy6FGgsn9ALrIivDSH6Riq1V8JEnV09L3ly7oCF1QB6UJh1PzgmMw EB9EDkLlAHsESJR04jxoKk8PY9tnm/0zxjuI4fOQGj8H792cACxz5BZ8LPXlgfWMtGyT +cfGCMJoECL5jhicPs4YwZjF33PKTGhqRlFQJnYL3q+4l/STdI6RCbNf1V5fqugHHJAr Gobl7Y2q+t02RReY41QAhkbwbu6xT8RaurgFyT9XC0alNPjsVo6W7Y3ayFs2uVm7bbAg ZY33Wm8LOdieEp4Fn817nnzSnpEyOx12JTA/7yCiTVIBwHIHndGSBYYSk7l0q0I9Ndre +gBQ== X-Gm-Message-State: ALoCoQmA7eeC38rZVyPh1v4bjs27MMGSAUVJanE9qyAp5Trd+0N8QjrJ+UMfcRzLWHh0D+VwgW2d X-Received: by 10.66.180.15 with SMTP id dk15mr15667915pac.130.1428614981776; Thu, 09 Apr 2015 14:29:41 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id hz13sm15702717pab.6.2015.04.09.14.29.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Apr 2015 14:29:41 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 9 Apr 2015 14:29:41 -0700 Message-Id: <1428614982-14135-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1428614982-14135-1-git-send-email-stephen@networkplumber.org> References: <1428614982-14135-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 3/4] rte_ethdev: make tables const 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: Thu, 09 Apr 2015 21:29:42 -0000 The statistics tables and null mac address should be immutable. Fix up get_addr routines to accept const args. Signed-off-by: Stephen Hemminger --- lib/librte_ether/rte_ethdev.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 56e22ea..416e778 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -119,34 +119,34 @@ struct rte_eth_xstats_name_off { unsigned offset; }; -static struct rte_eth_xstats_name_off rte_stats_strings[] = { - {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, - {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, - {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, - {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, - {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, - {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, - {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, - {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, - {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, - {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, - {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, - {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, - {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, - {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, - {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, - {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, +static const struct rte_eth_xstats_name_off rte_stats_strings[] = { + {"rx_packets", offsetof(struct rte_eth_stats, ipackets)}, + {"tx_packets", offsetof(struct rte_eth_stats, opackets)}, + {"rx_bytes", offsetof(struct rte_eth_stats, ibytes)}, + {"tx_bytes", offsetof(struct rte_eth_stats, obytes)}, + {"tx_errors", offsetof(struct rte_eth_stats, oerrors)}, + {"rx_missed_errors", offsetof(struct rte_eth_stats, imissed)}, + {"rx_crc_errors", offsetof(struct rte_eth_stats, ibadcrc)}, + {"rx_bad_length_errors", offsetof(struct rte_eth_stats, ibadlen)}, + {"rx_errors", offsetof(struct rte_eth_stats, ierrors)}, + {"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)}, + {"fdir_match", offsetof(struct rte_eth_stats, fdirmatch)}, + {"fdir_miss", offsetof(struct rte_eth_stats, fdirmiss)}, + {"tx_flow_control_xon", offsetof(struct rte_eth_stats, tx_pause_xon)}, + {"rx_flow_control_xon", offsetof(struct rte_eth_stats, rx_pause_xon)}, + {"tx_flow_control_xoff", offsetof(struct rte_eth_stats, tx_pause_xoff)}, + {"rx_flow_control_xoff", offsetof(struct rte_eth_stats, rx_pause_xoff)}, }; #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strings[0])) -static struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { +static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = { {"rx_packets", offsetof(struct rte_eth_stats, q_ipackets)}, {"rx_bytes", offsetof(struct rte_eth_stats, q_ibytes)}, }; #define RTE_NB_RXQ_STATS (sizeof(rte_rxq_stats_strings) / \ sizeof(rte_rxq_stats_strings[0])) -static struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { +static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = { {"tx_packets", offsetof(struct rte_eth_stats, q_opackets)}, {"tx_bytes", offsetof(struct rte_eth_stats, q_obytes)}, {"tx_errors", offsetof(struct rte_eth_stats, q_errors)}, @@ -2651,7 +2651,7 @@ rte_eth_led_off(uint8_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) +get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -2666,7 +2666,7 @@ get_mac_addr_index(uint8_t port_id, struct ether_addr *addr) return -1; } -static struct ether_addr null_mac_addr = {{0, 0, 0, 0, 0, 0}}; +static const struct ether_addr null_mac_addr; int rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr, @@ -2792,7 +2792,7 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, * an empty spot. */ static int -get_hash_mac_addr_index(uint8_t port_id, struct ether_addr *addr) +get_hash_mac_addr_index(uint8_t port_id, const struct ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; -- 2.1.4