]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: fec: use switch statement to check the type of tx_buf
authorWei Fang <wei.fang@nxp.com>
Thu, 5 Feb 2026 08:57:37 +0000 (16:57 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 10 Feb 2026 09:58:20 +0000 (10:58 +0100)
commit8492e4f1959c02c4ab7062699350c392cdfa543f
tree33133cf5bd3b70b4d8798d08917e6a12748b0f95
parent2dcc93475559168a7d3ccffcc35d79f19416782b
net: fec: use switch statement to check the type of tx_buf

The tx_buf has three types: FEC_TXBUF_T_SKB, FEC_TXBUF_T_XDP_NDO and
FEC_TXBUF_T_XDP_TX. Currently, the driver uses 'if...else...' statements
to check the type and perform the corresponding processing. This is very
detrimental to future expansion. To support AF_XDP zero-copy mode, two
new types will be added in the future, continuing to use 'if...else...'
would be a very bad coding style. So the 'if...else...' statements in
the current driver are replaced with switch statements.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/20260205085742.2685134-11-wei.fang@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/freescale/fec_main.c