Re: [RFC PATCH v7 06/16] net: dsa: tag_qca: add define for handling mgmt Ethernet packet

Florian Fainelli
2022-01-26T03:54:20Z

On 1/22/2022 5:33 PM, Ansuel Smith wrote:
> Add all the required define to prepare support for mgmt read/write in
> Ethernet packet. Any packet of this type has to be dropped as the only
> use of these special packet is receive ack for an mgmt write request or
> receive data for an mgmt read request.
> A struct is used that emulates the Ethernet header but is used for a
> different purpose.
>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---

[snip]

> +/* Special struct emulating a Ethernet header */
> +struct mgmt_ethhdr {
> + u32 command; /* command bit 31:0 */
> + u32 seq; /* seq 63:32 */
> + u32 mdio_data; /* first 4byte mdio */
> + __be16 hdr; /* qca hdr */
> +} __packed;

Might be worth adding a BUILD_BUG_ON(sizeof(struct mgmt_ethhdr) !=
QCA_HDR_MGMT_PKG_LEN) when you start making use of that structure?
--
Florian