Commit 609a807a authored by David S. Miller's avatar David S. Miller

Merge branch 'mlx5-fixes'

Saeed Mahameed says:

====================
Mellanox mlx5 fixes 2017-03-09

This series contains some mlx5 core and ethernet driver fixes.

For -stable:
net/mlx5e: remove IEEE/CEE mode check when setting DCBX mode (for kernel >= 4.10)
net/mlx5e: Avoid wrong identification of rules on deletion (for kernel >= 4.9)
net/mlx5: Don't save PCI state when PCI error is detected (for kernel >= 4.9)
net/mlx5: Fix create autogroup prev initializer (for kernel >=4.9)
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 702f2ac8 ea29bd30
...@@ -302,6 +302,9 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) ...@@ -302,6 +302,9 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_dcbx *dcbx = &priv->dcbx; struct mlx5e_dcbx *dcbx = &priv->dcbx;
if (mode & DCB_CAP_DCBX_LLD_MANAGED)
return 1;
if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) { if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) {
if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO) if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO)
return 0; return 0;
...@@ -315,13 +318,10 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) ...@@ -315,13 +318,10 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
return 1; return 1;
} }
if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev))) if (!(mode & DCB_CAP_DCBX_HOST))
return 1; return 1;
if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
!(mode & DCB_CAP_DCBX_VER_CEE) ||
!(mode & DCB_CAP_DCBX_VER_IEEE) ||
!(mode & DCB_CAP_DCBX_HOST))
return 1; return 1;
return 0; return 0;
......
...@@ -204,9 +204,6 @@ mlx5e_test_loopback_validate(struct sk_buff *skb, ...@@ -204,9 +204,6 @@ mlx5e_test_loopback_validate(struct sk_buff *skb,
struct iphdr *iph; struct iphdr *iph;
/* We are only going to peek, no need to clone the SKB */ /* We are only going to peek, no need to clone the SKB */
if (skb->protocol != htons(ETH_P_IP))
goto out;
if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb)) if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb))
goto out; goto out;
...@@ -249,7 +246,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, ...@@ -249,7 +246,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
lbtp->loopback_ok = false; lbtp->loopback_ok = false;
init_completion(&lbtp->comp); init_completion(&lbtp->comp);
lbtp->pt.type = htons(ETH_P_ALL); lbtp->pt.type = htons(ETH_P_IP);
lbtp->pt.func = mlx5e_test_loopback_validate; lbtp->pt.func = mlx5e_test_loopback_validate;
lbtp->pt.dev = priv->netdev; lbtp->pt.dev = priv->netdev;
lbtp->pt.af_packet_priv = lbtp; lbtp->pt.af_packet_priv = lbtp;
......
...@@ -48,9 +48,14 @@ ...@@ -48,9 +48,14 @@
#include "eswitch.h" #include "eswitch.h"
#include "vxlan.h" #include "vxlan.h"
enum {
MLX5E_TC_FLOW_ESWITCH = BIT(0),
};
struct mlx5e_tc_flow { struct mlx5e_tc_flow {
struct rhash_head node; struct rhash_head node;
u64 cookie; u64 cookie;
u8 flags;
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
struct list_head encap; /* flows sharing the same encap */ struct list_head encap; /* flows sharing the same encap */
struct mlx5_esw_flow_attr *attr; struct mlx5_esw_flow_attr *attr;
...@@ -177,7 +182,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, ...@@ -177,7 +182,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
mlx5_fc_destroy(priv->mdev, counter); mlx5_fc_destroy(priv->mdev, counter);
} }
if (esw && esw->mode == SRIOV_OFFLOADS) { if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
mlx5_eswitch_del_vlan_action(esw, flow->attr); mlx5_eswitch_del_vlan_action(esw, flow->attr);
if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
mlx5e_detach_encap(priv, flow); mlx5e_detach_encap(priv, flow);
...@@ -598,6 +603,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, ...@@ -598,6 +603,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
} }
static int parse_cls_flower(struct mlx5e_priv *priv, static int parse_cls_flower(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_spec *spec, struct mlx5_flow_spec *spec,
struct tc_cls_flower_offload *f) struct tc_cls_flower_offload *f)
{ {
...@@ -609,7 +615,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv, ...@@ -609,7 +615,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
err = __parse_cls_flower(priv, spec, f, &min_inline); err = __parse_cls_flower(priv, spec, f, &min_inline);
if (!err && esw->mode == SRIOV_OFFLOADS && if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH) &&
rep->vport != FDB_UPLINK_VPORT) { rep->vport != FDB_UPLINK_VPORT) {
if (min_inline > esw->offloads.inline_mode) { if (min_inline > esw->offloads.inline_mode) {
netdev_warn(priv->netdev, netdev_warn(priv->netdev,
...@@ -1132,23 +1138,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, ...@@ -1132,23 +1138,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
struct tc_cls_flower_offload *f) struct tc_cls_flower_offload *f)
{ {
struct mlx5e_tc_table *tc = &priv->fs.tc; struct mlx5e_tc_table *tc = &priv->fs.tc;
int err = 0; int err, attr_size = 0;
bool fdb_flow = false;
u32 flow_tag, action; u32 flow_tag, action;
struct mlx5e_tc_flow *flow; struct mlx5e_tc_flow *flow;
struct mlx5_flow_spec *spec; struct mlx5_flow_spec *spec;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
u8 flow_flags = 0;
if (esw && esw->mode == SRIOV_OFFLOADS) if (esw && esw->mode == SRIOV_OFFLOADS) {
fdb_flow = true; flow_flags = MLX5E_TC_FLOW_ESWITCH;
attr_size = sizeof(struct mlx5_esw_flow_attr);
if (fdb_flow) }
flow = kzalloc(sizeof(*flow) +
sizeof(struct mlx5_esw_flow_attr),
GFP_KERNEL);
else
flow = kzalloc(sizeof(*flow), GFP_KERNEL);
flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL);
spec = mlx5_vzalloc(sizeof(*spec)); spec = mlx5_vzalloc(sizeof(*spec));
if (!spec || !flow) { if (!spec || !flow) {
err = -ENOMEM; err = -ENOMEM;
...@@ -1156,12 +1158,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, ...@@ -1156,12 +1158,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
} }
flow->cookie = f->cookie; flow->cookie = f->cookie;
flow->flags = flow_flags;
err = parse_cls_flower(priv, spec, f); err = parse_cls_flower(priv, flow, spec, f);
if (err < 0) if (err < 0)
goto err_free; goto err_free;
if (fdb_flow) { if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
flow->attr = (struct mlx5_esw_flow_attr *)(flow + 1); flow->attr = (struct mlx5_esw_flow_attr *)(flow + 1);
err = parse_tc_fdb_actions(priv, f->exts, flow); err = parse_tc_fdb_actions(priv, f->exts, flow);
if (err < 0) if (err < 0)
......
...@@ -1136,7 +1136,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft, ...@@ -1136,7 +1136,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft,
u32 *match_criteria) u32 *match_criteria)
{ {
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
struct list_head *prev = ft->node.children.prev; struct list_head *prev = &ft->node.children;
unsigned int candidate_index = 0; unsigned int candidate_index = 0;
struct mlx5_flow_group *fg; struct mlx5_flow_group *fg;
void *match_criteria_addr; void *match_criteria_addr;
......
...@@ -1352,6 +1352,7 @@ static int init_one(struct pci_dev *pdev, ...@@ -1352,6 +1352,7 @@ static int init_one(struct pci_dev *pdev,
if (err) if (err)
goto clean_load; goto clean_load;
pci_save_state(pdev);
return 0; return 0;
clean_load: clean_load:
...@@ -1407,9 +1408,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, ...@@ -1407,9 +1408,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
mlx5_enter_error_state(dev); mlx5_enter_error_state(dev);
mlx5_unload_one(dev, priv, false); mlx5_unload_one(dev, priv, false);
/* In case of kernel call save the pci state and drain the health wq */ /* In case of kernel call drain the health wq */
if (state) { if (state) {
pci_save_state(pdev);
mlx5_drain_health_wq(dev); mlx5_drain_health_wq(dev);
mlx5_pci_disable_device(dev); mlx5_pci_disable_device(dev);
} }
...@@ -1461,6 +1461,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) ...@@ -1461,6 +1461,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
pci_set_master(pdev); pci_set_master(pdev);
pci_restore_state(pdev); pci_restore_state(pdev);
pci_save_state(pdev);
if (wait_vital(pdev)) { if (wait_vital(pdev)) {
dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__);
......
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