On Wed, Sep 2, 2020 at 5:07 PM Vadym Kochan <vadym.koc...@plvision.eu> wrote:
>
> The following features are supported:
>
>     - VLAN-aware bridge offloading
>     - VLAN-unaware bridge offloading
>     - FDB offloading (learning, ageing)
>     - Switchport configuration
>
> Currently there are some limitations like:
>
>     - Only 1 VLAN-aware bridge instance supported
>     - FDB ageing timeout parameter is set globally per device
>
> Co-developed-by: Serhiy Boiko <serhiy.bo...@plvision.eu>
> Signed-off-by: Serhiy Boiko <serhiy.bo...@plvision.eu>
> Co-developed-by: Serhiy Pshyk <serhiy.ps...@plvision.eu>
> Signed-off-by: Serhiy Pshyk <serhiy.ps...@plvision.eu>
> Co-developed-by: Taras Chornyi <taras.chor...@plvision.eu>
> Signed-off-by: Taras Chornyi <taras.chor...@plvision.eu>
> Signed-off-by: Vadym Kochan <vadym.koc...@plvision.eu>


> +int prestera_switchdev_init(struct prestera_switch *sw)
> +{
> +       struct prestera_switchdev *swdev;
> +       int err;
> +
> +       swdev = kzalloc(sizeof(*swdev), GFP_KERNEL);
> +       if (!swdev)
> +               return -ENOMEM;
> +
> +       sw->swdev = swdev;
> +       swdev->sw = sw;
> +
> +       INIT_LIST_HEAD(&swdev->bridge_list);
> +
> +       swdev_wq = alloc_ordered_workqueue("%s_ordered", 0, "prestera_br");
> +       if (!swdev_wq) {
> +               err = -ENOMEM;
> +               goto err_alloc_wq;
> +       }
> +
> +       err = prestera_switchdev_handler_init(swdev);
> +       if (err)
> +               goto err_swdev_init;
> +
> +       err = prestera_fdb_init(sw);
> +       if (err)
> +               goto err_fdb_init;
> +
> +       return 0;
> +
> +err_fdb_init:
> +err_swdev_init:
> +err_alloc_wq:
> +       kfree(swdev);
> +
> +       return err;
> +}
> +
> +void prestera_switchdev_fini(struct prestera_switch *sw)
> +{
> +       struct prestera_switchdev *swdev = sw->swdev;
> +
> +       prestera_fdb_fini(sw);
> +       prestera_switchdev_handler_fini(swdev);
> +       destroy_workqueue(swdev_wq);

this cleanup is also needed on the error path of prestera_switchdev_init

> +       kfree(swdev);
> +}

Reply via email to