Commit b9452452 authored by John Hurley's avatar John Hurley Committed by David S. Miller

nfp: flower: add per repr private data for LAG offload

Add a bitmap to each flower repr to track its state if it is enslaved by a
bond. This LAG state may be different to the port state - for example, the
port may be up but LAG state may be down due to the selection in an
active/backup bond.
Signed-off-by: default avatarJohn Hurley <john.hurley@netronome.com>
Reviewed-by: default avatarPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 898bc7d6
...@@ -185,6 +185,10 @@ nfp_flower_repr_netdev_init(struct nfp_app *app, struct net_device *netdev) ...@@ -185,6 +185,10 @@ nfp_flower_repr_netdev_init(struct nfp_app *app, struct net_device *netdev)
static void static void
nfp_flower_repr_netdev_clean(struct nfp_app *app, struct net_device *netdev) nfp_flower_repr_netdev_clean(struct nfp_app *app, struct net_device *netdev)
{ {
struct nfp_repr *repr = netdev_priv(netdev);
kfree(repr->app_priv);
tc_setup_cb_egdev_unregister(netdev, nfp_flower_setup_tc_egress_cb, tc_setup_cb_egdev_unregister(netdev, nfp_flower_setup_tc_egress_cb,
netdev_priv(netdev)); netdev_priv(netdev));
} }
...@@ -225,7 +229,9 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app, ...@@ -225,7 +229,9 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp); u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp);
struct nfp_flower_priv *priv = app->priv; struct nfp_flower_priv *priv = app->priv;
atomic_t *replies = &priv->reify_replies; atomic_t *replies = &priv->reify_replies;
struct nfp_flower_repr_priv *repr_priv;
enum nfp_port_type port_type; enum nfp_port_type port_type;
struct nfp_repr *nfp_repr;
struct nfp_reprs *reprs; struct nfp_reprs *reprs;
int i, err, reify_cnt; int i, err, reify_cnt;
const u8 queue = 0; const u8 queue = 0;
...@@ -248,6 +254,15 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app, ...@@ -248,6 +254,15 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
goto err_reprs_clean; goto err_reprs_clean;
} }
repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL);
if (!repr_priv) {
err = -ENOMEM;
goto err_reprs_clean;
}
nfp_repr = netdev_priv(repr);
nfp_repr->app_priv = repr_priv;
/* For now we only support 1 PF */ /* For now we only support 1 PF */
WARN_ON(repr_type == NFP_REPR_TYPE_PF && i); WARN_ON(repr_type == NFP_REPR_TYPE_PF && i);
...@@ -324,6 +339,8 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv) ...@@ -324,6 +339,8 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
{ {
struct nfp_eth_table *eth_tbl = app->pf->eth_tbl; struct nfp_eth_table *eth_tbl = app->pf->eth_tbl;
atomic_t *replies = &priv->reify_replies; atomic_t *replies = &priv->reify_replies;
struct nfp_flower_repr_priv *repr_priv;
struct nfp_repr *nfp_repr;
struct sk_buff *ctrl_skb; struct sk_buff *ctrl_skb;
struct nfp_reprs *reprs; struct nfp_reprs *reprs;
int err, reify_cnt; int err, reify_cnt;
...@@ -351,6 +368,15 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv) ...@@ -351,6 +368,15 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
goto err_reprs_clean; goto err_reprs_clean;
} }
repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL);
if (!repr_priv) {
err = -ENOMEM;
goto err_reprs_clean;
}
nfp_repr = netdev_priv(repr);
nfp_repr->app_priv = repr_priv;
port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr); port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr);
if (IS_ERR(port)) { if (IS_ERR(port)) {
err = PTR_ERR(port); err = PTR_ERR(port);
......
...@@ -160,6 +160,14 @@ struct nfp_flower_priv { ...@@ -160,6 +160,14 @@ struct nfp_flower_priv {
struct nfp_mtu_conf mtu_conf; struct nfp_mtu_conf mtu_conf;
}; };
/**
* struct nfp_flower_repr_priv - Flower APP per-repr priv data
* @lag_port_flags: Extended port flags to record lag state of repr
*/
struct nfp_flower_repr_priv {
unsigned long lag_port_flags;
};
struct nfp_fl_key_ls { struct nfp_fl_key_ls {
u32 key_layer_two; u32 key_layer_two;
u8 key_layer; u8 key_layer;
......
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