From: Ajay Bhargav <ajay.bhargav@einfochips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/3] net: Adds Fast Ethernet Controller driver for Armada100
Date: Wed, 31 Aug 2011 10:54:06 +0530 (IST) [thread overview]
Message-ID: <2032566791.11944.1314768246740.JavaMail.root@ahm.einfochips.com> (raw)
In-Reply-To: <1933734784.11800.1314767411051.JavaMail.root@ahm.einfochips.com>
----- "Ajay Bhargav" <ajay.bhargav@einfochips.com> wrote:
> ----- "Mike Frysinger" <vapier@gentoo.org> wrote:
>
> > On Tuesday, August 30, 2011 01:44:40 Ajay Bhargav wrote:
> > > +static void update_hash_table_mac_address(struct armdfec_device
> > *darmdfec,
> > > + u8 *oaddr, u8 *addr)
> > > +{
> > > + u32 mach;
> > > + u32 macl;
> > > +
> > > + /* Delete old entry */
> > > + if (oaddr) {
> > > + mach = (oaddr[0] << 8) | oaddr[1];
> > > + macl = (oaddr[2] << 24) | (oaddr[3] << 16) |
> > > + (oaddr[4] << 8) | oaddr[5];
> > > + add_del_hash_entry(darmdfec, mach, macl, 1, 0, HASH_DELETE);
> > > + }
> > > +
> > > + /* Add new entry */
> > > + mach = (addr[0] << 8) | addr[1];
> > > + macl = (addr[2] << 24) | (addr[3] << 16) | (addr[4] << 8) |
> > addr[5];
> > > + add_del_hash_entry(darmdfec, mach, macl, 1, 0, HASH_ADD);
> > > +}
> > > ...
> > > +static int armdfec_init(struct eth_device *dev, bd_t *bd)
> > > +{
> > > ...
> > > + update_hash_table_mac_address(darmdfec, dev->enetaddr,
> > dev->enetaddr);
> >
> > i think something got lost along the way here :)
> >
> > you'll probably want to have oaddr[] be a static local in
> > update_hash_table_mac_address and use that to delete the old one
> when
> > it
> > differs from the new one, and then copy the new one into the static
> > local.
> > -mike
>
> You can have multiple entries in Hash table for different MAC
> addresses.
> The reason old entry is deleted because it may be possible that hash
> entry
> in the list is skipped but not invalidated so the same entry is made
> valid
> in the list after removing the old one and updating list with new
> entry.
> The calculated has for a particular MAC address is going to be same.
>
> Thanks,
> Ajay Bhargav
Adding to this.. In my case, its the first entry in hash table so I do not need to delete it, I can simply pass NULL in place of oaddr. That change I will make in the updated patch I am going to submit.
Thanks,
Ajay Bhargav
next prev parent reply other threads:[~2011-08-31 5:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 5:44 [U-Boot] [PATCH v4 1/3] net: Adds Fast Ethernet Controller driver for Armada100 Ajay Bhargav
2011-08-30 7:16 ` Marek Vasut
2011-08-30 15:31 ` Mike Frysinger
2011-08-31 5:10 ` Ajay Bhargav
2011-08-31 5:24 ` Ajay Bhargav [this message]
[not found] <261975966.7748.1314700867461.JavaMail.root@ahm.einfochips.com>
2011-08-30 10:46 ` Ajay Bhargav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2032566791.11944.1314768246740.JavaMail.root@ahm.einfochips.com \
--to=ajay.bhargav@einfochips.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.