net: enetc: move enetc_set_psfp() out of the common enetc_set_features()
[ Upstream commit fed38e64d9b99d65a36c0dbadc3d3f8ddd9ea030 ] The VF netdev driver shouldn't respond to changes in the NETIF_F_HW_TC flag; only PFs should. Moreover, TSN-specific code should go to enetc_qos.c, which should not be included in the VF driver. Fixes: 79e499829f3f ("net: enetc: add hw tc hw offload features for PSPF capability") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://lore.kernel.org/r/20220916133209.3351399-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c60801e4e2
commit
11eb9ed088
@ -2307,29 +2307,6 @@ static int enetc_set_rss(struct net_device *ndev, int en)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enetc_set_psfp(struct net_device *ndev, int en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (en) {
|
||||
err = enetc_psfp_enable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads |= ENETC_F_QCI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = enetc_psfp_disable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads &= ~ENETC_F_QCI;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void enetc_enable_rxvlan(struct net_device *ndev, bool en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
@ -2348,11 +2325,9 @@ static void enetc_enable_txvlan(struct net_device *ndev, bool en)
|
||||
enetc_bdr_enable_txvlan(&priv->si->hw, i, en);
|
||||
}
|
||||
|
||||
int enetc_set_features(struct net_device *ndev,
|
||||
netdev_features_t features)
|
||||
void enetc_set_features(struct net_device *ndev, netdev_features_t features)
|
||||
{
|
||||
netdev_features_t changed = ndev->features ^ features;
|
||||
int err = 0;
|
||||
|
||||
if (changed & NETIF_F_RXHASH)
|
||||
enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH));
|
||||
@ -2364,11 +2339,6 @@ int enetc_set_features(struct net_device *ndev,
|
||||
if (changed & NETIF_F_HW_VLAN_CTAG_TX)
|
||||
enetc_enable_txvlan(ndev,
|
||||
!!(features & NETIF_F_HW_VLAN_CTAG_TX));
|
||||
|
||||
if (changed & NETIF_F_HW_TC)
|
||||
err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
|
||||
|
@ -385,8 +385,7 @@ void enetc_start(struct net_device *ndev);
|
||||
void enetc_stop(struct net_device *ndev);
|
||||
netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev);
|
||||
struct net_device_stats *enetc_get_stats(struct net_device *ndev);
|
||||
int enetc_set_features(struct net_device *ndev,
|
||||
netdev_features_t features);
|
||||
void enetc_set_features(struct net_device *ndev, netdev_features_t features);
|
||||
int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd);
|
||||
int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data);
|
||||
@ -421,6 +420,7 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||
int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data);
|
||||
int enetc_psfp_init(struct enetc_ndev_priv *priv);
|
||||
int enetc_psfp_clean(struct enetc_ndev_priv *priv);
|
||||
int enetc_set_psfp(struct net_device *ndev, bool en);
|
||||
|
||||
static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
@ -496,4 +496,9 @@ static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int enetc_set_psfp(struct net_device *ndev, bool en)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -708,6 +708,13 @@ static int enetc_pf_set_features(struct net_device *ndev,
|
||||
{
|
||||
netdev_features_t changed = ndev->features ^ features;
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (changed & NETIF_F_HW_TC) {
|
||||
err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) {
|
||||
struct enetc_pf *pf = enetc_si_priv(priv->si);
|
||||
@ -721,7 +728,9 @@ static int enetc_pf_set_features(struct net_device *ndev,
|
||||
if (changed & NETIF_F_LOOPBACK)
|
||||
enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK));
|
||||
|
||||
return enetc_set_features(ndev, features);
|
||||
enetc_set_features(ndev, features);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops enetc_ndev_ops = {
|
||||
|
@ -1529,6 +1529,29 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||
}
|
||||
}
|
||||
|
||||
int enetc_set_psfp(struct net_device *ndev, bool en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (en) {
|
||||
err = enetc_psfp_enable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads |= ENETC_F_QCI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = enetc_psfp_disable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads &= ~ENETC_F_QCI;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int enetc_psfp_init(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
if (epsfp.psfp_sfi_bitmap)
|
||||
|
@ -88,7 +88,9 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr)
|
||||
static int enetc_vf_set_features(struct net_device *ndev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
return enetc_set_features(ndev, features);
|
||||
enetc_set_features(ndev, features);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Probing/ Init */
|
||||
|
Loading…
x
Reference in New Issue
Block a user