From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 934265F44 for ; Wed, 14 Mar 2018 20:40:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 12:40:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,306,1517904000"; d="scan'208";a="182791147" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 14 Mar 2018 12:40:53 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 14 Mar 2018 12:40:53 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 14 Mar 2018 12:40:52 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.108]) with mapi id 14.03.0319.002; Thu, 15 Mar 2018 03:40:51 +0800 From: "Wu, Jingjing" To: "Dai, Wei" , "Lu, Wenzhuo" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 1/2] app/testpmd: add commands to test new Rx offload API Thread-Index: AQHTupjr37ghhfSJEU69iBwFpW54tKPQIDpw Date: Wed, 14 Mar 2018 19:40:50 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810FB77D7@SHSMSX103.ccr.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> In-Reply-To: <1520923325-40400-2-git-send-email-wei.dai@intel.com> Accept-Language: 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: [10.239.127.40] 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: Wed, 14 Mar 2018 19:40:57 -0000 <...> > +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 fu= nction, just set the BIT which you want to set or mask here? <...> > +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 h= ere. <...> > +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. <...> > @@ -707,6 +708,17 @@ init_config(void) > } > } >=20 > + 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])); When will you free it? > + 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?