From patchwork Thu Jun 15 11:02:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 25348 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2A2502BC3; Thu, 15 Jun 2017 13:02:53 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 0BB232BBB for ; Thu, 15 Jun 2017 13:02:51 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B38DA20800; Thu, 15 Jun 2017 07:02:49 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 15 Jun 2017 07:02:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Uqzc8GzXXgq8CXUINIWBQC0khup 352vgMCeZEKv77aA=; b=LcPFGvdW7K0Dhx0NOh3FMqdHKUtcXRlhRsa1IVpkTGy el863uEcpYQdDqgIofwoKcz4uKPR6mtelVA7C2AFdy8NSPKBpfhrh9zu7LLyKH4D N+aZ9Y0x01W4pcip7JncH4VufXSZLR6rdc1F9TtX5Aqcovj/VvOA16vrFHSkHmWU = DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=Uqzc8G zXXgq8CXUINIWBQC0khup352vgMCeZEKv77aA=; b=lj5TiwJweO2ix3AJF9dssa /Emaj2Kt81TtMBq/K128KOt3yxEiVLXj60D333ONIRvrLafKPndwpAAxbxNtvwwh ngnErCgDqKFAOvqFMinhUXYo7DP2QzswW7W33htwAGOrktPrqilYWCdGb2CEMOyS hRRSQG/EJleO7vQAQNKUwu/uIPnYV6h6fJ4FpKd6NsasIZ2fEY7pnmtMaHnqU89t +QT+lPpuog3U/xxY/9Xj6W+3/pmxzd8nM15BOnd6qXZDu/+UAgKImT6D0bjQzIMK xhzkfeyqmkuN32K5CFSxbkGxZGl9sfPgsADTQdV5VvQnG2cM+WfLrFrp3kL96Ukw == X-ME-Sender: X-Sasl-enc: y81XfeA5C2DbyXOe1luGJds34PtiE1MPcksinnrIexdV 1497524569 Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 1479E2475C; Thu, 15 Jun 2017 07:02:48 -0400 (EDT) From: Thomas Monjalon To: jingjing.wu@intel.com Cc: wenzhuo.lu@intel.com, dev@dpdk.org Date: Thu, 15 Jun 2017 13:02:21 +0200 Message-Id: <20170615110221.1395-1-thomas@monjalon.net> X-Mailer: git-send-email 2.13.1 Subject: [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions 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" These functions are supported only on ixgbe. However, they should appear in the help and returns an error if the function is not supported or not enabled. Signed-off-by: Thomas Monjalon Acked-by: Jingjing Wu --- app/test-pmd/cmdline.c | 54 ++++++++++++++++++++++++++++++++++---------------- app/test-pmd/config.c | 20 ++++++++++++------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 105c71f39..ff8ffd2a6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -281,18 +281,15 @@ static void cmd_help_long_parsed(void *parsed_result, "set tx loopback (port_id) (on|off)\n" " Enable or disable tx loopback.\n\n" -#ifdef RTE_LIBRTE_IXGBE_PMD "set all queues drop (port_id) (on|off)\n" " Set drop enable bit for all queues.\n\n" "set vf split drop (port_id) (vf_id) (on|off)\n" " Set split drop enable bit for a VF from the PF.\n\n" -#endif "set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" -#ifdef RTE_LIBRTE_IXGBE_PMD "set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n" " Enable MACsec offload.\n\n" @@ -304,7 +301,6 @@ static void cmd_help_long_parsed(void *parsed_result, "set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)\n" " Configure MACsec secure association (SA).\n\n" -#endif "set vf broadcast (port_id) (vf_id) (on|off)\n" " Set VF broadcast for a VF from the PF.\n\n" @@ -6742,7 +6738,6 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = { }, }; -#ifdef RTE_LIBRTE_IXGBE_PMD /* *** CONFIGURE VF TRAFFIC CONTROL *** */ struct cmd_set_vf_traffic { cmdline_fixed_string_t set; @@ -6803,7 +6798,6 @@ cmdline_parse_inst_t cmd_set_vf_traffic = { NULL, }, }; -#endif /* RTE_LIBRTE_IXGBE_PMD */ /* *** CONFIGURE VF RECEIVE MODE *** */ struct cmd_set_vf_rxmode { @@ -11583,7 +11577,6 @@ cmdline_parse_inst_t cmd_set_all_queues_drop_en = { }, }; -#ifdef RTE_LIBRTE_IXGBE_PMD /* vf split drop enable configuration */ /* Common result structure for vf split drop enable */ @@ -11634,14 +11627,16 @@ cmd_set_vf_split_drop_en_parsed( __attribute__((unused)) void *data) { struct cmd_vf_split_drop_en_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; +#ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_set_vf_split_drop_en(res->port_id, res->vf_id, is_on); +#endif switch (ret) { case 0: break; @@ -11651,6 +11646,9 @@ cmd_set_vf_split_drop_en_parsed( case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("not supported on port %d\n", res->port_id); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -11671,7 +11669,6 @@ cmdline_parse_inst_t cmd_set_vf_split_drop_en = { NULL, }, }; -#endif /* vf mac address configuration */ @@ -11777,7 +11774,6 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = { }, }; -#ifdef RTE_LIBRTE_IXGBE_PMD /* MACsec configuration */ /* Common result structure for MACsec offload enable */ @@ -11838,7 +11834,7 @@ cmd_set_macsec_offload_on_parsed( __attribute__((unused)) void *data) { struct cmd_macsec_offload_on_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; @@ -11847,7 +11843,11 @@ cmd_set_macsec_offload_on_parsed( return; ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; +#ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); +#endif + RTE_SET_USED(en); + RTE_SET_USED(rp); switch (ret) { case 0: @@ -11855,6 +11855,9 @@ cmd_set_macsec_offload_on_parsed( case -ENODEV: printf("invalid port_id %d\n", port_id); break; + case -ENOTSUP: + printf("not supported on port %d\n", port_id); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -11917,14 +11920,16 @@ cmd_set_macsec_offload_off_parsed( __attribute__((unused)) void *data) { struct cmd_macsec_offload_off_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; +#ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); +#endif switch (ret) { case 0: @@ -11932,6 +11937,9 @@ cmd_set_macsec_offload_off_parsed( case -ENODEV: printf("invalid port_id %d\n", port_id); break; + case -ENOTSUP: + printf("not supported on port %d\n", port_id); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -11999,20 +12007,27 @@ cmd_set_macsec_sc_parsed( __attribute__((unused)) void *data) { struct cmd_macsec_sc_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0; +#ifdef RTE_LIBRTE_IXGBE_PMD ret = is_tx ? rte_pmd_ixgbe_macsec_config_txsc(res->port_id, res->mac.addr_bytes) : rte_pmd_ixgbe_macsec_config_rxsc(res->port_id, res->mac.addr_bytes, res->pi); +#endif + RTE_SET_USED(is_tx); + switch (ret) { case 0: break; case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("not supported on port %d\n", res->port_id); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -12092,7 +12107,7 @@ cmd_set_macsec_sa_parsed( __attribute__((unused)) void *data) { struct cmd_macsec_sa_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0; uint8_t key[16] = { 0 }; uint8_t xdgt0; @@ -12114,11 +12129,16 @@ cmd_set_macsec_sa_parsed( key[i] = (uint8_t) ((xdgt0 * 16) + xdgt1); } +#ifdef RTE_LIBRTE_IXGBE_PMD ret = is_tx ? rte_pmd_ixgbe_macsec_select_txsa(res->port_id, res->idx, res->an, res->pn, key) : rte_pmd_ixgbe_macsec_select_rxsa(res->port_id, res->idx, res->an, res->pn, key); +#endif + RTE_SET_USED(is_tx); + RTE_SET_USED(key); + switch (ret) { case 0: break; @@ -12128,6 +12148,9 @@ cmd_set_macsec_sa_parsed( case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("not supported on port %d\n", res->port_id); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -12150,7 +12173,6 @@ cmdline_parse_inst_t cmd_set_macsec_sa = { NULL, }, }; -#endif /* VF unicast promiscuous mode configuration */ @@ -13805,7 +13827,6 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert, (cmdline_parse_inst_t *)&cmd_set_tx_loopback, -#ifdef RTE_LIBRTE_IXGBE_PMD (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_macsec_offload_on, @@ -13813,7 +13834,6 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_macsec_sc, (cmdline_parse_inst_t *)&cmd_set_macsec_sa, (cmdline_parse_inst_t *)&cmd_set_vf_traffic, -#endif (cmdline_parse_inst_t *)&cmd_set_vf_rxmode, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 3cd4f3199..8a604f340 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3000,10 +3000,10 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg) } -#ifdef RTE_LIBRTE_IXGBE_PMD void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) { +#ifdef RTE_LIBRTE_IXGBE_PMD int diag; if (is_rx) @@ -3013,15 +3013,21 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) if (diag == 0) return; - if(is_rx) + if(is_rx) { printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " - "diag=%d\n", port_id, diag); - else + "diag=%d\n", port_id, diag); + return; + } else { printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " - "diag=%d\n", port_id, diag); - -} + "diag=%d\n", port_id, diag); + return; + } #endif + printf("VF %s setting not supported for port %d\n", + is_rx ? "Rx" : "Tx", port_id); + RTE_SET_USED(vf); + RTE_SET_USED(on); +} int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)