mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

It appears that stmmac is not the only hardware which requires a software-driven verification state machine for the MAC Merge layer. While on the one hand it's good to encourage hardware implementations, on the other hand it's quite difficult to tolerate multiple drivers implementing independently fairly non-trivial logic. Extract the hardware-independent logic from stmmac into library code and put it in ethtool. Name the state structure "mmsv" for MAC Merge Software Verification. Let this expose an operations structure for executing the hardware stuff: sync hardware with the tx_active boolean (result of verification process), enable/disable the pMAC, send mPackets, notify library of external events (reception of mPackets), as well as link state changes. Note that it is assumed that the external events are received in hardirq context. If they are not, it is probably a good idea to disable hardirqs when calling ethtool_mmsv_event_handle(), because the library does not do so. Also, the MM software verification process has no business with the tx_min_frag_size, that is all the driver's to handle. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Co-developed-by: Choong Yong Liang <yong.liang.choong@linux.intel.com> Signed-off-by: Choong Yong Liang <yong.liang.choong@linux.intel.com> Tested-by: Choong Yong Liang <yong.liang.choong@linux.intel.com> Tested-by: Furong Xu <0x1207@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Faizal Rahim <faizal.abdul.rahim@linux.intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
28 lines
900 B
C
28 lines
900 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2024 Furong Xu <0x1207@gmail.com>
|
|
* stmmac FPE(802.3 Qbu) handling
|
|
*/
|
|
#ifndef _STMMAC_FPE_H_
|
|
#define _STMMAC_FPE_H_
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/netdevice.h>
|
|
|
|
struct stmmac_priv;
|
|
|
|
bool stmmac_fpe_supported(struct stmmac_priv *priv);
|
|
void stmmac_fpe_init(struct stmmac_priv *priv);
|
|
void stmmac_fpe_irq_status(struct stmmac_priv *priv);
|
|
int stmmac_fpe_get_add_frag_size(struct stmmac_priv *priv);
|
|
void stmmac_fpe_set_add_frag_size(struct stmmac_priv *priv, u32 add_frag_size);
|
|
|
|
int dwmac5_fpe_map_preemption_class(struct net_device *ndev,
|
|
struct netlink_ext_ack *extack, u32 pclass);
|
|
int dwxgmac3_fpe_map_preemption_class(struct net_device *ndev,
|
|
struct netlink_ext_ack *extack, u32 pclass);
|
|
|
|
extern const struct stmmac_fpe_reg dwmac5_fpe_reg;
|
|
extern const struct stmmac_fpe_reg dwxgmac3_fpe_reg;
|
|
|
|
#endif
|