[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da6a06f3-d08e-448c-9269-b6b8e0da647a@lunn.ch>
Date: Fri, 14 Apr 2023 15:29:55 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Mengyuan Lou <mengyuanlou@...-swift.com>
Cc: netdev@...r.kernel.org, jiawenwu@...stnetic.com
Subject: Re: [PATCH net-next 1/5] net: wangxun: libwx add tx offload functions
> + case htons(ETH_P_1588):
> + ptype = WX_PTYPE_L2_TS;
> + goto exit;
> + case htons(ETH_P_FIP):
> + ptype = WX_PTYPE_L2_FIP;
> + goto exit;
> + case htons(WX_ETH_P_LLDP):
> + ptype = WX_PTYPE_L2_LLDP;
> + goto exit;
ETH_P_LLDP exists.
> + case htons(WX_ETH_P_CNM):
> + ptype = WX_PTYPE_L2_CNM;
> + goto exit;
Is this Congestion Notification Message? Since this is part of 802.1Q,
i see no reason not to add it to if_ether.h
> +/* macro to make the table lines short */
> +#define WX_PTT(ptype, mac, ip, etype, eip, proto, layer)\
> + {ptype, \
> + 1, \
> + WX_DEC_PTYPE_MAC_##mac, /* mac */\
> + WX_DEC_PTYPE_IP_##ip, /* ip */ \
> + WX_DEC_PTYPE_ETYPE_##etype, /* etype */\
> + WX_DEC_PTYPE_IP_##eip, /* eip */\
> + WX_DEC_PTYPE_PROT_##proto, /* proto */\
> + WX_DEC_PTYPE_LAYER_##layer /* layer */}
> +
> +#define WX_UKN(ptype) { ptype, 0, 0, 0, 0, 0, 0, 0 }
> +
> +/* Lookup table mapping the HW PTYPE to the bit field for decoding */
> +/* for ((pt=0;pt<256;pt++)); do printf "macro(0x%02X),\n" $pt; done */
> +static wx_dptype wx_ptype_lookup[256] = {
> + WX_UKN(0x00),
> + WX_UKN(0x01),
> + WX_UKN(0x02),
> + WX_UKN(0x03),
> + WX_UKN(0x04),
> + WX_UKN(0x05),
> + WX_UKN(0x06),
> + WX_UKN(0x07),
> + WX_UKN(0x08),
> + WX_UKN(0x09),
> + WX_UKN(0x0A),
> + WX_UKN(0x0B),
> + WX_UKN(0x0C),
> + WX_UKN(0x0D),
> + WX_UKN(0x0E),
> + WX_UKN(0x0F),
Since WX_UKN() is 0, you can skip them and use Designated Initializers.
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
Andrew
Powered by blists - more mailing lists