[LiSA-Devel] Clear mac address from interface

Andreea-Cristina Hodea andreea.cristina.hodea at gmail.com
Tue May 28 15:13:39 EEST 2013


On Tue, May 28, 2013 at 2:54 PM, Ionut Nicu <ionut.nicu at mindbit.ro> wrote:
> On Tue, 2013-05-28 at 14:40 +0300, Andreea-Cristina Hodea wrote:
>> > On Tue, 2013-05-21 at 15:53 +0300, Andreea-Cristina Hodea wrote:
>> >> The SWCFG_CLEARMACINT command is called only from swctl and not from
>> >> swcli. Taking a look at lisa kernel module, CLEARMACINT implementation
>> >> is duplicated in DELMACDYN, the latter being more complex. Does it
>> >> make sense to get rid of CLEARMACINT?
>> >>
>> Sorry, I made a confusion regarding CLEARMACINT. Reading the
>> description from include/linux/net_switch.h I understand that
>> CLEARMACINT should cleanup SW_FDB_MAC_ANY and not SW_FDB_MAC_DYNAMIC
>> as it does now in net/switch/sw_ioctl.c.
>>
>> If the observation above is correct, there are more ways to solve it.
>> A possible solution would be to adapt fdb_cleanup_port implementation
>> so that it removes all entries if entry_type is SW_FDB_MAC_ANY and
>> call fdb_cleanup_port(, SW_FDB_MAC_ANY) in CLEARMACINT implementation.
>>
>>
>> To sum up, DELMACDYN removes dynamic macs of a port/vlan whereas
>> CLEARMACINT is supposed to remove all macs for a port, so it would
>> somehow make sense to keep both of them. Is this correct?
>
> Clearly the comment in include/linux/net_switch.h is wrong. CLEARMACINT
> deletes only dynamic mac addresses:
>
>         case SWCFG_CLEARMACINT:
>                 PORT_GET;
>                 fdb_cleanup_port(port, SW_FDB_MAC_DYNAMIC);
>                 err = 0;
>                 break;
>
>
> Instead of keeping this ioctl and changing it to clear both
> static/dynamic entries in the fdb, why not remove it like we've
> discussed and unify SWCFG_DELMACSTATIC with SWCFG_DELMACDYN (for example
> into a ioctl called SWCFG_DELMAC) so that we'll have just one ioctl to
> clear either dynamic, static or both types of fdb entries based on a new
> parameter?
>
> Please let me know what you think.

I think your solution it's the best and it's very easy to implement
for "lisa.ko" as the new parameter may be passed through mac.type
field from swcfgreq structure. And I guess when clearing both types
entries, SWCFG_DELMAC should call fdb_cleanup_port for both types
sequentially or call it only once with SW_FDB_TYPE_ANY as parameter?
In the former case, there would be two traversals on the fdb entries.

Andreea


More information about the LiSA-Devel mailing list