o80211s: (zd1211rw-mac80211) support for mesh interface
PATCH 4/4 o80211s: (zd1211rw-mac80211) support for mesh interface
This patch adds mesh interface support to the zd1211rw-mac80211 driver.
The previously unused CR_CAM_MODE register is set to MODE_AP_WDS. This makes the driver ack mesh (WDS) frames. It does not affect Infra functionality of the driver.
Previously missing beaconing support has been added. This might also help implement a currently missing ah-hoc mode.
Support for interrupts from the device have been added, but we are not handling most of them.
Mesh interfaces are considered associated as long as the interface is up.
--- drivers/net/wireless/zd1211rw-mac80211/zd_chip.c | 1 + drivers/net/wireless/zd1211rw-mac80211/zd_chip.h | 8 +++ drivers/net/wireless/zd1211rw-mac80211/zd_mac.c | 72 +++++++++++++++++++++- drivers/net/wireless/zd1211rw-mac80211/zd_mac.h | 3 + drivers/net/wireless/zd1211rw-mac80211/zd_usb.c | 11 +++- 5 files changed, 92 insertions(+), 3 deletions(-)
drivers/net/wireless/zd1211rw-mac80211/zd_chip.c +1 -0
@@ -806,6 +806,7 @@ static int hw_init_hmac(struct zd_chip *chip) { CR_AFTER_PNP, 0x1 }, { CR_WEP_PROTECT, 0x114 }, { CR_IFS_VALUE, IFS_VALUE_DEFAULT }, + { CR_CAM_MODE, MODE_AP_WDS}, };ZD_ASSERT (mutex_is_locked (&chip->mutex));
drivers/net/wireless/zd1211rw-mac80211/zd_chip.h +8 -0
@@ -486,6 +486,7 @@ enum {#define CR_RX_OFFSET CTL_REG(0x065c) +#define CR_BCN_LENGTH CTL_REG(0x0664)#define CR_PHY_DELAY CTL_REG(0x066C)#define CR_BCN_FIFO CTL_REG(0x0670)#define CR_SNIFFER_ON CTL_REG(0x0674)
@@ -542,6 +543,8 @@ enum {#define RX_FILTER_CTRL (RX_FILTER_RTS | RX_FILTER_CTS | \ RX_FILTER_CFEND | RX_FILTER_CFACK) +#define BCN_MODE_IBSS 0x2000000 +/* Monitor mode sets filter to 0xfffff */ #define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690)
@@ -575,6 +578,11 @@ enum {/* CAM: Continuous Access Mode (power management) */ #define CR_CAM_MODE CTL_REG(0x0700) +#define MODE_IBSS 0x0 +#define MODE_AP 0x1 +#define MODE_STA 0x2 +#define MODE_AP_WDS 0x3 +#define CR_CAM_ROLL_TB_LOW CTL_REG(0x0704)#define CR_CAM_ROLL_TB_HIGH CTL_REG(0x0708)#define CR_CAM_ADDRESS CTL_REG(0x070C)
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +71 -1
104 lines not on this page · raw message
drivers/net/wireless/zd1211rw-mac80211/zd_mac.h +3 -0
@@ -169,12 +169,15 @@ struct zd_tx_skb_control_block {struct zd_mac {struct zd_chip chip;spinlock_t lock; +spinlock_t intr_lock;struct ieee80211_hw *hw;struct housekeeping housekeeping;struct work_struct set_multicast_hash_work;struct work_struct set_rts_cts_work;struct work_struct set_rx_filter_work; +struct work_struct process_intr;struct zd_mc_hash multicast_hash; +u8 intr_buffer[USB_MAX_EP_INT_BUFFER ];u8 regdomain;u8 default_regdomain;int type;
drivers/net/wireless/zd1211rw-mac80211/zd_usb.c +9 -2
@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(usb, usb_ids);#define FW_ZD1211B_PREFIX "zd1211/zd1211b_"/* USB device initialization */ +static void int_urb_complete (struct urb *urb);static int request_fw_file (const struct firmware **fw,const char *name,struct device *device)
@@ -331,11 +332,18 @@ static inline void handle_regs_int(struct urb *urb)struct zd_usb *usb = urb->context;struct zd_usb_interrupt *intr = &usb->intr;int len; +u16 int_num;ZD_ASSERT (in_interrupt ());spin_lock (&intr->lock); -if (intr->read_regs_enabled) { + int_num =le16_to_cpu (*(u16 *)(urb->transfer_buffer+2 )); +if (int_num ==CR_INTERRUPT ) { +struct zd_mac *mac =zd_hw_mac (zd_usb_to_hw (urb->context)); +memcpy (&mac->intr_buffer, urb->transfer_buffer, +USB_MAX_EP_INT_BUFFER ); +schedule_work (&mac->process_intr); + }else if (intr->read_regs_enabled) { intr->read_regs.length = len = urb->actual_length;if (len >sizeof (intr->read_regs.buffer))
@@ -346,7 +354,6 @@ static inline void handle_regs_int(struct urb *urb) goto out; } -dev_dbg_f (urb_dev (urb),"regs interrupt ignored\n" ); out:spin_unlock (&intr->lock); }
Signature · 1 line
1.5.2.5
Johannes Berg
maintainerdrivers/net/wireless/zd1211rw-mac80211/zd_chip.c static int hw_init_hmac(struct zd_chip *chip) · line 809
Quoted 2 lines
drivers/net/wireless/zd1211rw-mac80211/zd_chip.c +1
-0+ { CR_CAM_MODE, MODE_AP_WDS},
Shouldn't that depend on the interface type? I.e. set it for WDS/MESH but clear it for station so that the station won't ack WDS frames? OTOH, it may just as well ack WDS frames for itself...
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, · line 777
Quoted 1 line
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +1
-0+ associated = true ;
too much whitespace
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, · line 781
Quoted 3 lines
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +3
-0+zd_mac_config_beacon (hw, conf->beacon); +kfree_skb (conf->beacon); +zd_set_beacon_interval (&mac->chip,BCN_MODE_IBSS |100 );
Does that mean you're hardcoding the beacon interval here while before you confused me how we should handle that setting in userspace? :)
johannes
Quoted 5 lines · Johannes Berg
drivers/net/wireless/zd1211rw-mac80211/zd_chip.c static int hw_init_hmac(struct zd_chip *chip) · line 809
Quoted 1 line
drivers/net/wireless/zd1211rw-mac80211/zd_chip.c +1
-0+ { CR_CAM_MODE, MODE_AP_WDS},Shouldn't that depend on the interface type? I.e. set it for WDS/MESH but clear it for station so that the station won't ack WDS frames? OTOH, it may just as well ack WDS frames for itself...
Yes, it doesn't look like it does any harm.
Quoted 7 lines
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, · line 781
Quoted 4 lines
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +3
-0+zd_mac_config_beacon (hw, conf->beacon); +kfree_skb (conf->beacon); +zd_set_beacon_interval (&mac->chip,BCN_MODE_IBSS |100 );Does that mean you're hardcoding the beacon interval here while before you confused me how we should handle that setting in userspace? :)
I am not sure what are you referring to... anyway, by now I think it's fine to hard code the beacon interval, but in mac80211 instead of the driver adding a beacon_int field to ieee80211_if_conf.
Signature · 2 lines
Luis Carlos Cobo Rus GnuPG ID: 44019B60 cozybit Inc.
Johannes Berg
maintainerQuoted 6 lines
Quoted 4 lines
Shouldn't that depend on the interface type? I.e. set it for WDS/MESH but clear it for station so that the station won't ack WDS frames? OTOH, it may just as well ack WDS frames for itself...
Yes, it doesn't look like it does any harm.
Yeah, makes sense.
Quoted 8 lines
Quoted 4 lines
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, · line 781
Quoted 1 line
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +1
-0+zd_set_beacon_interval (&mac->chip,BCN_MODE_IBSS |100 );Does that mean you're hardcoding the beacon interval here while before you confused me how we should handle that setting in userspace? :)
I am not sure what are you referring to... anyway, by now I think it's fine to hard code the beacon interval, but in mac80211 instead of the driver adding a
beacon_intfield toieee80211_if_conf.
Well that | 100 looks like it'd be a beacon interval in the lower N bits of the value that's set there.
johannes
Quoted 9 lines · Johannes Berg
Quoted 6 lines
Quoted 2 lines
Does that mean you're hardcoding the beacon interval here while before you confused me how we should handle that setting in userspace? :)
I am not sure what are you referring to... anyway, by now I think it's fine to hard code the beacon interval, but in mac80211 instead of the driver adding a
beacon_intfield toieee80211_if_conf.Well that | 100 looks like it'd be a beacon interval in the lower N bits of the value that's set there.
Yes, it is, and I agree it should be moved up to mac80211. What I meant is that I do not remember saying anything about how to handle that setting in user space (and thus I don't know when I confused you).
Signature · 2 lines
Luis Carlos Cobo Rus GnuPG ID: 44019B60 cozybit Inc.
Johannes Berg
maintainerQuoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Does that mean you're hardcoding the beacon interval here while before you confused me how we should handle that setting in userspace? :)
I am not sure what are you referring to... anyway, by now I think it's fine to hard code the beacon interval, but in mac80211 instead of the driver adding a
beacon_intfield toieee80211_if_conf.
Quoted 6 lines
Quoted 2 lines
Well that | 100 looks like it'd be a beacon interval in the lower N bits of the value that's set there.
Yes, it is, and I agree it should be moved up to mac80211. What I meant is that I do not remember saying anything about how to handle that setting in user space (and thus I don't know when I confused you).
Ah, from userspace, yeah, that's a whole different issue.
johannes