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 C94AD1E2F for ; Thu, 3 May 2018 14:32:49 +0200 (CEST) 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; 03 May 2018 05:32:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="196429215" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga004.jf.intel.com with ESMTP; 03 May 2018 05:32:47 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.214]) by IRSMSX104.ger.corp.intel.com ([169.254.5.96]) with mapi id 14.03.0319.002; Thu, 3 May 2018 13:32:46 +0100 From: "Ananyev, Konstantin" To: "Zhang, Qi Z" , "Yigit, Ferruh" CC: "dev@dpdk.org" Thread-Topic: [PATCH] ethdev: convert Tx offloads to Tx queue config Thread-Index: AQHT4qRv7gF/BStwS06I2cQ50qM6BaQd8B5g Date: Thu, 3 May 2018 12:32:45 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258AEDC1E34@irsmsx105.ger.corp.intel.com> References: <20180503060325.153722-1-qi.z.zhang@intel.com> In-Reply-To: <20180503060325.153722-1-qi.z.zhang@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWNkMjVkZjMtMzY3MS00NzEyLThmMWYtOTg5ZmEwZGIyZTNiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRvVWw4TkZcL2RcLzFpWDRxSmhabDJ4a3lTNXVyNXRZXC9sTVJ5YWJ3bHBVWUU9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ethdev: convert Tx offloads to Tx queue config 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: Thu, 03 May 2018 12:32:51 -0000 > -----Original Message----- > From: Zhang, Qi Z > Sent: Thursday, May 3, 2018 7:03 AM > To: Yigit, Ferruh ; Ananyev, Konstantin > Cc: dev@dpdk.org; Zhang, Qi Z > Subject: [PATCH] ethdev: convert Tx offloads to Tx queue config >=20 > Tx offload will be converted to txq_flags automatically during > rte_eth_dev_info_get and rte_eth_tx_queue_info_get. So PMD can > clean the code to get rid of txq_flags at all while keep old APP > not be impacted. >=20 > Signed-off-by: Qi Zhang > --- > lib/librte_ethdev/rte_ethdev.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index e5605242d..a357ee09f 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1516,6 +1516,30 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t = rx_queue_id, > } >=20 > /** > + * Convert from tx offloads to txq_flags. > + */ > +static void > +rte_eth_convert_tx_offload(const uint64_t tx_offloads, uint32_t *txq_fla= gs) > +{ > + uint32_t flags =3D 0; > + > + if (!(tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)) > + flags |=3D ETH_TXQ_FLAGS_NOMULTSEGS; > + if (!(tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)) > + flags |=3D ETH_TXQ_FLAGS_NOVLANOFFL; > + if (!(tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM)) > + flags |=3D ETH_TXQ_FLAGS_NOXSUMSCTP; > + if (!(tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) > + flags |=3D ETH_TXQ_FLAGS_NOXSUMUDP; > + if (!(tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) > + flags |=3D ETH_TXQ_FLAGS_NOXSUMTCP; > + if (tx_offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) > + flags |=3D ETH_TXQ_FLAGS_NOREFCOUNT | ETH_TXQ_FLAGS_NOMULTMEMP; > + > + *txq_flags =3D flags; > +} > + > +/** > * A conversion function from txq_flags API. > */ > static void > @@ -2359,6 +2383,7 @@ void > rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info= ) > { > struct rte_eth_dev *dev; > + struct rte_eth_txconf *txconf; > const struct rte_eth_desc_lim lim =3D { > .nb_max =3D UINT16_MAX, > .nb_min =3D 0, > @@ -2380,6 +2405,9 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_e= th_dev_info *dev_info) > dev_info->nb_tx_queues =3D dev->data->nb_tx_queues; >=20 > dev_info->dev_flags =3D &dev->data->dev_flags; > + txconf =3D &dev_info->default_txconf; > + /* convert offload to txq_flags to support legacy app */ > + rte_eth_convert_tx_offload(txconf->offloads, &txconf->txq_flags); > } >=20 > int > @@ -3799,6 +3827,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_= t queue_id, > struct rte_eth_txq_info *qinfo) > { > struct rte_eth_dev *dev; > + struct rte_eth_txconf *txconf =3D &qinfo->conf; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >=20 > @@ -3815,6 +3844,9 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_= t queue_id, >=20 > memset(qinfo, 0, sizeof(*qinfo)); > dev->dev_ops->txq_info_get(dev, queue_id, qinfo); > + /* convert offload to txq_flags to support legacy app */ > + rte_eth_convert_tx_offload(txconf->offloads, &txconf->txq_flags); > + > return 0; > } >=20 > -- Acked-by: Konstantin Ananyev > 2.13.6