Messages in this thread | | | From | Vladimir Oltean <> | Subject | Re: [PATCH net-next 1/3] net: lan966x: Add function lan966x_mac_cpu_copy() | Date | Mon, 3 Jan 2022 15:46:57 +0000 |
| |
On Mon, Jan 03, 2022 at 04:39:10PM +0100, Horatiu Vultur wrote: > > > +int lan966x_mac_learn(struct lan966x *lan966x, int port, > > > + const unsigned char mac[ETH_ALEN], > > > + unsigned int vid, > > > + enum macaccess_entry_type type) > > > +{ > > > + return lan966x_mac_learn_impl(lan966x, port, false, mac, vid, type); > > > > If you call lan966x_mac_cpu_copy() on an address and then > > lan966x_mac_learn() on the same address but on an external port, how > > does that work (why doesn't the "false" here overwrite the cpu_copy in > > the previous command, breaking the copy-to-CPU feature)? > > Then you will overwrite the cpu_copy so the frames will not reach the > CPU anymore. > But you should not do that. The function lan966x_mac_cpu_copy() should be > used for IPv4/IPv6 and lan966x_mac_learn() for the other types. > > Maybe the function lan966x_mac_cpu_copy() is too generic. It should be > something like lan966x_mac_ipv4(), lan966x_mac_ipv6() and these functions > will call __lan966x_mac_learn with the correct parameters. Also I can > add a WARN_ON(...) inside lan966x_mac_learn not to be used with the > IPv4/IPv6 types.
The intended usage pattern isn't clear at all in the current series.
| |