From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1D5142DC6; Tue, 4 Jul 2023 00:19:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79A26410F2; Tue, 4 Jul 2023 00:19:48 +0200 (CEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id 1813340E03 for ; Tue, 4 Jul 2023 00:19:47 +0200 (CEST) Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-51452556acdso2818002a12.2 for ; Mon, 03 Jul 2023 15:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688422786; x=1691014786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=z4mUKYY1ysv8xRDN4AqdJ+iZBoti0n5LtT4mt2FLdqg=; b=KyxUwfKEfdcovz5dJayqdVP3sPw9BCRRlJde8Uohv20Pa07SwneeivpS2NKDHXVBZZ pndLLMuPIZG2yfzvX4onoJiyWkePQInZSOpuxRuQXQyk2/93jZ5LXjgUJ3+DBm/ZkPkP AhJJF4LXB5x70yRvaCse3ZGPrcI6G25lnyZaRfS80txXRzt09BBeB63jpy9IWrH8rIuB uMiVDMfaAyUEcguwWqrRiOkaElIdQD2hxX46SnvLvP2Lma+JeZVSmdsLn7x/IS+dI5Xk IoN3B0k2NIUkVv8/I+3uG2jxp+d8knUb2dHpWPID+efGntONfBZE1/xM831wEbhxmDNy LlAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688422786; x=1691014786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z4mUKYY1ysv8xRDN4AqdJ+iZBoti0n5LtT4mt2FLdqg=; b=IsDhfd9y+GJB3sq20uHVPJMWIJfeB/J7G9K1+YPS57xyR5LfWCqukksQQVSgWjj73N 45SZYY/VGiPOn3rTQR8//NZ5pE7hvzCy28yfJWUqgSAJom5y23H8yvHc7gGT8NMnQtwl rcr+oYMZqoPxtvHDZ2VBDiHhrgA7xBVTggH7WmU2fd2/xNhT0TGG+YPvDRZeMCE1Jmcp sz+3XWzPWW3rgzUerzNO/phGaBma6nCOLmBDyvWzi9U25E5lpsIe9cTUIMJdby2Mu4Or YIVld2uMLpS8pQNyZvFm/9t2lx9Y8VBMHP81OtWZ1WPwC1JTDcF1WPbJpqQnUo2RMbcN D5vw== X-Gm-Message-State: ABy/qLaZR6CfNL/PbMwjGVVaBSxiSIMQpbPrPGLTa587PNlC6o96xCOl mM52eAGg4x1ANShGSBibk/TnKQ== X-Google-Smtp-Source: APBJJlGQNVLYMApqFZ/htsoivIm7XKYGSULt0CzXOtPMEN+r2YUmRlIK8RFnMu9t3b8ZkH/MbUJSlA== X-Received: by 2002:a05:6a21:340a:b0:12d:e596:df21 with SMTP id yn10-20020a056a21340a00b0012de596df21mr3514011pzb.7.1688422786234; Mon, 03 Jul 2023 15:19:46 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id f5-20020a170902ab8500b001b8573384a0sm7654765plr.59.2023.07.03.15.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 15:19:46 -0700 (PDT) Date: Mon, 3 Jul 2023 15:19:44 -0700 From: Stephen Hemminger To: Muhammad Jawad Hussain Cc: dev@dpdk.org Subject: Re: [PATCH v2] examples/ethtool: update rxmode to increase functionality Message-ID: <20230703151944.62af33ab@hermes.local> In-Reply-To: <20220811125840.108887-1-jawad.hussain@emumba.com> References: <20220525061230.123956-1-jawad.hussain@emumba.com> <20220811125840.108887-1-jawad.hussain@emumba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 11 Aug 2022 17:58:40 +0500 Muhammad Jawad Hussain wrote: > @@ -142,7 +183,6 @@ pcmd_quit_callback(__rte_unused void *ptr_params, > cmdline_quit(ctx); > } > > - > static void > pcmd_drvinfo_callback(__rte_unused void *ptr_params, > __rte_unused struct cmdline *ctx, Please don't do unrelated whitespace changes. > > - > static void > -pcmd_rxmode_callback(void *ptr_params, > - __rte_unused struct cmdline *ctx, > - __rte_unused void *ptr_data) > +pcmd_rxmode_callback(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > { > - struct pcmd_intstr_params *params = ptr_params; > - int stat; > + int ret = -ENOTSUP; > + uint16_t vf_rxmode = 0; > + struct cmd_set_vf_rxmode *res = parsed_result; > + > + int is_on = (strcmp(res->on, "on") == 0) ? 1 : 0; Simpler as: bool is_on = !strcmp(res->on, "on"); Also what if use gives bogus value for on/off? > + if (!strcmp(res->what, "rxmode")) { > + if (!strcmp(res->mode, "AUPE")) > + vf_rxmode |= RTE_ETH_VMDQ_ACCEPT_UNTAG; > + else if (!strcmp(res->mode, "ROPE")) > + vf_rxmode |= RTE_ETH_VMDQ_ACCEPT_HASH_UC; > + else if (!strcmp(res->mode, "BAM")) > + vf_rxmode |= RTE_ETH_VMDQ_ACCEPT_BROADCAST; > + else if (!strncmp(res->mode, "MPE", 3)) > + vf_rxmode |= RTE_ETH_VMDQ_ACCEPT_MULTICAST; > + } You need to handle the "none of the above" case. > > - if (!rte_eth_dev_is_valid_port(params->port)) { > - printf("Error: Invalid port number %i\n", params->port); > - return; > + RTE_SET_USED(is_on); > + RTE_SET_USED(vf_rxmode); > + > +#ifdef RTE_NET_IXGBE > + if (ret == -ENOTSUP) { > + ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, > + vf_rxmode, (uint8_t)is_on); > + if (ret == -ENOTSUP) > + printf("ixgbe not supported\n"); > } > - stat = rte_ethtool_net_set_rx_mode(params->port); > - if (stat == 0) > - return; > - else if (stat == -ENOTSUP) > - printf("Port %i: Operation not supported\n", params->port); > - else > - printf("Port %i: Error setting rx mode\n", params->port); > +#endif > +#ifdef RTE_NET_BNXT > + if (ret == -ENOTSUP) { > + ret = rte_pmd_bnxt_set_vf_rxmode(res->port_id, res->vf_id, > + vf_rxmode, (uint8_t)is_on); > + if (ret == -ENOTSUP) > + printf("bnxt not supported\n"); > + } > +#endif This is a mess. And it shows missing ethdev functionality. Calling a driver with some unrelated device may break it. Not sure if anyone really cares about ethtool? But if they do please fixup and resubmit