All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudiu Manoil <claudiu.manoil@nxp.com>
To: Vladimir Oltean <olteanv@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: RE: [PATCH net-next 1/2] net: enetc: don't depend on system endianness in enetc_set_vlan_ht_filter
Date: Wed, 24 Mar 2021 16:20:35 +0000	[thread overview]
Message-ID: <AM0PR04MB675429E748B9153CCC730ADA96639@AM0PR04MB6754.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20210324154455.1899941-1-olteanv@gmail.com>

>-----Original Message-----
>From: Vladimir Oltean <olteanv@gmail.com>
>Sent: Wednesday, March 24, 2021 5:45 PM
>To: Jakub Kicinski <kuba@kernel.org>; David S. Miller
><davem@davemloft.net>
>Cc: netdev@vger.kernel.org; Claudiu Manoil <claudiu.manoil@nxp.com>;
>Vladimir Oltean <vladimir.oltean@nxp.com>
>Subject: [PATCH net-next 1/2] net: enetc: don't depend on system
>endianness in enetc_set_vlan_ht_filter
>
>From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
>ENETC has a 64-entry hash table for VLAN RX filtering per Station
>Interface, which is accessed through two 32-bit registers: VHFR0 holding
>the low portion, and VHFR1 holding the high portion.
>
>The enetc_set_vlan_ht_filter function looks at the pf->vlan_ht_filter
>bitmap, which is fundamentally an unsigned long variable, and casts it
>to a u32 array of two elements. It puts the first u32 element into VHFR0
>and the second u32 element into VHFR1.
>
>It is easy to imagine that this will not work on big endian systems
>(although, yes, we have bigger problems, because currently enetc assumes
>that the CPU endianness is equal to the controller endianness, aka
>little endian - but let's assume that we could add a cpu_to_le32 in
>enetc_wd_reg and a le32_to_cpu in enetc_rd_reg).
>
>Let's use lower_32_bits and upper_32_bits which are designed to work
>regardless of endianness.
>
>Tested that both the old and the new method produce the same results:
>
>$ ethtool -K eth1 rx-vlan-filter on
>$ ip link add link eth1 name eth1.100 type vlan id 100
>enetc_set_vlan_ht_filter: method 1: si_idx 0 VHFR0 0x0 VHFR1 0x20
>enetc_set_vlan_ht_filter: method 2: si_idx 0 VHFR0 0x0 VHFR1 0x20
>$ ip link add link eth1 name eth1.101 type vlan id 101
>enetc_set_vlan_ht_filter: method 1: si_idx 0 VHFR0 0x0 VHFR1 0x30
>enetc_set_vlan_ht_filter: method 2: si_idx 0 VHFR0 0x0 VHFR1 0x30
>$ ip link add link eth1 name eth1.34 type vlan id 34
>enetc_set_vlan_ht_filter: method 1: si_idx 0 VHFR0 0x0 VHFR1 0x34
>enetc_set_vlan_ht_filter: method 2: si_idx 0 VHFR0 0x0 VHFR1 0x34
>$ ip link add link eth1 name eth1.1024 type vlan id 1024
>enetc_set_vlan_ht_filter: method 1: si_idx 0 VHFR0 0x1 VHFR1 0x34
>enetc_set_vlan_ht_filter: method 2: si_idx 0 VHFR0 0x1 VHFR1 0x34
>
>Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>

  parent reply	other threads:[~2021-03-24 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 15:44 [PATCH net-next 1/2] net: enetc: don't depend on system endianness in enetc_set_vlan_ht_filter Vladimir Oltean
2021-03-24 15:44 ` [PATCH net-next 2/2] net: enetc: don't depend on system endianness in enetc_set_mac_ht_flt Vladimir Oltean
2021-03-24 16:21   ` Claudiu Manoil
2021-03-24 16:20 ` Claudiu Manoil [this message]
2021-03-24 23:40 ` [PATCH net-next 1/2] net: enetc: don't depend on system endianness in enetc_set_vlan_ht_filter patchwork-bot+netdevbpf

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=AM0PR04MB675429E748B9153CCC730ADA96639@AM0PR04MB6754.eurprd04.prod.outlook.com \
    --to=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vladimir.oltean@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.