From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: <dev@dpdk.org>, <thomas.monjalon@6wind.com>,
<bruce.richardson@intel.com>, <jianbo.liu@linaro.org>,
<huawei.xie@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/3] virtio: conditional compilation cleanup
Date: Mon, 4 Jul 2016 18:20:42 +0530 [thread overview]
Message-ID: <20160704125041.GA6532@localhost.localdomain> (raw)
In-Reply-To: <20160704122630.GB26521@yliu-dev.sh.intel.com>
On Mon, Jul 04, 2016 at 08:26:30PM +0800, Yuanhan Liu wrote:
> On Mon, Jul 04, 2016 at 05:45:57PM +0530, Jerin Jacob wrote:
> > On Mon, Jul 04, 2016 at 07:02:25PM +0800, Yuanhan Liu wrote:
> > > On Mon, Jul 04, 2016 at 02:37:55PM +0530, Jerin Jacob wrote:
> > > > On Mon, Jul 04, 2016 at 04:42:32PM +0800, Yuanhan Liu wrote:
> > > > > On Mon, Jul 04, 2016 at 02:06:27PM +0530, Jerin Jacob wrote:
> > > > > > On Mon, Jul 04, 2016 at 03:36:48PM +0800, Yuanhan Liu wrote:
> > > > > > > On Fri, Jul 01, 2016 at 04:46:36PM +0530, Jerin Jacob wrote:
> > > > > > > > @@ -494,9 +486,6 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
> > > > > > > > {
> > > > > > > > uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
> > > > > > > >
> > > > > > > > -#ifdef RTE_MACHINE_CPUFLAG_SSSE3
> > > > > > > > - struct virtio_hw *hw = dev->data->dev_private;
> > > > > > > > -#endif
> > > > > > > > struct virtnet_tx *txvq;
> > > > > > > > struct virtqueue *vq;
> > > > > > > > uint16_t tx_free_thresh;
> > > > > > > > @@ -511,13 +500,14 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
> > > > > > > > }
> > > > > > > >
> > > > > > > > #ifdef RTE_MACHINE_CPUFLAG_SSSE3
> > > > > > > > + struct virtio_hw *hw = dev->data->dev_private;
> > > > > > >
> > > > > > > I'd suggest to move above declaration to ...
> > > > > > >
> > > > > > > > /* Use simple rx/tx func if single segment and no offloads */
> > > > > > > > if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) == VIRTIO_SIMPLE_FLAGS &&
> > > > > > > > !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
> > > > > > >
> > > > > > > here: we should try to avoid declaring vars in the middle of a code block.
> > > > > >
> > > > > > Next patch in this series, moving all rxtx handler selection code to
> > > > > > separate function(virtio_update_rxtx_handler()) where declaration comes
> > > > > > as first line in the function.i.e the comment is taken care of in the
> > > > > > series.
> > > > >
> > > > > Yes, I saw that. But in principle, each patch is atomic: it's not a
> > > > > good idea/practice to introduce issues in path A and then fix it in
> > > > > path B.
> > > >
> > > > In my view it was not an issue as I was removing all possible
> > > > conditional compilation flag. If I were to move the declaration to top
> > > > then another conditional compilation RTE_MACHINE_CPUFLAG_SSSE3
> > > > flag I need to add around declaring the variable.
> > >
> > > Nope, I was suggesting to move it inside the "if" block. So, this
> > > is actually consistent with what you are trying to do. Besides, it
> > > removes an declaration in the middle.
> >
> > Just to get the clarity on "moving inside the 'if' block"
> >
> > Are you suggesting to have like below?
> >
> > #ifdef RTE_MACHINE_CPUFLAG_SSSE3
> > + struct virtio_hw *hw;
> > /* Use simple rx/tx func if single segment and no offloads */
> > if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) ==
> > VIRTIO_SIMPLE_FLAGS &&
> > !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
> > PMD_INIT_LOG(INFO, "Using simple rx/tx path");
> > dev->tx_pkt_burst = virtio_xmit_pkts_simple;
> > dev->rx_pkt_burst = virtio_recv_pkts_vec;
> > - use_simple_rxtx = 1;
> > + hw = dev->data->dev_private;
> > + hw->use_simple_rxtx = 1;
> > }
> > #endif
> >
> >
> > Instead of following scheme in existing patch,
> >
> > #ifdef RTE_MACHINE_CPUFLAG_SSSE3
> > + struct virtio_hw *hw = dev->data->dev_private;
> > /* Use simple rx/tx func if single segment and no offloads */
> > if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) ==
> > VIRTIO_SIMPLE_FLAGS &&
> > !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
> > PMD_INIT_LOG(INFO, "Using simple rx/tx path");
> > dev->tx_pkt_burst = virtio_xmit_pkts_simple;
> > dev->rx_pkt_burst = virtio_recv_pkts_vec;
> > - use_simple_rxtx = 1;
> > + hw->use_simple_rxtx = 1;
> > }
> > #endif
> >
> >
> > The former case will have issue as "hw" been used in "if" with vtpci_with_feature.
>
> Oh, my bad. I overlooked it. Sorry for that!
>
> > OR
> >
> > if you meant just floating "struct virtio_hw *hw" without RTE_MACHINE_CPUFLAG_SSSE3
> > then it comes error on non x86 as unused "hw" variable.
> >
> > If you meant something else then let me know?
>
> I then prefer to keep the "#ifdef .. #endif" on top then. It will stop
> us from offending a minor rule, while you can remove the ugly "#ifdef"
> block in the next patch.
>
> Works to you?
OK. As you wish :-)
>
> --yliu
next prev parent reply other threads:[~2016-07-04 12:51 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 11:54 [dpdk-dev] [PATCH 0/4] Virtio NEON support for ARM Jerin Jacob
2016-06-27 11:54 ` [dpdk-dev] [PATCH 1/4] virtio: Fix compile time dependency of use_simple_rxtx usage Jerin Jacob
2016-06-27 11:54 ` [dpdk-dev] [PATCH 2/4] virtio: introduce RTE_LIBRTE_VIRTIO_INC_VECTOR Jerin Jacob
2016-06-27 14:19 ` Thomas Monjalon
2016-06-27 14:48 ` Jerin Jacob
2016-06-27 14:59 ` Thomas Monjalon
2016-06-29 11:18 ` Jerin Jacob
2016-06-29 11:25 ` Thomas Monjalon
2016-06-29 11:40 ` Jerin Jacob
2016-06-30 5:44 ` Yuanhan Liu
2016-06-27 11:54 ` [dpdk-dev] [PATCH 3/4] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-06-28 6:17 ` Jianbo Liu
2016-06-29 11:27 ` Jerin Jacob
2016-06-30 5:43 ` Yuanhan Liu
2016-06-27 11:54 ` [dpdk-dev] [PATCH 4/4] virtio: add neon support Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] From: Jerin Jacob <jerin.jacob@caviumnetworks.com> Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 1/3] virtio: conditional compilation cleanup Jerin Jacob
2016-07-04 7:36 ` Yuanhan Liu
2016-07-04 8:36 ` Jerin Jacob
2016-07-04 8:42 ` Yuanhan Liu
2016-07-04 9:07 ` Jerin Jacob
2016-07-04 11:02 ` Yuanhan Liu
2016-07-04 12:15 ` Jerin Jacob
2016-07-04 12:26 ` Yuanhan Liu
2016-07-04 12:50 ` Jerin Jacob [this message]
2016-07-04 12:57 ` Yuanhan Liu
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 2/3] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-07-04 7:42 ` Yuanhan Liu
2016-07-04 8:38 ` Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 3/3] virtio: add neon support Jerin Jacob
2016-07-04 7:53 ` Yuanhan Liu
2016-07-04 8:55 ` Jerin Jacob
2016-07-04 9:02 ` Yuanhan Liu
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 0/4] Virtio NEON support for ARM Jerin Jacob
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 1/4] virtio: conditional compilation cleanup Jerin Jacob
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 2/4] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-08-18 6:52 ` Yuanhan Liu
2016-08-19 3:24 ` Jerin Jacob
2016-08-23 7:43 ` Yuanhan Liu
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 3/4] virtio: add cpuflag based vector handler selection Jerin Jacob
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 4/4] virtio: add neon support Jerin Jacob
2016-07-06 3:11 ` Jianbo Liu
2016-09-28 0:37 ` [dpdk-dev] [PATCH v3 0/4] Virtio NEON support for ARM Yuanhan Liu
2016-07-01 11:19 ` [dpdk-dev] [PATCH v2 0/3] " Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160704125041.GA6532@localhost.localdomain \
--to=jerin.jacob@caviumnetworks.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
--cc=jianbo.liu@linaro.org \
--cc=thomas.monjalon@6wind.com \
--cc=yuanhan.liu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).