nfp: flower: Convert ndo_setup_tc offloads to block callbacks
Benefit from the newly introduced block callback infrastructure and convert ndo_setup_tc calls for flower offloads to block callbacks. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
855afa0932
commit
363fc53b8b
@ -449,6 +449,10 @@ static int
|
|||||||
nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
|
nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
|
||||||
struct tc_cls_flower_offload *flower)
|
struct tc_cls_flower_offload *flower)
|
||||||
{
|
{
|
||||||
|
if (!eth_proto_is_802_3(flower->common.protocol) ||
|
||||||
|
flower->common.chain_index)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
switch (flower->command) {
|
switch (flower->command) {
|
||||||
case TC_CLSFLOWER_REPLACE:
|
case TC_CLSFLOWER_REPLACE:
|
||||||
return nfp_flower_add_offload(app, netdev, flower);
|
return nfp_flower_add_offload(app, netdev, flower);
|
||||||
@ -461,16 +465,52 @@ nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type,
|
||||||
|
void *type_data, void *cb_priv)
|
||||||
|
{
|
||||||
|
struct nfp_net *nn = cb_priv;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TC_SETUP_CLSFLOWER:
|
||||||
|
return nfp_flower_repr_offload(nn->app, nn->port->netdev,
|
||||||
|
type_data);
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nfp_flower_setup_tc_block(struct net_device *netdev,
|
||||||
|
struct tc_block_offload *f)
|
||||||
|
{
|
||||||
|
struct nfp_net *nn = netdev_priv(netdev);
|
||||||
|
|
||||||
|
if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
switch (f->command) {
|
||||||
|
case TC_BLOCK_BIND:
|
||||||
|
return tcf_block_cb_register(f->block,
|
||||||
|
nfp_flower_setup_tc_block_cb,
|
||||||
|
nn, nn);
|
||||||
|
case TC_BLOCK_UNBIND:
|
||||||
|
tcf_block_cb_unregister(f->block,
|
||||||
|
nfp_flower_setup_tc_block_cb,
|
||||||
|
nn);
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
|
int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
|
||||||
enum tc_setup_type type, void *type_data)
|
enum tc_setup_type type, void *type_data)
|
||||||
{
|
{
|
||||||
struct tc_cls_flower_offload *cls_flower = type_data;
|
switch (type) {
|
||||||
|
case TC_SETUP_CLSFLOWER:
|
||||||
if (type != TC_SETUP_CLSFLOWER ||
|
return 0; /* will be removed after conversion from ndo */
|
||||||
!is_classid_clsact_ingress(cls_flower->common.classid) ||
|
case TC_SETUP_BLOCK:
|
||||||
!eth_proto_is_802_3(cls_flower->common.protocol) ||
|
return nfp_flower_setup_tc_block(netdev, type_data);
|
||||||
cls_flower->common.chain_index)
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
return nfp_flower_repr_offload(app, netdev, cls_flower);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user