[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200706101154.11746.mb@bu3sch.de>
Date: Sun, 10 Jun 2007 11:54:11 +0200
From: Michael Buesch <mb@...sch.de>
To: Mithlesh Thukral <mithlesh@...xen.com>
Cc: netdev@...r.kernel.org, amitkale@...xen.com, jeff@...zik.org,
netxenproj@...syssoft.com, rob@...xen.com
Subject: Re: [PATCH 3/4] NetXen: Add correct routines to setup multicast address
On Thursday 07 June 2007 13:34:37 Mithlesh Thukral wrote:
> NetXen: Add multi cast filter code
> This patch adds multi cast filter code to NetXen NIC driver.
> It also adds capabilities to setup the multicast address in hardware
> from the host side.
> +int netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter)
> +{
> + u32 val = 0;
> + memcpy(&val, adapter->mac_addr, 3);
Broken on BigEndian architectures.
> + netxen_crb_writelit_adapter(adapter, NETXEN_UNICAST_ADDR(port,1), val);
> +
> + memcpy(&val, adapter->mac_addr+3, 3);
Broken on BigEndian architectures.
> + netxen_crb_writelit_adapter(adapter, NETXEN_UNICAST_ADDR(port,1) + 4,
> + val);
> +
> + adapter->mc_enabled = 1;
> + return 0;
> +}
> +
> +int netxen_nic_disable_mcast_filter(struct netxen_adapter *adapter)
> +{
> + u32 val = 0;
> + u16 port = physical_port[adapter->portnum];
> +
> + if(!adapter->mc_enabled)
> + return 0;
> +
> + netxen_crb_writelit_adapter(adapter, NETXEN_MAC_ADDR_CNTL_REG, val);
> +
> + memcpy(&val, adapter->mac_addr, 3);
Broken on BigEndian architectures.
> + netxen_crb_writelit_adapter(adapter, NETXEN_UNICAST_ADDR(port,0), val);
> +
> + memcpy(&val, adapter->mac_addr+3, 3);
Broken on BigEndian architectures.
> + netxen_crb_writelit_adapter(adapter, NETXEN_UNICAST_ADDR(port,0) + 4,
> + val);
> +
> + adapter->mc_enabled = 0;
> + return 0;
> +}
> +
> +#define NETXEN_MCAST_ADDR(port, index) \
> + (NETXEN_MULTICAST_ADDR_BASE+(port*0x80)+(index*8))
> +
> +int netxen_nic_set_mcast_addr(struct netxen_adapter *adapter, int index,
> + u8 *addr)
> +{
> + u32 hi = 0;
> + u32 lo = 0;
> + u16 port = physical_port[adapter->portnum];
> +
> + hi = (u32) addr[0] |
> + ((u32) addr[1] << 8) |
> + ((u32) addr[2] << 16);
> + lo = (u32) addr[3] |
> + ((u32) addr[4] << 8) |
> + ((u32) addr[5] << 16);
That is the correct solution. Do that above, too.
> + netxen_crb_writelit_adapter(adapter, NETXEN_MCAST_ADDR(port,index), hi);
> + netxen_crb_writelit_adapter(adapter, NETXEN_MCAST_ADDR(port,index) + 4,
> + hi);
> + return 0;
> +}
--
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists