View | Details | Raw Unified | Return to bug 7424
Collapse All | Expand All

(-)a/zd_chip.c (+13 lines)
Lines 1672-1674 int zd_rfwritev_cr_locked(struct zd_chip Link Here
1672
1672
1673
	return 0;
1673
	return 0;
1674
}
1674
}
1675
1676
int zd_chip_set_multicast_hash(struct zd_chip *chip,
1677
	                       struct zd_mc_hash *hash)
1678
{
1679
	struct zd_ioreq32 ioreqs[] = {
1680
		{ CR_GROUP_HASH_P1, hash->low },
1681
		{ CR_GROUP_HASH_P2, hash->high },
1682
	};
1683
1684
	dev_dbg_f(zd_chip_dev(chip), "hash l 0x%08x h 0x%08x\n",
1685
		ioreqs[0].value, ioreqs[1].value);
1686
	return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs));
1687
}
(-)a/zd_chip.h (-1 / +42 lines)
Lines 395-404 #define CR_MAC_ADDR_P2 CTL_REG(0x0614) Link Here
395
#define CR_BSSID_P1			CTL_REG(0x0618)
395
#define CR_BSSID_P1			CTL_REG(0x0618)
396
#define CR_BSSID_P2			CTL_REG(0x061C)
396
#define CR_BSSID_P2			CTL_REG(0x061C)
397
#define CR_BCN_PLCP_CFG			CTL_REG(0x0620)
397
#define CR_BCN_PLCP_CFG			CTL_REG(0x0620)
398
399
/* Group hash table for filtering incoming packets.
400
 *
401
 * The group hash table is 64 bit large and split over two parts. The first
402
 * part is the lower part. The upper 6 bits of the last byte of the target
403
 * address are used as index. Packets are received if the hash table bit is
404
 * set. This is used for multicast handling, but for broadcasts (address
405
 * ff:ff:ff:ff:ff:ff) the highest bit in the second table must also be set.
406
 */
398
#define CR_GROUP_HASH_P1		CTL_REG(0x0624)
407
#define CR_GROUP_HASH_P1		CTL_REG(0x0624)
399
#define CR_GROUP_HASH_P2		CTL_REG(0x0628)
408
#define CR_GROUP_HASH_P2		CTL_REG(0x0628)
400
#define CR_RX_TIMEOUT			CTL_REG(0x062C)
401
409
410
#define CR_RX_TIMEOUT			CTL_REG(0x062C)
402
/* Basic rates supported by the BSS. When producing ACK or CTS messages, the
411
/* Basic rates supported by the BSS. When producing ACK or CTS messages, the
403
 * device will use a rate in this table that is less than or equal to the rate
412
 * device will use a rate in this table that is less than or equal to the rate
404
 * of the incoming frame which prompted the response */
413
 * of the incoming frame which prompted the response */
Lines 850-853 int zd_chip_handle_signal_strength(struc Link Here
850
859
851
u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status);
860
u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status);
852
861
862
struct zd_mc_hash {
863
	u32 low;
864
	u32 high;
865
};
866
867
static inline void zd_mc_clear(struct zd_mc_hash *hash)
868
{
869
	hash->low = 0;
870
	/* The interfaces must always received broadcasts.
871
	 * The hash of the broadcast address ff:ff:ff:ff:ff:ff is 63.
872
	 */
873
	hash->high = 0x80000000;
874
}
875
876
static inline void zd_mc_add_all(struct zd_mc_hash *hash)
877
{
878
	hash->low = hash->high = 0xffffffff;
879
}
880
881
static inline void zd_mc_add_addr(struct zd_mc_hash *hash, u8 *addr)
882
{
883
	unsigned int i = addr[5] >> 2;
884
	if (i < 32) {
885
		hash->low |= 1 << i;
886
	} else {
887
		hash->high |= 1 << (i-32);
888
	}
889
}
890
891
int zd_chip_set_multicast_hash(struct zd_chip *chip,
892
	                       struct zd_mc_hash *hash);
