From: Jeff Garzik <jeff@garzik.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: netdev@vger.kernel.org, Edward Hsu <edward_hsu@realtek.com>
Subject: Re: [PATCH 12/12] r8169: mac address change support
Date: Tue, 08 May 2007 00:55:16 -0400 [thread overview]
Message-ID: <464002B4.3040508@garzik.org> (raw)
In-Reply-To: <20070426214942.GM7344@electric-eye.fr.zoreil.com>
Francois Romieu wrote:
> Merged from Realtek's r8169-6.001 driver.
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Edward Hsu <edward_hsu@realtek.com>
> ---
> drivers/net/r8169.c | 32 ++++++++++++++++++++++++++++++++
> 1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index 2667862..5b42176 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
> @@ -182,6 +182,7 @@ static struct {
>
> enum rtl_registers {
> MAC0 = 0, /* Ethernet hardware address. */
> + MAC4 = 4,
> MAR0 = 8, /* Multicast filter. */
> CounterAddrLow = 0x10,
> CounterAddrHigh = 0x14,
> @@ -1391,6 +1392,36 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
> printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
> }
>
> +static void rtl8169_rar_set(struct rtl8169_private *tp, u8 *addr)
> +{
> + void __iomem *ioaddr = tp->mmio_addr;
> + u32 low;
> + u32 high;
> +
> + low = addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24);
> + high = addr[4] | (addr[5] << 8);
> +
> + RTL_W8(Cfg9346, Cfg9346_Unlock);
> + RTL_W32(MAC0, low);
> + RTL_W32(MAC4, high);
> + RTL_W8(Cfg9346, Cfg9346_Lock);
> +}
> +
> +static int rtl8169_set_mac_address(struct net_device *dev, void *p)
> +{
> + struct rtl8169_private *tp = netdev_priv(dev);
> + struct sockaddr *addr = p;
> +
> + if (!is_valid_ether_addr(addr->sa_data))
> + return -EADDRNOTAVAIL;
> +
> + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
> +
> + rtl8169_rar_set(tp, dev->dev_addr);
> +
> + return 0;
> +}
> +
> static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> {
> struct rtl8169_private *tp = netdev_priv(dev);
> @@ -1712,6 +1743,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
> dev->irq = pdev->irq;
> dev->base_addr = (unsigned long) ioaddr;
> dev->change_mtu = rtl8169_change_mtu;
> + dev->set_mac_address = rtl8169_set_mac_address;
Code seems OK, except the register interaction (particularly 9346
lock/unlock) can race with other parts of the code.
Jeff
prev parent reply other threads:[~2007-05-08 4:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070426205714.GA12701@electric-eye.fr.zoreil.com>
2007-04-26 21:47 ` [PATCH 01/12] r8169: add per-device hw_start handler (1/2) Francois Romieu
2007-04-26 21:48 ` [PATCH 02/12] r8169: add per-device hw_start handler (2/2) Francois Romieu
2007-04-26 21:48 ` [PATCH 03/12] r8169: merge with version 6.001.00 of Realtek's r8169 driver Francois Romieu
2007-04-26 21:48 ` [PATCH 04/12] r8169: merge with version 8.001.00 of Realtek's r8168 driver Francois Romieu
2007-04-26 21:48 ` [PATCH 05/12] r8169: confusion between hardware and IP header alignment Francois Romieu
2007-04-26 21:48 ` [PATCH 06/12] r8169: small 8101 comment Francois Romieu
2007-04-26 21:48 ` [PATCH 07/12] r8169: remove the media option Francois Romieu
2007-04-26 21:48 ` [PATCH 08/12] r8169: cleanup Francois Romieu
2007-05-08 4:52 ` Jeff Garzik
2007-04-26 21:49 ` [PATCH 09/12] r8169: MSI support Francois Romieu
2007-05-08 4:53 ` Jeff Garzik
2007-04-26 21:49 ` [PATCH 10/12] r8169: add bit description for the TxPoll register Francois Romieu
2007-04-26 21:49 ` [PATCH 11/12] r8169: align the IP header when there is no DMA constraint Francois Romieu
2007-04-27 4:45 ` Mike Isely
2007-05-08 4:53 ` Jeff Garzik
2007-04-26 21:49 ` [PATCH 12/12] r8169: mac address change support Francois Romieu
2007-05-08 4:55 ` Jeff Garzik [this message]
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=464002B4.3040508@garzik.org \
--to=jeff@garzik.org \
--cc=edward_hsu@realtek.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/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.