Commit 373df313 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlx4-fixes'

Tariq Toukan says:

====================
mlx4 fixes

This patchset contains several bug fixes from the team to the
mlx4 Eth driver.

Series generated against net commit:
c2f57fb9 "drivers: net: phy: mdio-xgene: Add hardware dependency"

v2:
* excluded some cleanup patches.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e1487888 7a61fc86
...@@ -94,7 +94,7 @@ static u8 mlx4_en_dcbnl_getcap(struct net_device *dev, int capid, u8 *cap) ...@@ -94,7 +94,7 @@ static u8 mlx4_en_dcbnl_getcap(struct net_device *dev, int capid, u8 *cap)
*cap = true; *cap = true;
break; break;
case DCB_CAP_ATTR_DCBX: case DCB_CAP_ATTR_DCBX:
*cap = priv->cee_params.dcbx_cap; *cap = priv->dcbx_cap;
break; break;
case DCB_CAP_ATTR_PFC_TCS: case DCB_CAP_ATTR_PFC_TCS:
*cap = 1 << mlx4_max_tc(priv->mdev->dev); *cap = 1 << mlx4_max_tc(priv->mdev->dev);
...@@ -111,14 +111,14 @@ static u8 mlx4_en_dcbnl_getpfcstate(struct net_device *netdev) ...@@ -111,14 +111,14 @@ static u8 mlx4_en_dcbnl_getpfcstate(struct net_device *netdev)
{ {
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
return priv->cee_params.dcb_cfg.pfc_state; return priv->cee_config.pfc_state;
} }
static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
{ {
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
priv->cee_params.dcb_cfg.pfc_state = state; priv->cee_config.pfc_state = state;
} }
static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority,
...@@ -126,7 +126,7 @@ static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, ...@@ -126,7 +126,7 @@ static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority,
{ {
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
*setting = priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc; *setting = priv->cee_config.dcb_pfc[priority];
} }
static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority,
...@@ -134,8 +134,8 @@ static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, ...@@ -134,8 +134,8 @@ static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority,
{ {
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc = setting; priv->cee_config.dcb_pfc[priority] = setting;
priv->cee_params.dcb_cfg.pfc_state = true; priv->cee_config.pfc_state = true;
} }
static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
...@@ -157,13 +157,11 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) ...@@ -157,13 +157,11 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev)
{ {
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_dev *mdev = priv->mdev;
struct mlx4_en_cee_config *dcb_cfg = &priv->cee_params.dcb_cfg;
int err = 0;
if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return -EINVAL; return 1;
if (dcb_cfg->pfc_state) { if (priv->cee_config.pfc_state) {
int tc; int tc;
priv->prof->rx_pause = 0; priv->prof->rx_pause = 0;
...@@ -171,7 +169,7 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) ...@@ -171,7 +169,7 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev)
for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) {
u8 tc_mask = 1 << tc; u8 tc_mask = 1 << tc;
switch (dcb_cfg->tc_config[tc].dcb_pfc) { switch (priv->cee_config.dcb_pfc[tc]) {
case pfc_disabled: case pfc_disabled:
priv->prof->tx_ppp &= ~tc_mask; priv->prof->tx_ppp &= ~tc_mask;
priv->prof->rx_ppp &= ~tc_mask; priv->prof->rx_ppp &= ~tc_mask;
...@@ -199,15 +197,17 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) ...@@ -199,15 +197,17 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev)
en_dbg(DRV, priv, "Set pfc off\n"); en_dbg(DRV, priv, "Set pfc off\n");
} }
err = mlx4_SET_PORT_general(mdev->dev, priv->port, if (mlx4_SET_PORT_general(mdev->dev, priv->port,
priv->rx_skb_size + ETH_FCS_LEN, priv->rx_skb_size + ETH_FCS_LEN,
priv->prof->tx_pause, priv->prof->tx_pause,
priv->prof->tx_ppp, priv->prof->tx_ppp,
priv->prof->rx_pause, priv->prof->rx_pause,
priv->prof->rx_ppp); priv->prof->rx_ppp)) {
if (err)
en_err(priv, "Failed setting pause params\n"); en_err(priv, "Failed setting pause params\n");
return err; return 1;
}
return 0;
} }
static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) static u8 mlx4_en_dcbnl_get_state(struct net_device *dev)
...@@ -225,7 +225,7 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) ...@@ -225,7 +225,7 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state)
struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_priv *priv = netdev_priv(dev);
int num_tcs = 0; int num_tcs = 0;
if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return 1; return 1;
if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED))
...@@ -238,7 +238,10 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) ...@@ -238,7 +238,10 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state)
priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED;
} }
return mlx4_en_setup_tc(dev, num_tcs); if (mlx4_en_setup_tc(dev, num_tcs))
return 1;
return 0;
} }
/* On success returns a non-zero 802.1p user priority bitmap /* On success returns a non-zero 802.1p user priority bitmap
...@@ -252,7 +255,7 @@ static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) ...@@ -252,7 +255,7 @@ static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
.selector = idtype, .selector = idtype,
.protocol = id, .protocol = id,
}; };
if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return 0; return 0;
return dcb_getapp(netdev, &app); return dcb_getapp(netdev, &app);
...@@ -264,7 +267,7 @@ static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype, ...@@ -264,7 +267,7 @@ static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype,
struct mlx4_en_priv *priv = netdev_priv(netdev); struct mlx4_en_priv *priv = netdev_priv(netdev);
struct dcb_app app; struct dcb_app app;
if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return -EINVAL; return -EINVAL;
memset(&app, 0, sizeof(struct dcb_app)); memset(&app, 0, sizeof(struct dcb_app));
...@@ -433,7 +436,7 @@ static u8 mlx4_en_dcbnl_getdcbx(struct net_device *dev) ...@@ -433,7 +436,7 @@ static u8 mlx4_en_dcbnl_getdcbx(struct net_device *dev)
{ {
struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_priv *priv = netdev_priv(dev);
return priv->cee_params.dcbx_cap; return priv->dcbx_cap;
} }
static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode)
...@@ -442,7 +445,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) ...@@ -442,7 +445,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode)
struct ieee_ets ets = {0}; struct ieee_ets ets = {0};
struct ieee_pfc pfc = {0}; struct ieee_pfc pfc = {0};
if (mode == priv->cee_params.dcbx_cap) if (mode == priv->dcbx_cap)
return 0; return 0;
if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || if ((mode & DCB_CAP_DCBX_LLD_MANAGED) ||
...@@ -451,7 +454,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) ...@@ -451,7 +454,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode)
!(mode & DCB_CAP_DCBX_HOST)) !(mode & DCB_CAP_DCBX_HOST))
goto err; goto err;
priv->cee_params.dcbx_cap = mode; priv->dcbx_cap = mode;
ets.ets_cap = IEEE_8021QAZ_MAX_TCS; ets.ets_cap = IEEE_8021QAZ_MAX_TCS;
pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS;
......
...@@ -71,10 +71,11 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) ...@@ -71,10 +71,11 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up)
#ifdef CONFIG_MLX4_EN_DCB #ifdef CONFIG_MLX4_EN_DCB
if (!mlx4_is_slave(priv->mdev->dev)) { if (!mlx4_is_slave(priv->mdev->dev)) {
if (up) { if (up) {
priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; if (priv->dcbx_cap)
priv->flags |= MLX4_EN_FLAG_DCB_ENABLED;
} else { } else {
priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED;
priv->cee_params.dcb_cfg.pfc_state = false; priv->cee_config.pfc_state = false;
} }
} }
#endif /* CONFIG_MLX4_EN_DCB */ #endif /* CONFIG_MLX4_EN_DCB */
...@@ -3048,9 +3049,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, ...@@ -3048,9 +3049,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
struct mlx4_en_priv *priv; struct mlx4_en_priv *priv;
int i; int i;
int err; int err;
#ifdef CONFIG_MLX4_EN_DCB
struct tc_configuration *tc;
#endif
dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv),
MAX_TX_RINGS, MAX_RX_RINGS); MAX_TX_RINGS, MAX_RX_RINGS);
...@@ -3117,16 +3115,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, ...@@ -3117,16 +3115,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
priv->msg_enable = MLX4_EN_MSG_LEVEL; priv->msg_enable = MLX4_EN_MSG_LEVEL;
#ifdef CONFIG_MLX4_EN_DCB #ifdef CONFIG_MLX4_EN_DCB
if (!mlx4_is_slave(priv->mdev->dev)) { if (!mlx4_is_slave(priv->mdev->dev)) {
priv->cee_params.dcbx_cap = DCB_CAP_DCBX_VER_CEE | priv->dcbx_cap = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_HOST |
DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE;
DCB_CAP_DCBX_VER_IEEE;
priv->flags |= MLX4_EN_DCB_ENABLED; priv->flags |= MLX4_EN_DCB_ENABLED;
priv->cee_params.dcb_cfg.pfc_state = false; priv->cee_config.pfc_state = false;
for (i = 0; i < MLX4_EN_NUM_UP; i++) { for (i = 0; i < MLX4_EN_NUM_UP; i++)
tc = &priv->cee_params.dcb_cfg.tc_config[i]; priv->cee_config.dcb_pfc[i] = pfc_disabled;
tc->dcb_pfc = pfc_disabled;
}
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) {
dev->dcbnl_ops = &mlx4_en_dcbnl_ops; dev->dcbnl_ops = &mlx4_en_dcbnl_ops;
......
...@@ -818,7 +818,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -818,7 +818,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
real_size = get_real_size(skb, shinfo, dev, &lso_header_size, real_size = get_real_size(skb, shinfo, dev, &lso_header_size,
&inline_ok, &fragptr); &inline_ok, &fragptr);
if (unlikely(!real_size)) if (unlikely(!real_size))
goto tx_drop; goto tx_drop_count;
/* Align descriptor to TXBB size */ /* Align descriptor to TXBB size */
desc_size = ALIGN(real_size, TXBB_SIZE); desc_size = ALIGN(real_size, TXBB_SIZE);
...@@ -826,7 +826,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -826,7 +826,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { if (unlikely(nr_txbb > MAX_DESC_TXBBS)) {
if (netif_msg_tx_err(priv)) if (netif_msg_tx_err(priv))
en_warn(priv, "Oversized header or SG list\n"); en_warn(priv, "Oversized header or SG list\n");
goto tx_drop; goto tx_drop_count;
} }
bf_ok = ring->bf_enabled; bf_ok = ring->bf_enabled;
...@@ -1071,9 +1071,10 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1071,9 +1071,10 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
} }
tx_drop_count:
ring->tx_dropped++;
tx_drop: tx_drop:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
ring->tx_dropped++;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
...@@ -1106,7 +1107,7 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, ...@@ -1106,7 +1107,7 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame,
goto tx_drop; goto tx_drop;
if (mlx4_en_is_tx_ring_full(ring)) if (mlx4_en_is_tx_ring_full(ring))
goto tx_drop; goto tx_drop_count;
/* fetch ring->cons far ahead before needing it to avoid stall */ /* fetch ring->cons far ahead before needing it to avoid stall */
ring_cons = READ_ONCE(ring->cons); ring_cons = READ_ONCE(ring->cons);
...@@ -1176,7 +1177,8 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, ...@@ -1176,7 +1177,8 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame,
return NETDEV_TX_OK; return NETDEV_TX_OK;
tx_drop: tx_drop_count:
ring->tx_dropped++; ring->tx_dropped++;
tx_drop:
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -482,20 +482,10 @@ enum dcb_pfc_type { ...@@ -482,20 +482,10 @@ enum dcb_pfc_type {
pfc_enabled_rx pfc_enabled_rx
}; };
struct tc_configuration {
enum dcb_pfc_type dcb_pfc;
};
struct mlx4_en_cee_config { struct mlx4_en_cee_config {
bool pfc_state; bool pfc_state;
struct tc_configuration tc_config[MLX4_EN_NUM_UP]; enum dcb_pfc_type dcb_pfc[MLX4_EN_NUM_UP];
}; };
struct mlx4_en_cee_params {
u8 dcbx_cap;
struct mlx4_en_cee_config dcb_cfg;
};
#endif #endif
struct ethtool_flow_id { struct ethtool_flow_id {
...@@ -624,7 +614,8 @@ struct mlx4_en_priv { ...@@ -624,7 +614,8 @@ struct mlx4_en_priv {
struct ieee_ets ets; struct ieee_ets ets;
u16 maxrate[IEEE_8021QAZ_MAX_TCS]; u16 maxrate[IEEE_8021QAZ_MAX_TCS];
enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS];
struct mlx4_en_cee_params cee_params; struct mlx4_en_cee_config cee_config;
u8 dcbx_cap;
#endif #endif
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
spinlock_t filters_lock; spinlock_t filters_lock;
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2
#define MLX4_IGNORE_FCS_MASK 0x1 #define MLX4_IGNORE_FCS_MASK 0x1
#define MLNX4_TX_MAX_NUMBER 8 #define MLX4_TC_MAX_NUMBER 8
void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table)
{ {
...@@ -2022,7 +2022,7 @@ int mlx4_max_tc(struct mlx4_dev *dev) ...@@ -2022,7 +2022,7 @@ int mlx4_max_tc(struct mlx4_dev *dev)
u8 num_tc = dev->caps.max_tc_eth; u8 num_tc = dev->caps.max_tc_eth;
if (!num_tc) if (!num_tc)
num_tc = MLNX4_TX_MAX_NUMBER; num_tc = MLX4_TC_MAX_NUMBER;
return num_tc; return num_tc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment