From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Machata Subject: Re: [PATCH net-next 1/7] net: bridge: Extract boilerplate around switchdev_port_obj_*() Date: Fri, 25 May 2018 19:56:10 +0300 Message-ID: References: <87d0xjzpf2.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , , , , , , , , To: Vivien Didelot Return-path: Received: from mail-he1eur01on0119.outbound.protection.outlook.com ([104.47.0.119]:45342 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933631AbeEYQ4f (ORCPT ); Fri, 25 May 2018 12:56:35 -0400 In-Reply-To: <87d0xjzpf2.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> (Vivien Didelot's message of "Fri, 25 May 2018 12:10:57 -0400") Sender: netdev-owner@vger.kernel.org List-ID: Vivien Didelot writes: > Hi Petr, > > Petr Machata writes: > >> -static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br, >> - u16 vid, u16 flags) >> +static int br_switchdev_port_obj_add(struct net_device *dev, u16 vid, u16 flags) >> { >> struct switchdev_obj_port_vlan v = { >> .obj.orig_dev = dev, >> @@ -89,12 +88,29 @@ static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br, >> .vid_begin = vid, >> .vid_end = vid, >> }; >> - int err; >> >> + return switchdev_port_obj_add(dev, &v.obj); >> +} >> + >> +static int br_switchdev_port_obj_del(struct net_device *dev, u16 vid) >> +{ >> + struct switchdev_obj_port_vlan v = { >> + .obj.orig_dev = dev, >> + .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, >> + .vid_begin = vid, >> + .vid_end = vid, >> + }; >> + >> + return switchdev_port_obj_del(dev, &v.obj); >> +} > > Shouldn't they be br_switchdev_port_vlan_add (or similar) implemented in > net/bridge/br_switchdev.c instead, since they are VLAN specific? (You mean switchdev-specific?) This logic was in br_vlan.c before as well, so it's natural to think about the functions as helpers of VLAN module. I can move to br_switchdev.c if you think that's the better place. Thanks, Petr