From: Andrew Lunn <andrew@lunn.ch>
To: Mattias Forsblad <mattias.forsblad@gmail.com>
Cc: netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [RFC net-next PATCH 2/3] mv88e6xxx: Implement remote management support (RMU)
Date: Fri, 19 Aug 2022 14:29:56 +0200 [thread overview]
Message-ID: <Yv+CRPCi27Ffvrbk@lunn.ch> (raw)
In-Reply-To: <15eb1ab3-18ae-cd65-5798-bf5af3b046c7@gmail.com>
> >> +int mv88e6xxx_inband_rcv(struct dsa_switch *ds, struct sk_buff *skb, int seq_no)
> >> +{
> >> + struct mv88e6xxx_chip *chip = ds->priv;
> >> + struct mv88e6xxx_port *port;
> >> + __be16 *prodnum;
> >> + __be16 *format;
> >> + __be16 *code;
> >> + __be32 *mib_data;
> >> + u8 pkt_dev;
> >> + u8 pkt_prt;
> >> + int i;
> >
> > Reverse christmass tree.
> >
>
> Will fix. Doesn't checkpatch find these?
No it does not :-(
It is only something which netdev enforces.
> >> +
> >> + /* Extract response data */
> >> + format = (__be16 *)&skb->data[0];
> >
> > You have no idea of the alignment of data, so you should not cast it
> > to a pointer type and dereference it. Take a look at the unaligned
> > helpers.
> >
>
> Can you point me to an example please?
#include <asm/unaligned.h>
then you can use functions like get_unaligned_be16(),
get_unaligned_le32(), put_unaligned_le32().
On X86 unaligned accesses are cheap, so these macros do nothing. For
ARM they are expensive so split it into byte accesses.
> I've tested this implementation in a system with multiple switchcores
> and it works.
Cool, there are not many such boards, but RMU really helps these if
they are sharing the same MDIO bus.
Andrew
next prev parent reply other threads:[~2022-08-19 12:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 10:29 [RFC net-next PATCH 0/3] net: dsa: mv88e6xxx: Add RMU support Mattias Forsblad
2022-08-18 10:29 ` [RFC net-next PATCH 1/3] dsa: Add ability to handle RMU frames Mattias Forsblad
2022-08-18 12:44 ` Andrew Lunn
2022-08-19 5:21 ` Mattias Forsblad
2022-08-18 10:29 ` [RFC net-next PATCH 2/3] mv88e6xxx: Implement remote management support (RMU) Mattias Forsblad
2022-08-18 13:21 ` Andrew Lunn
2022-08-19 5:28 ` Mattias Forsblad
2022-08-19 12:29 ` Andrew Lunn [this message]
2022-08-18 10:29 ` [RFC net-next PATCH 3/3] mv88e6xxx: rmon: Use RMU to collect rmon data Mattias Forsblad
2022-08-18 15:36 ` Andrew Lunn
2022-08-19 5:47 ` Mattias Forsblad
2022-08-18 11:58 ` [RFC net-next PATCH 0/3] net: dsa: mv88e6xxx: Add RMU support Vladimir Oltean
2022-08-19 5:07 ` Mattias Forsblad
2022-08-18 12:31 ` Andrew Lunn
2022-08-19 5:14 ` Mattias Forsblad
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=Yv+CRPCi27Ffvrbk@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=mattias.forsblad@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.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).