netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Mithlesh Thukral <mithlesh@netxen.com>
Cc: netdev@vger.kernel.org, amitkale@netxen.com, jeff@garzik.org,
	netxenproj@linsyssoft.com, rob@netxen.com
Subject: Re: [PATCH 3/4] NetXen: Add correct routines to setup multicast address
Date: Sun, 10 Jun 2007 11:54:11 +0200	[thread overview]
Message-ID: <200706101154.11746.mb@bu3sch.de> (raw)
In-Reply-To: <200706071134.l57BYbpH007596@dut39.unminc.com>

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.

  reply	other threads:[~2007-06-10  9:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 11:34 [PATCH 3/4] NetXen: Add correct routines to setup multicast address Mithlesh Thukral
2007-06-10  9:54 ` Michael Buesch [this message]
2007-06-10  9:59   ` Michael Buesch
2007-06-13  4:48 ` Dhananjay Phadke
2007-06-13  7:12   ` Mithlesh Thukral

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=200706101154.11746.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=amitkale@netxen.com \
    --cc=jeff@garzik.org \
    --cc=mithlesh@netxen.com \
    --cc=netdev@vger.kernel.org \
    --cc=netxenproj@linsyssoft.com \
    --cc=rob@netxen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).