[PATCH 4/5] UBUNTU: SAUCE: net: calxedaxgmac: add mac address learning

Paolo Pisati paolo.pisati at canonical.com
Thu Nov 7 20:06:48 UTC 2013


On Thu, Nov 07, 2013 at 02:24:09PM +0000, Andy Whitcroft wrote:
...
> >  
> > +#define XGMAC_AGING_TIMEOUT	(120 * HZ)
> 
> Is this even used?
 
> > +static void xgmac_mac_aging_work(struct work_struct *work)
> > +{
> > +	int i, j;
> > +	char addr[ETH_ALEN];
> > +	struct xgmac_priv *priv =
> > +		container_of(work, struct xgmac_priv, mac_aging_work.work);
> > +	struct net_device *dev = priv->dev;
> > +
> > +	for (i = 1; i < priv->max_macs; i++) {
> > +		if (xgmac_get_mac_addr(priv->base, addr, i))
> > +			continue;
> > +
> > +		if (!is_valid_ether_addr(addr))
> > +			break;
> > +
> > +		dev_uc_del(dev, addr);
> > +		//printk("unlearned addr %pM\n", addr);
> > +
> > +		for (j = 1; j < priv->max_macs; j++) {
> > +			if (!ether_addr_equal(addr, priv->mac_list[j].mac_addr))
> > +				continue;
> > +			priv->mac_list[i].time = 0;
> > +			memset(priv->mac_list[i].mac_addr, 0, ETH_ALEN);
> > +			break;
> 
> This routine seems to search through the addresses configured on the
> device, and where they are found and removed we then seem to search our
> locla mac_list[] array for them and remove them there as well.  It looks
> to my eye that we find the appropriate slot in this inner loop and
> remove the entry defined by the outer one.
> 
> Could you check with Rob, as either this code is wrong, or it is subtle
> enough that it needs a comment to explain it.

Rob, care to comment?
-- 
bye,
p.




More information about the kernel-team mailing list