nfp: prevent dropped counter increment during probe
authorZiyang Chen <ziyang.chen@corigine.com>
Wed, 12 Jul 2023 12:35:51 +0000 (14:35 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Jul 2023 03:36:10 +0000 (20:36 -0700)
commitbec9ce34075e4b1c4a36d9eb7a40e84929d12aa8
tree44edbfab33159a3199c13c8e67c3c21b5aa5befb
parent6f13b49b57f2cdcb9cab3841da8a441c3521d64e
nfp: prevent dropped counter increment during probe

The dev_rx_discards counter will increment by one when an interface is
toggled up and down. The main reason is that the driver first sends a
`NFP_NET_CFG_CTRL_ENABLE` configuration packet to the NIC to perform port
initialisation when an interface is set up. But there is a race between
physical link up and free list queue initialization which may lead to the
configuration packet being discarded.

To address this problem a new bit NFP_NET_CFG_CTRL_FREELIST_EN is added to
perform free list initialisation on the NIC. The FREELIST_EN should be sent
in advance to initialize free list queue. When a port is set to down,
FREELIST_EN should be sent after CTRL_ENABLE to avoid packet discards.

Signed-off-by: Ziyang Chen <ziyang.chen@corigine.com>
Acked-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Link: https://lore.kernel.org/r/20230712123551.13858-1-louis.peens@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h