Skip to contentSkip to conversation

zd1211rw: Support for multicast addresses

PATCH In review Daniel Drake 3 participants 4 messages Dec 1, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zd1211rw: Support for multicast addresses

From: Ulrich Kunitz <[email protected]>

Support for multicast adresses is implemented by supporting the set_multicast_list() function of the network device. Address filtering is supported by a group hash table in the device.

This is based on earlier work by Benoit Papillaut. Fixes multicast packet reception and ipv6 connectivity:
http://bugzilla.kernel.org/show_bug.cgi?id=7424
http://bugzilla.kernel.org/show_bug.cgi?id=7425

---
 zd_chip.c   |   13 +++++++++++++
 zd_chip.h   |   43 ++++++++++++++++++++++++++++++++++++++++++-
 zd_mac.c    |   44 +++++++++++++++++++++++++++++++++++++++++++-
 zd_mac.h    |    3 +++
 zd_netdev.c |    2 +-
 5 files changed, 102 insertions(+), 3 deletions(-)
drivers/net/wireless/zd1211rw/zd_chip.c +13 -0
Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_chip.c
===================================================================
@@ -1673,3 +1673,16 @@ int zd_rfwritev_cr_locked(struct zd_chip
 
 	return 0;
 }
+
+int zd_chip_set_multicast_hash(struct zd_chip *chip,
+	                       struct zd_mc_hash *hash)
+{
+	struct zd_ioreq32 ioreqs[] = {
+		{ CR_GROUP_HASH_P1, hash->low },
+		{ CR_GROUP_HASH_P2, hash->high },
+	};
+
+	dev_dbg_f(zd_chip_dev(chip), "hash l 0x%08x h 0x%08x\n",
+		ioreqs[0].value, ioreqs[1].value);
+	return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs));
+}
drivers/net/wireless/zd1211rw/zd_chip.h +42 -1

56 lines not on this page · raw message

drivers/net/wireless/zd1211rw/zd_mac.c +43 -1

74 lines not on this page · raw message

drivers/net/wireless/zd1211rw/zd_mac.h +3 -0
Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_mac.h
===================================================================
@@ -133,6 +133,8 @@ struct zd_mac {
 	struct iw_statistics iw_stats;
 
 	struct housekeeping housekeeping;
+	struct work_struct set_multicast_hash_work;
+	struct zd_mc_hash multicast_hash;
 	struct work_struct set_rts_cts_work;
 	struct work_struct set_basic_rates_work;
 
@@ -189,6 +191,7 @@ int zd_mac_init_hw(struct zd_mac *mac, u
 int zd_mac_open(struct net_device *netdev);
 int zd_mac_stop(struct net_device *netdev);
 int zd_mac_set_mac_address(struct net_device *dev, void *p);
+void zd_mac_set_multicast_list(struct net_device *netdev);
 
 int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length);
 
drivers/net/wireless/zd1211rw/zd_netdev.c +1 -1
Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_netdev.c
===================================================================
@@ -242,7 +242,7 @@ struct net_device *zd_netdev_alloc(struc
 	netdev->open = zd_mac_open;
 	netdev->stop = zd_mac_stop;
 	/* netdev->get_stats = */
-	/* netdev->set_multicast_list = */
+	netdev->set_multicast_list = zd_mac_set_multicast_list;
 	netdev->set_mac_address = zd_mac_set_mac_address;
 	netdev->wireless_handlers = &iw_handler_def;
 	/* netdev->ethtool_ops = */
#1 lore raw
Quoted 6 lines · On Fri, 1 Dec 2006 00:58:07 +0000 (GMT) Daniel Drake <[email protected]> wrote:

From: Ulrich Kunitz <[email protected]>

Support for multicast adresses is implemented by supporting the set_multicast_list() function of the network device. Address filtering is supported by a group hash table in the device.

Quoted 7 lines

This is based on earlier work by Benoit Papillaut. Fixes multicast packet reception and ipv6 connectivity:
http://bugzilla.kernel.org/show_bug.cgi?id=7424
http://bugzilla.kernel.org/show_bug.cgi?id=7425

Why all the trouble do it off work queue? Is someone calling set_multicast_list with IRQ's disabled?

#2 lore raw
Quoted 2 lines · Stephen Hemminger

Why all the trouble do it off work queue? Is someone calling set_multicast_list with IRQ's disabled?

Register I/O involves sleeping, so we need to be in process context.

in_atomic() returns non-zero in the set_multicast_list handler. I couldn't tell you which codepath this is in.

Daniel

#3 lore raw
Quoted 10 lines · On 06-11-30 20:57 Daniel Drake wrote:
Quoted 2 lines · Stephen Hemminger

Why all the trouble do it off work queue? Is someone calling set_multicast_list with IRQ's disabled?

Register I/O involves sleeping, so we need to be in process context.

in_atomic() returns non-zero in the set_multicast_list handler. I couldn't tell you which codepath this is in.

Daniel

The function dev_mc_upload() (net/core/dev_mcast.c) calls netif_tx_lock_bh() which locks the tx spinlock.

The ZD1211 is a USB chip. Register reads will always require sleeping, if the driver should not spend CPU cycles on polling in atomic mode. One could implement register writes without waiting for completion of the writes, but asynchronous error messages for the writes would make debugging difficult. Additionally hardware register accesses includes setting a firmware lock, which reqires a register read. Given all that the driver is always sleeping in the register access paths. RX and TX paths don't require register access and work in atomic mode.

Signature · 1 line
Uli Kunitz