From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next 14/19] iecm: implement singleq napi_poll
Date: Thu, 3 Feb 2022 20:05:55 +0100 [thread overview]
Message-ID: <20220203190555.18385-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <CO1PR11MB5186D038E0F5CCB0DE9D73CC8F289@CO1PR11MB5186.namprd11.prod.outlook.com>
From: Alan Brady <alan.brady@intel.com>
Date: Thu, 3 Feb 2022 02:45:14 +0100
> > -----Original Message-----
> > From: Lobakin, Alexandr <alexandr.lobakin@intel.com>
> > Sent: Friday, January 28, 2022 9:58 AM
> > To: Brady, Alan <alan.brady@intel.com>
> > Cc: Lobakin, Alexandr <alexandr.lobakin@intel.com>; intel-wired-
> > lan at lists.osuosl.org; Burra, Phani R <phani.r.burra@intel.com>; Chittim,
> > Madhu <madhu.chittim@intel.com>; Linga, Pavan Kumar
> > <pavan.kumar.linga@intel.com>
> > Subject: [Intel-wired-lan] [PATCH net-next 14/19] iecm: implement singleq
> > napi_poll
> >
> > > From: Alan Brady <alan.brady@intel.com>
> > > Date: Thu, 27 Jan 2022 16:10:04 -0800
> > >
> > > This adds everything we do the more traditional singleq model data path.
> > >
> > > Signed-off-by: Phani Burra <phani.r.burra@intel.com>
> > > Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
> > > Signed-off-by: Madhu Chittim <madhu.chittim@intel.com>
> > > Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
> > > Signed-off-by: Alan Brady <alan.brady@intel.com>
> > > ---
> > > drivers/net/ethernet/intel/iecm/iecm_lib.c | 2 +-
> > > .../ethernet/intel/iecm/iecm_singleq_txrx.c | 1208
> > ++++++++++++++++-
> > > drivers/net/ethernet/intel/include/iecm.h | 1 +
> > > .../net/ethernet/intel/include/iecm_txrx.h | 31 +
> > > 4 files changed, 1237 insertions(+), 5 deletions(-)
> > >
--- 8< ---
> > > + /* align size to end of page */
> > > + max_data += -dma & (IECM_TX_MAX_READ_REQ_SIZE - 1);
> >
> > Here applies the same I said for splitq before, this code is counter-intuitive.
> >
>
> I'm failing to find a matching comment for iecm_tx_splitq_map but I'm sure we're open to suggestion how to make it better.
As I said in my reply to 11/19, I don't get the logics here at all,
so I kindly asked to explain it to me.
Since I don't get it, I'm not able to provide any suggestions.
>
> > > + tx_desc->buf_addr = cpu_to_le64(dma);
--- 8< ---
> > > + do {
> > > + struct iecm_base_tx_desc *eop_desc =
> > > + (struct iecm_base_tx_desc *)tx_buf-
> > >next_to_watch;
> >
> > struct iecm_base_tx_desc *eop_desc;
> >
> > eop_desc = (typeof(*eop_desc))tx_buf->next_to_watch;
> >
>
> Again not sure I see the benefit to prefer assigning it's own line over letting it wrap. Suggestion as written is wrong also.
Declaration, then assignment is a normal practice.
Assignment with a line-wrap is an exception only for the lines which
can't be composed any other way. Here you have at least two:
struct iecm_base_tx_desc *eop_desc;
/* This is fixed variant from my initial reply, I apologize
* for the excessive '*'.
*/
eop_desc = (typeof(eop_desc))tx_buf->next_to_watch;
/* More classic variant, fits into 79 as well */
eop_desc = (struct iecm_base_tx_desc *)tx_buf->next_to_watch;
Breaking declaration and assignment into two separate lines is the
first choice when a line exceeds the char limit.
>
> > > +
> > > + /* if next_to_watch is not set then no work pending */
--- 8< ---
> > > + status0 = rx_desc->flex_nic_wb.status_error0;
> > > + if (status0 &
> > > +
> > cpu_to_le16(BIT(VIRTCHNL2_RX_FLEX_DESC_STATUS0_RSS_VALID_
> > S))) {
> > > + u32 hash = le32_to_cpu(rx_desc->flex_nic_wb.rss_hash);
> > > +
> > > + skb_set_hash(skb, hash, iecm_ptype_to_htype(decoded));
> > > + }
> >
> > if (!status)
> > return;
> >
> > -1 indent level.
> >
>
> if (!(status0 & cpu_to_le16(BIT(VIRTCHNL2_RX_FLEX_DESC_STATUS0_RSS_VALID_S))))
> return;
>
> skb_set_hash(...);
hash =
skb_set_hash()
There are two lines there.
>
> vs.
>
> if (status0 & cpu_to_le16(BIT(VIRTCHNL2_RX_FLEX_DESC_STATUS0_RSS_VALID_S)))
> skb_set_hash(....);
>
> Doesn't seem any better to me, in fact it seems worse.
Perhaps due to that train starting from cpu_to_le16 should be hidden
into a compact definition, like
#define IECM_RX_DESC_HASH_BIT \
BIT(VIRTCHNL2_RX_FLEX_DESC_STATUS0_RSS_VALID_S)));
#define __iecm_rx_desc_hash_present(status0) \
!!((status0) & cpu_to_le16(IECM_RX_DESC_HASH_BIT))
#define iecm_rx_desc_hash_present(rx_desc) \
__iecm_rx_desc_hash_present((rx_desc)->flex_nic_wb.status_error0)
...
then either way (`if (hash)` or `if (!hash)`) starts working.
if (!(rx_q->vport->netdev->features & NETIF_F_RXHASH))
return;
if (iecm_rx_desc_hash_present(rx_desc)) {
u32 hash = le32_to_cpu(rx_desc->flex_nic_wb.rss_hash);
skb_set_hash(skb, hash, iecm_ptype_to_htype(decoded));
}
||
if (!(rx_q->vport->netdev->features & NETIF_F_RXHASH) ||
!iecm_rx_desc_hash_present(rx_desc))
return;
hash = le32_to_cpu(rx_desc->flex_nic_wb.rss_hash);
skb_set_hash(skb, hash, iecm_ptype_to_htype(decoded));
>
> > > +}
> > > +
> > > +/**
> > > + * iecm_rx_singleq_process_skb_fields - Populate skb header fields
--- 8< ---
> > > +void
> > > +iecm_rx_singleq_process_skb_fields(struct iecm_queue *rx_q, struct
> > sk_buff *skb,
> > > + union virtchnl2_rx_desc *rx_desc,
> > > + u16 ptype)
> > > +{
> > > + struct iecm_rx_ptype_decoded decoded =
> > > + rx_q->vport->rx_ptype_lkup[ptype];
> >
> > Declare, then assign to avoid wraps.
> >
>
> I'm just not seeing the benefit in doing that. If 'net' tree is concerned with wrapping I would assume they would move to 100 cols with the rest of the kernel.
Everyone is concerned with wrapping.
But one thing is to have a function call wrapped by arguments:
ret = some_long_function_name(argument1,
ARG2);
and completely different -- line breaks, when no alignment is
possible:
some_really_long_variable =
some_long_function_name();
At least I can tell for sure that declaration + assignment is way
more preferred over such line breaks for not altering readability
in any way.
>
> > > +
> > > + /* modifies the skb - consumes the enet header */
--- 8< ---
> > > +static bool iecm_rx_singleq_recycle_buf(struct iecm_queue *rxq,
> > > + struct iecm_rx_buf *rx_buf)
> > > +{
> > > + struct iecm_page_info *page_info =
> > > + &rx_buf->page_info[rx_buf->page_indx];
> >
> > Declare, then assign to avoid wraps.
> >
>
> Will not fix.
The very same questions may come from the upstream maintainers.
The less such trivial places there will be, the better for everyone
I believe? Especially for the maintainers since they review tons of
code daily and aren't happy to see simple style issues again and
again.
>
> > > +
--- 8< ---
> > > --
> > > 2.33.0
> >
> > Thanks,
> > Al
Thanks,
Al
next prev parent reply other threads:[~2022-02-03 19:05 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 0:09 [Intel-wired-lan] [PATCH net-next 00/19] Add iecm and idpf Alan Brady
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 01/19] virtchnl: Add new virtchnl2 ops Alan Brady
2022-02-02 22:13 ` Brady, Alan
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 02/19] iecm: add basic module init and documentation Alan Brady
2022-01-28 11:56 ` Alexander Lobakin
2022-02-02 22:15 ` Brady, Alan
2022-02-01 19:44 ` Shannon Nelson
2022-02-03 3:08 ` Brady, Alan
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 03/19] iecm: add probe and remove Alan Brady
2022-02-01 20:02 ` Shannon Nelson
2022-02-03 3:13 ` Brady, Alan
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 04/19] iecm: add api_init and controlq init Alan Brady
2022-01-28 12:09 ` Alexander Lobakin
2022-02-02 22:16 ` Brady, Alan
2022-02-01 21:26 ` Shannon Nelson
2022-02-03 3:24 ` Brady, Alan
2022-02-03 3:40 ` Brady, Alan
2022-02-03 5:26 ` Shannon Nelson
2022-02-03 13:13 ` Alexander Lobakin
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 05/19] iecm: add vport alloc and virtchnl messages Alan Brady
2022-01-28 4:19 ` kernel test robot
2022-01-28 12:39 ` Alexander Lobakin
2022-02-02 22:23 ` Brady, Alan
2022-01-28 12:32 ` Alexander Lobakin
2022-02-02 22:21 ` Brady, Alan
2022-02-03 13:23 ` Alexander Lobakin
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 06/19] iecm: add virtchnl messages for queues Alan Brady
2022-01-28 13:03 ` Alexander Lobakin
2022-02-02 22:48 ` Brady, Alan
2022-02-03 10:08 ` Maciej Fijalkowski
2022-02-03 14:09 ` Alexander Lobakin
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 07/19] iecm: finish virtchnl messages Alan Brady
2022-01-28 13:19 ` Alexander Lobakin
2022-02-02 23:06 ` Brady, Alan
2022-02-03 15:05 ` Alexander Lobakin
2022-02-03 15:16 ` Maciej Fijalkowski
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 08/19] iecm: add interrupts and configure netdev Alan Brady
2022-01-28 13:34 ` Alexander Lobakin
2022-02-02 23:17 ` Brady, Alan
2022-02-03 15:55 ` Alexander Lobakin
2022-01-28 0:09 ` [Intel-wired-lan] [PATCH net-next 09/19] iecm: alloc vport TX resources Alan Brady
2022-02-02 23:45 ` Brady, Alan
2022-02-03 17:56 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 10/19] iecm: alloc vport RX resources Alan Brady
2022-01-28 14:16 ` Alexander Lobakin
2022-02-03 0:13 ` Brady, Alan
2022-02-03 18:29 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 11/19] iecm: add start_xmit and set_rx_mode Alan Brady
2022-01-28 16:35 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 12/19] iecm: finish netdev_ops Alan Brady
2022-01-28 17:06 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 13/19] iecm: implement splitq napi_poll Alan Brady
2022-01-28 5:21 ` kernel test robot
2022-01-28 17:44 ` Alexander Lobakin
2022-02-03 1:15 ` Brady, Alan
2022-01-28 17:38 ` Alexander Lobakin
2022-02-03 1:07 ` Brady, Alan
2022-02-04 11:50 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 14/19] iecm: implement singleq napi_poll Alan Brady
2022-01-28 17:57 ` Alexander Lobakin
2022-02-03 1:45 ` Brady, Alan
2022-02-03 19:05 ` Alexander Lobakin [this message]
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 15/19] iecm: implement ethtool callbacks Alan Brady
2022-01-28 18:13 ` Alexander Lobakin
2022-02-03 2:13 ` Brady, Alan
2022-02-03 19:54 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 16/19] iecm: implement flow director Alan Brady
2022-01-28 19:04 ` Alexander Lobakin
2022-02-03 2:41 ` Brady, Alan
2022-02-04 10:08 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 17/19] iecm: implement cloud filters Alan Brady
2022-01-28 19:38 ` Alexander Lobakin
2022-02-03 2:53 ` Brady, Alan
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 18/19] iecm: add advanced rss Alan Brady
2022-01-28 19:53 ` Alexander Lobakin
2022-02-03 2:55 ` Brady, Alan
2022-02-03 10:46 ` Maciej Fijalkowski
2022-02-04 10:22 ` Alexander Lobakin
2022-01-28 0:10 ` [Intel-wired-lan] [PATCH net-next 19/19] idpf: introduce idpf driver Alan Brady
2022-01-28 20:08 ` Alexander Lobakin
2022-02-03 3:07 ` Brady, Alan
2022-02-04 10:35 ` Alexander Lobakin
2022-02-04 12:05 ` [Intel-wired-lan] [PATCH net-next 00/19] Add iecm and idpf Alexander Lobakin
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=20220203190555.18385-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=intel-wired-lan@osuosl.org \
/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