mirror of https://gitee.com/openkylin/linux.git
nfp: update indirect block support
Register ndo callback via flow_indr_dev_register() and flow_indr_dev_unregister(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9eabd18871
commit
50c1b1c938
|
@ -830,6 +830,10 @@ static int nfp_flower_init(struct nfp_app *app)
|
||||||
if (err)
|
if (err)
|
||||||
goto err_cleanup;
|
goto err_cleanup;
|
||||||
|
|
||||||
|
err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app);
|
||||||
|
if (err)
|
||||||
|
goto err_cleanup;
|
||||||
|
|
||||||
if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)
|
if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)
|
||||||
nfp_flower_qos_init(app);
|
nfp_flower_qos_init(app);
|
||||||
|
|
||||||
|
@ -856,6 +860,9 @@ static void nfp_flower_clean(struct nfp_app *app)
|
||||||
skb_queue_purge(&app_priv->cmsg_skbs_low);
|
skb_queue_purge(&app_priv->cmsg_skbs_low);
|
||||||
flush_work(&app_priv->cmsg_work);
|
flush_work(&app_priv->cmsg_work);
|
||||||
|
|
||||||
|
flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app,
|
||||||
|
nfp_flower_setup_indr_block_cb);
|
||||||
|
|
||||||
if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)
|
if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)
|
||||||
nfp_flower_qos_cleanup(app);
|
nfp_flower_qos_cleanup(app);
|
||||||
|
|
||||||
|
@ -959,10 +966,6 @@ nfp_flower_netdev_event(struct nfp_app *app, struct net_device *netdev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nfp_flower_reg_indir_block_handler(app, netdev, event);
|
|
||||||
if (ret & NOTIFY_STOP_MASK)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = nfp_flower_internal_port_event_handler(app, netdev, event);
|
ret = nfp_flower_internal_port_event_handler(app, netdev, event);
|
||||||
if (ret & NOTIFY_STOP_MASK)
|
if (ret & NOTIFY_STOP_MASK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -458,9 +458,10 @@ void nfp_flower_qos_cleanup(struct nfp_app *app);
|
||||||
int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev,
|
int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev,
|
||||||
struct tc_cls_matchall_offload *flow);
|
struct tc_cls_matchall_offload *flow);
|
||||||
void nfp_flower_stats_rlim_reply(struct nfp_app *app, struct sk_buff *skb);
|
void nfp_flower_stats_rlim_reply(struct nfp_app *app, struct sk_buff *skb);
|
||||||
int nfp_flower_reg_indir_block_handler(struct nfp_app *app,
|
int nfp_flower_indr_setup_tc_cb(struct net_device *netdev, void *cb_priv,
|
||||||
struct net_device *netdev,
|
enum tc_setup_type type, void *type_data);
|
||||||
unsigned long event);
|
int nfp_flower_setup_indr_block_cb(enum tc_setup_type type, void *type_data,
|
||||||
|
void *cb_priv);
|
||||||
|
|
||||||
void
|
void
|
||||||
__nfp_flower_non_repr_priv_get(struct nfp_flower_non_repr_priv *non_repr_priv);
|
__nfp_flower_non_repr_priv_get(struct nfp_flower_non_repr_priv *non_repr_priv);
|
||||||
|
|
|
@ -1619,8 +1619,8 @@ nfp_flower_indr_block_cb_priv_lookup(struct nfp_app *app,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfp_flower_setup_indr_block_cb(enum tc_setup_type type,
|
int nfp_flower_setup_indr_block_cb(enum tc_setup_type type,
|
||||||
void *type_data, void *cb_priv)
|
void *type_data, void *cb_priv)
|
||||||
{
|
{
|
||||||
struct nfp_flower_indr_block_cb_priv *priv = cb_priv;
|
struct nfp_flower_indr_block_cb_priv *priv = cb_priv;
|
||||||
struct flow_cls_offload *flower = type_data;
|
struct flow_cls_offload *flower = type_data;
|
||||||
|
@ -1708,10 +1708,13 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
nfp_flower_indr_setup_tc_cb(struct net_device *netdev, void *cb_priv,
|
nfp_flower_indr_setup_tc_cb(struct net_device *netdev, void *cb_priv,
|
||||||
enum tc_setup_type type, void *type_data)
|
enum tc_setup_type type, void *type_data)
|
||||||
{
|
{
|
||||||
|
if (!nfp_fl_is_netdev_to_offload(netdev))
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TC_SETUP_BLOCK:
|
case TC_SETUP_BLOCK:
|
||||||
return nfp_flower_setup_indr_tc_block(netdev, cb_priv,
|
return nfp_flower_setup_indr_tc_block(netdev, cb_priv,
|
||||||
|
@ -1720,29 +1723,3 @@ nfp_flower_indr_setup_tc_cb(struct net_device *netdev, void *cb_priv,
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfp_flower_reg_indir_block_handler(struct nfp_app *app,
|
|
||||||
struct net_device *netdev,
|
|
||||||
unsigned long event)
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (!nfp_fl_is_netdev_to_offload(netdev))
|
|
||||||
return NOTIFY_OK;
|
|
||||||
|
|
||||||
if (event == NETDEV_REGISTER) {
|
|
||||||
err = __flow_indr_block_cb_register(netdev, app,
|
|
||||||
nfp_flower_indr_setup_tc_cb,
|
|
||||||
app);
|
|
||||||
if (err)
|
|
||||||
nfp_flower_cmsg_warn(app,
|
|
||||||
"Indirect block reg failed - %s\n",
|
|
||||||
netdev->name);
|
|
||||||
} else if (event == NETDEV_UNREGISTER) {
|
|
||||||
__flow_indr_block_cb_unregister(netdev,
|
|
||||||
nfp_flower_indr_setup_tc_cb,
|
|
||||||
app);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NOTIFY_OK;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue