From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 54C94548B for ; Sat, 17 Mar 2018 14:49:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Mar 2018 06:49:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,321,1517904000"; d="scan'208";a="212221027" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga006.fm.intel.com with ESMTP; 17 Mar 2018 06:49:27 -0700 Received: from pgsmsx112.gar.corp.intel.com ([169.254.3.227]) by PGSMSX106.gar.corp.intel.com ([169.254.9.180]) with mapi id 14.03.0319.002; Sat, 17 Mar 2018 21:49:26 +0800 From: "Dai, Wei" To: "Wu, Jingjing" , "Lu, Wenzhuo" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 1/2] app/testpmd: add commands to test new Rx offload API Thread-Index: AQHTupjs5Py90Z4EtUG/PioQWwBvUKPPnWgAgATWz4A= Date: Sat, 17 Mar 2018 13:49:25 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D66CF5FCFF@PGSMSX112.gar.corp.intel.com> References: <1520842543-46810-1-git-send-email-wei.dai@intel.com> <1520923325-40400-1-git-send-email-wei.dai@intel.com> <1520923325-40400-2-git-send-email-wei.dai@intel.com> <9BB6961774997848B5B42BEC655768F810FB77D7@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810FB77D7@SHSMSX103.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTZkMjFhN2QtYWU1Ny00NzU2LWFkZGEtYTJhYmRmOTJmNjk4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkFwNk80dnV3eWoxYys0dXhsSktZemZhekI1WUViZWFxSXJWYlVpRDd1cDg9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add commands to test new Rx offload API 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: Sat, 17 Mar 2018 13:49:29 -0000 > -----Original Message----- > From: Wu, Jingjing > Sent: Thursday, March 15, 2018 3:41 AM > To: Dai, Wei ; Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: RE: [PATCH v2 1/2] app/testpmd: add commands to test new Rx > offload API >=20 > <...> >=20 > > +static int > > +config_rx_offload(const char *name, uint64_t *offload, int on) { > > + uint64_t local =3D *offload; > > + > > + if (!strcmp(name, "vlan_strip")) { > > + if (on) > > + local |=3D DEV_RX_OFFLOAD_VLAN_STRIP; > > + else > > + local &=3D ~DEV_RX_OFFLOAD_VLAN_STRIP; > Would it decrease the lines if move the "on" checking to the end of this > function, just set the BIT which you want to set or mask here? Thanks, will follow your suggestion in v3 patch set. > <...> >=20 > > +static void > > +cmd_config_per_port_rx_offload_parsed(void *parsed_result, > > + __attribute__((unused)) struct cmdline *cl, > > + __attribute__((unused)) void *data) { > > + struct cmd_config_per_port_rx_offload_result *res =3D parsed_result; > > + portid_t port_id =3D res->port_id; > > + struct rte_port *port =3D &ports[port_id]; > > + int on; > > + > > + if (port->port_status !=3D RTE_PORT_STOPPED) { > > + printf("Error: Can't config offload when Port %d " > > + "is not stopped\n", port_id); > > + return; > > + } > > + > > + if (!strcmp(res->en_dis, "enable")) > > + on =3D 1; > > + else if (!strcmp(res->en_dis, "disable")) > > + on =3D 0; > > + else { > > + printf("Unknown parameter: %s\n", res->en_dis); > > + return; > The en_dis is already defined as "enable#disable", so the else is useless= here. Thanks, the second if and second else can be removed and will change in v3 = patch set. >=20 > <...> >=20 > > +static void > > +cmd_config_per_queue_rx_offload_parsed(void *parsed_result, > > + __attribute__((unused)) struct cmdline *cl, > > + __attribute__((unused)) void *data) { > > + struct cmd_config_per_queue_rx_offload_result *res =3D parsed_result; > > + struct rte_eth_dev_info dev_info; > > + portid_t port_id =3D res->port_id; > > + uint16_t queue_id =3D res->queue_id; > > + struct rte_port *port =3D &ports[port_id]; > > + int on; > > + > > + if (port->port_status !=3D RTE_PORT_STOPPED) { > > + printf("Error: Can't config offload when Port %d " > > + "is not stopped\n", port_id); > > + return; > > + } > > + > > + if (!strcmp(res->en_dis, "enable")) > > + on =3D 1; > > + else if (!strcmp(res->en_dis, "disable")) > > + on =3D 0; > > + else { > > + printf("Unknown parameter: %s\n", res->en_dis); > > + return; > Same comments as above. > <...> >=20 > > @@ -707,6 +708,17 @@ init_config(void) > > } > > } > > > > + port->rx_offloads =3D rte_zmalloc("testpmd: port->rx_offloads", > > + sizeof(port->rx_offloads[0]) * > > + port->dev_info.max_rx_queues, > > + sizeof(port->rx_offloads[0])); >=20 > When will you free it? I will free port->rx_offloads and port->tx_offloads when testpmd is existed= . >=20 > > + if (port->rx_offloads =3D=3D NULL) > > + rte_exit(EXIT_FAILURE, > > + "rte_zmalloc(%d port->rx_offload[0]) " > > + "failed\n", port->dev_info.max_rx_queues); > > + for (k =3D 0; k < port->dev_info.max_rx_queues; k++) > > + port->rx_offloads[k] =3D port->dev_conf.rxmode.offloads; > > + > In the get configure command, the port->rx_offloads is printed. > Here you init it to be port configuration, when will you update it? This init_config() is only run once in the initialization stage in the main= (). Port->rx_offloads[] can be changed using new testpmd command in this patch = set. Testpmd> rx_offload enable/disable per_queue And will be applied when the command port start is run.