From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id DD2785942 for ; Sun, 2 Nov 2014 20:59:10 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 02 Nov 2014 12:08:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,295,1413270000"; d="scan'208";a="625105117" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 02 Nov 2014 12:08:19 -0800 Received: from irsmsx152.ger.corp.intel.com (163.33.192.66) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sun, 2 Nov 2014 20:08:19 +0000 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.82]) by IRSMSX152.ger.corp.intel.com ([169.254.6.125]) with mapi id 14.03.0195.001; Sun, 2 Nov 2014 20:08:18 +0000 From: "De Lara Guarch, Pablo" To: "Pattan, Reshma" Thread-Topic: [dpdk-dev] [PATCH v6] distributor_app: new sample app Thread-Index: AQHP6hLMdwRAl1Q8CUSpqYSqVBRsLJxNwZQQ Date: Sun, 2 Nov 2014 20:08:17 +0000 Message-ID: References: <1412174020-15117-1-git-send-email-reshma.pattan@intel.com> <1413554380-22809-1-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1413554380-22809-1-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v6] distributor_app: new sample app 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: Sun, 02 Nov 2014 19:59:11 -0000 Hi Reshma, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan [...] > diff --git a/examples/distributor_app/main.c > b/examples/distributor_app/main.c > new file mode 100644 > index 0000000..c9994a6 > --- /dev/null > +++ b/examples/distributor_app/main.c > @@ -0,0 +1,642 @@ [...] > +static const struct rte_eth_rxconf rx_conf_default =3D { > + .rx_thresh =3D { > + .pthresh =3D RX_PTHRESH, > + .hthresh =3D RX_HTHRESH, > + .wthresh =3D RX_WTHRESH, > + }, > + .rx_free_thresh =3D RX_FREE_THRESH, > + .rx_drop_en =3D 0, > +}; > + > +static const struct rte_eth_txconf tx_conf_default =3D { > + .tx_thresh =3D { > + .pthresh =3D TX_PTHRESH, > + .hthresh =3D TX_HTHRESH, > + .wthresh =3D TX_WTHRESH, > + }, > + .tx_free_thresh =3D TX_FREE_THRESH, > + .tx_rs_thresh =3D TX_RSBIT_THRESH, > + .txq_flags =3D TX_Q_FLAGS > + > +}; You can remove these two structures (and all the macros involved), if you pass NULL to rxconf/txconf parameters when calling RX/TX queue setup= . [...] > +static inline int > +port_init(uint8_t port, struct rte_mempool *mbuf_pool) > +{ > + struct rte_eth_conf port_conf =3D port_conf_default; > + const uint16_t rxRings =3D 1, txRings =3D rte_lcore_count() - 1; > + int retval; > + uint16_t q; > + > + if (port >=3D rte_eth_dev_count()) > + return -1; > + > + retval =3D rte_eth_dev_configure(port, rxRings, txRings, &port_conf); > + if (retval !=3D 0) > + return retval; > + > + for (q =3D 0; q < rxRings; q++) { > + retval =3D rte_eth_rx_queue_setup(port, q, RX_RING_SIZE, > + > rte_eth_dev_socket_id(port), > + &rx_conf_default, > mbuf_pool); Recently, a new functionality has been added for RX/TX queue setup.=20 You can now use NULL as rxconf/txconf parameter, so it will use=20 the optimal configuration, so it will save you some lines of code and simpl= ify it. > + if (retval < 0) > + return retval; > + } > + > + for (q =3D 0; q < txRings; q++) { > + retval =3D rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, > + > rte_eth_dev_socket_id(port), > + &tx_conf_default); > + if (retval < 0) > + return retval; > + } > + > + retval =3D rte_eth_dev_start(port); Remove second space before "=3D". > + if (retval < 0) > + return retval; > + [...] > + rte_distributor_process(d, NULL, 0); > + /* flush distributor to bring to known state */ > + rte_distributor_flush(d); > + /* set worker & tx threads quit flag */ > + quit_signal =3D 1; > + /* worker threads may hang in get packet as > + distributor process is not runnig, just make sure workers > + gets packets till quit_signal is actually been > + received and they gracefully shutdown*/ Typos in "running" and "workers gets". Plus, use standard multi-line commen= ts. > + quit_workers(d, mem_pool); > + /* rx thread should quit at last*/ > + return 0; > +} > + [...] > +static int > +lcore_worker(struct lcore_params *p) > +{ > + struct rte_distributor *d =3D p->d; > + const unsigned id =3D p->worker_id; > + /* for single port, xor_val will be zero so we won't modify the output > + * port, otherwise we send traffic from 0 to 1, 2 to 3, and vice versa > + */ Move "/*" to the first line, to be consistent with other multi-line comment= s. =20 > + const unsigned xor_val =3D (rte_eth_dev_count() > 1); > + struct rte_mbuf *buf =3D NULL; > + > + printf("\nCore %u acting as worker core.\n", rte_lcore_id()); > + while (!quit_signal) { > + buf =3D rte_distributor_get_pkt(d, id, buf); > + buf->port ^=3D xor_val; > + } > + return 0; [...] > + default: > + print_usage(prgname); > + return -1; > + } > + } > + > +if (optind <=3D 1) { > + print_usage(prgname); > + return -1; > +} Missing indentation. > + > + argv[optind-1] =3D prgname; > + > + optind =3D 0; /* reset getopt lib */ > + return 0; > +} Thanks, Pablo