893
853
#endif /* _ZD_CHIP_H */
894
#endif /* _ZD_CHIP_H */
(-)a/zd_mac.c (-1 / +43 lines)
Lines 37-42 static void housekeeping_init(struct zd_ Link Here
37
static void housekeeping_enable(struct zd_mac *mac);
37
static void housekeeping_enable(struct zd_mac *mac);
38
static void housekeeping_disable(struct zd_mac *mac);
38
static void housekeeping_disable(struct zd_mac *mac);
39
39
40
static void set_multicast_hash_handler(void *mac_ptr);
41
40
int zd_mac_init(struct zd_mac *mac,
42
int zd_mac_init(struct zd_mac *mac,
41
	        struct net_device *netdev,
43
	        struct net_device *netdev,
42
	        struct usb_interface *intf)
44
	        struct usb_interface *intf)
Lines 51-56 int zd_mac_init(struct zd_mac *mac, Link Here
51
	softmac_init(ieee80211_priv(netdev));
53
	softmac_init(ieee80211_priv(netdev));
52
	zd_chip_init(&mac->chip, netdev, intf);
54
	zd_chip_init(&mac->chip, netdev, intf);
53
	housekeeping_init(mac);
55
	housekeeping_init(mac);
56
	INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler,
57
		  mac);
54
	return 0;
58
	return 0;
55
}
59
}
56
60
Lines 132-137 out: Link Here
132
136
133
void zd_mac_clear(struct zd_mac *mac)
137
void zd_mac_clear(struct zd_mac *mac)
134
{
138
{
139
	flush_workqueue(zd_workqueue);
135
	zd_chip_clear(&mac->chip);
140
	zd_chip_clear(&mac->chip);
136
	ZD_ASSERT(!spin_is_locked(&mac->lock));
141
	ZD_ASSERT(!spin_is_locked(&mac->lock));
137
	ZD_MEMCLEAR(mac, sizeof(struct zd_mac));
142
	ZD_MEMCLEAR(mac, sizeof(struct zd_mac));
Lines 245-250 int zd_mac_set_mac_address(struct net_de Link Here
245
	return 0;
250
	return 0;
246
}
251
}
247
252
253
static void set_multicast_hash_handler(void *mac_ptr)
254
{
255
	struct zd_mac *mac = mac_ptr;
256
	struct zd_mc_hash hash;
257
258
	spin_lock_irq(&mac->lock);
259
	hash = mac->multicast_hash;
260
	spin_unlock_irq(&mac->lock);
261
262
	zd_chip_set_multicast_hash(&mac->chip, &hash);
263
}
264
265
void zd_mac_set_multicast_list(struct net_device *dev)
266
{
267
	struct zd_mc_hash hash;
268
	struct zd_mac *mac = zd_netdev_mac(dev);
269
	struct dev_mc_list *mc;
270
	unsigned long flags;
271
272
	if (dev->flags & (IFF_PROMISC|IFF_ALLMULTI)) {
273
		zd_mc_add_all(&hash);
274
	} else {
275
		zd_mc_clear(&hash);
276
		for (mc = dev->mc_list; mc; mc = mc->next) {
277
			dev_dbg_f(zd_mac_dev(mac), "mc addr " MAC_FMT "\n",
278
				  MAC_ARG(mc->dmi_addr));
279
			zd_mc_add_addr(&hash, mc->dmi_addr);
280
		}
281
	}
282
283
	spin_lock_irqsave(&mac->lock, flags);
284
	mac->multicast_hash = hash;
285
	spin_unlock_irqrestore(&mac->lock, flags);
286
	queue_work(zd_workqueue, &mac->set_multicast_hash_work);
287
}
288
248
int zd_mac_set_regdomain(struct zd_mac *mac, u8 regdomain)
289
int zd_mac_set_regdomain(struct zd_mac *mac, u8 regdomain)
249
{
290
{
250
	int r;
291
	int r;
Lines 771-777 static int is_data_packet_for_us(struct Link Here
771
	}
812
	}
772
813
773
	return memcmp(hdr->addr1, netdev->dev_addr, ETH_ALEN) == 0 ||
814
	return memcmp(hdr->addr1, netdev->dev_addr, ETH_ALEN) == 0 ||
774
	       is_multicast_ether_addr(hdr->addr1) ||
815
	       (is_multicast_ether_addr(hdr->addr1) &&
816
		memcmp(hdr->addr3, netdev->dev_addr, ETH_ALEN) != 0) ||
775
	       (netdev->flags & IFF_PROMISC);
817
	       (netdev->flags & IFF_PROMISC);
776
}
818
}
777
819
(-)a/zd_mac.h (+3 lines)
Lines 134-139 struct zd_mac { Link Here
134
	/* Unlocked reading possible */
134
	/* Unlocked reading possible */
135
	struct iw_statistics iw_stats;
135
	struct iw_statistics iw_stats;
136
	struct housekeeping housekeeping;
136
	struct housekeeping housekeeping;
137
	struct work_struct set_multicast_hash_work;
138
	struct zd_mc_hash multicast_hash;
137
	unsigned int stats_count;
139
	unsigned int stats_count;
138
	u8 qual_buffer[ZD_MAC_STATS_BUFFER_SIZE];
140
	u8 qual_buffer[ZD_MAC_STATS_BUFFER_SIZE];
139
	u8 rssi_buffer[ZD_MAC_STATS_BUFFER_SIZE];
141
	u8 rssi_buffer[ZD_MAC_STATS_BUFFER_SIZE];
Lines 174-179 int zd_mac_init_hw(struct zd_mac *mac, u Link Here
174
int zd_mac_open(struct net_device *netdev);
176
int zd_mac_open(struct net_device *netdev);
175
int zd_mac_stop(struct net_device *netdev);
177
int zd_mac_stop(struct net_device *netdev);
176
int zd_mac_set_mac_address(struct net_device *dev, void *p);
178
int zd_mac_set_mac_address(struct net_device *dev, void *p);
179
void zd_mac_set_multicast_list(struct net_device *netdev);
177
180
178
int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length);
181
int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length);
179
182
(-)a/zd_netdev.c (-2 / +1 lines)
Lines 242-248 struct net_device *zd_netdev_alloc(struc Link Here
242
	netdev->open = zd_mac_open;
242
	netdev->open = zd_mac_open;
243
	netdev->stop = zd_mac_stop;
243
	netdev->stop = zd_mac_stop;
244
	/* netdev->get_stats = */
244
	/* netdev->get_stats = */
245
	/* netdev->set_multicast_list = */
245
	netdev->set_multicast_list = zd_mac_set_multicast_list;
246
	netdev->set_mac_address = zd_mac_set_mac_address;
246
	netdev->set_mac_address = zd_mac_set_mac_address;
247
	netdev->wireless_handlers = &iw_handler_def;
247
	netdev->wireless_handlers = &iw_handler_def;
248
	/* netdev->ethtool_ops = */
248
	/* netdev->ethtool_ops = */
249
- 

Return to bug 7424