Skip to content

Commit

Permalink
net: marvell: prestera: handle fib notifications
Browse files Browse the repository at this point in the history
For now we support only TRAP or DROP, so we can offload only "local" or
"blackhole" routes.
Nexthop routes is TRAP for now. Will be implemented soon.

Co-developed-by: Taras Chornyi <tchornyi@marvell.com>
Signed-off-by: Taras Chornyi <tchornyi@marvell.com>
Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yevhen Orlov authored and David S. Miller committed Feb 17, 2022
1 parent 16de3db commit 4394fbc
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/marvell/prestera/prestera.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,10 @@ struct prestera_router {
struct list_head vr_list;
struct list_head rif_entry_list;
struct rhashtable fib_ht;
struct rhashtable kern_fib_cache_ht;
struct notifier_block inetaddr_nb;
struct notifier_block inetaddr_valid_nb;
struct notifier_block fib_nb;
};

struct prestera_rxtx_params {
Expand Down Expand Up @@ -326,6 +328,8 @@ int prestera_port_cfg_mac_write(struct prestera_port *port,

struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev);

void prestera_queue_work(struct work_struct *work);

int prestera_port_pvid_set(struct prestera_port *port, u16 vid);

bool prestera_netdev_check(const struct net_device *dev);
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/ethernet/marvell/prestera/prestera_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#define PRESTERA_MAC_ADDR_NUM_MAX 255

static struct workqueue_struct *prestera_wq;
static struct workqueue_struct *prestera_owq;

void prestera_queue_work(struct work_struct *work)
{
queue_work(prestera_owq, work);
}

int prestera_port_pvid_set(struct prestera_port *port, u16 vid)
{
Expand Down Expand Up @@ -1024,12 +1030,17 @@ static int __init prestera_module_init(void)
if (!prestera_wq)
return -ENOMEM;

prestera_owq = alloc_ordered_workqueue("prestera_ordered", 0);
if (!prestera_owq)
return -ENOMEM;

return 0;
}

static void __exit prestera_module_exit(void)
{
destroy_workqueue(prestera_wq);
destroy_workqueue(prestera_owq);
}

module_init(prestera_module_init);
Expand Down
Loading

0 comments on commit 4394fbc

Please sign in to comment.