summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/main.c
AgeCommit message (Collapse)Author
2008-04-16libertas: convert libertas driver to use an event/cmdresp queueHolger Schurig
This patch (co-developed by Dan Williams and Holger Schurig) uses a kfifo object for events and a swapping buffer scheme for the command response to preserve the zero-copy semantics of the CF driver and keep memory usage low. The main thread should only ever touch the buffer indexed by priv->resp_idx, while the interface code is free to write to the second buffer, then swap priv->resp_idx under the driver spinlock. The firmware specs only permit one in-flight command, so there will only ever be one command response to process at a time. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-08libertas: move association code from scan.c into assoc.cHolger Schurig
Besides code moving, I did the following changes: * made some functions static * removed some unneeded #include's * made patch checkpatch.pl clean Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-08libertas: move association code from join.c into scan.cHolger Schurig
Besides code moving, I did the following changes: * made some functions static * removed some unneeded #include's * made patch checkpatch.pl clean Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-01libertas: don't depend on IEEE80211Holger Schurig
Runtime-wise we only need escape_ssid from the deprecated IEEE80211 subsystem. However, it's easy to provide our own copy. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-01libertas: convert sleep/wake config direct commandsHolger Schurig
Confirm sleep event: they come very regularly, eventually several times per second. Therefore we want to send the config command as fast as possible. The old code pre-set the command in priv->lbs_ps_confirm_sleep. However, the byte sequence to be sent to the hardware is the same for all interfaces. So this patch make this an extern structure, initialized at module load time. Config wake event: normal conversion to a direct command. However, I don't know how to trigger a "HOST AWAKE" event from the firmware, so this part is untested. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-01libertas: convert CMD_802_11_MAC_ADDRESS to a direct commandHolger Schurig
* directly call lbs_cmd_with_response() * only overwrite priv->current_addr once the firmware call succeeded Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-27libertas: kill useless #define LBS_MONITOR_OFF 0Holger Schurig
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-25libertas: remove lots of unused stuffHolger Schurig
This removes many unused function parameters as well as some not-implemented functions, e.g. CMD_802_11_GET_STATS. The silly lbs_set_cmd_ctrl_node() function is now also gone. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-25libertas: misc power saving adjustsHolger Schurig
* firmware for the CF card supports power saving * the driver currenly only accept "iwconfig ethX power on|off", so I fixed what the range wext ioctl reports. * initialize value/flags in lbs_get_power() * get rid of unused parameter psmode in lbs_ps_confirm_sleep() * some minor debug output tweaks Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-25libertas: rename packetfilter to mac_controlHolger Schurig
The CMD_MAC_CONTROL can be used for other things than just filtering packets, e.g. to enable and disable WMM. This uses the same term mac_control for the define, the function and the shadow value in struct lbs_private. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-29libertas: make lbs_sync_channel() staticHolger Schurig
... by moving it into the file where it's sole user resides Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-28libertas: Remove unused exportsRoland Dreier
The libertas driver exports a number of symbols with no in-tree users; remove these unused exports. lbs_reset_device() is completely unused, with no callers at all, so remove the function completely. A couple of these unused exported symbols are static, which causes the following build error on ia64 with gcc 4.2.3: drivers/net/wireless/libertas/main.c:1375: error: __ksymtab_lbs_remove_mesh causes a section type conflict drivers/net/wireless/libertas/main.c:1354: error: __ksymtab_lbs_add_mesh causes a section type conflict Signed-off-by: Roland Dreier <rolandd@cisco.com> Acked-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: pepper main with debug statementHolger Schurig
libertas: re-pepper debug statementThe recent fluff of updates didn't put proper lbs_deb_enter/leave calls into the source code. Add them where appropriate. Also contains some whitespace changes. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: don't blindly try meshHolger Schurig
The CF card only has a very old firmware (5.0.16p0). This firmware doesn't know anything about mesh config. However, current code blindly calls mesh_config when the card is inserted. So check the firmware version before issuing this command. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: remove check for driver_lock in lbs_interrupt()David Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: submit RSSI command on tx timeout, to check whether module is deadDavid Woodhouse
We don't necessarily want to reset the device on a TX timeout. But more often than not, the real cause is that the firmware has crapped itself, not just that the network is busy. So submit any harmless command, and if _that_ times out, then the error handling code will reset the module, as appropriate. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: handle command timeout in main thread instead of directly in timerDavid Woodhouse
And handle the case where it times out more than once, too, instead of locking up for ever. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: store command result in cmdnode instead of priv->cur_cmd_retcodeDavid Woodhouse
... at least for users of __lbs_cmd(). Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill whitespace at end of linesDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: don't exit worker thread until kthread_stop() is calledDavid Woodhouse
The kthread code can't cope with a thread exiting of its own accord and then someone calling kthread_stop() for it. When the thread detects that it needs to die, make it wait for kthread_stop() to be called. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: use spin_is_locked() instead of spin_trylock() in lbs_interrupt()David Woodhouse
We get scary warnings on UP if we use spin_trylock() and find, as we hoped, that the lock in question is already locked. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: pass channel argument directly to lbs_mesh_config()David Woodhouse
There is weirdness here; the firmware seems to refuse to change channels at will. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: cope with both old and new mesh TLV valuesDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: add ethtool support for wake-on-lan configurationDavid Woodhouse
Also, check that suspend is refused if HOST_SLEEP_CFG hasn't been done. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: implement suspend and resume core methodsDavid Woodhouse
We (ab)use priv->fw_ready to stop the worker thread from sending more commands or data after the response to the HOST_SLEEP_ACTIVATE command comes in. And we set it from the callback function _directly_ to ensure that the worker thread sees it immediately; if we did it in lbs_suspend() after waking up, that might be too late. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: make worker thread not freezableDavid Woodhouse
We want it to send the HOST_SLEEP_ACTIVATE command on the way down... Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: slight cleanup of netif queue stop/wakeDavid Woodhouse
In particular, we shouldn't be waking the queues in lbs_host_to_card_done() any more. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: be more careful about command responses matching cur_cmdDavid Woodhouse
Especially in the light of OLPC trac #5461, in which the firmware starts sending us seemingly random command responses which bear little relation to the command we sent it. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill references to mesh autostartDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: add lbs_mesh sysfs attribute for enabling meshDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: make some more functions staticDavid Woodhouse
sparse was getting on my tits. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: convert DATA_RATE to a direct commandDan Williams
Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: convert CMD_MESH_ACCESS to a direct commandDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: rename and re-type bufvirtualaddr to cmdbufDan Williams
Make it a struct cmd_header, since that's what it is, and clean up the places that it's used. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: move removal of lbs_rtap file to lbs_stop_card()David Woodhouse
This prevents us from trying to remove it when it didn't exist, in the error case. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: convert GET_HW_SPEC to a direct commandDan Williams
Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: don't run thread while firmware not yet readyDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: make rtap and normal modes mutually exclusive, clean up open/stopDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: remove pre_open_check()David Woodhouse
The firmware is always initialised before we register the netdevices. It's not possible for pre_open_check() to fail. One day we might try loading firmware in ->open(), but still it won't be just a _check_, like this. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: clean up lbs_interrupt()David Woodhouse
Make it take struct lbs_private as argument; that's all it wants anyway, and all callers were starting off from that. Don't wake the netif queues, because those should be handled elsewhere. And sort out the locking, with a big nasty warning for those who don't have the driver_lock locked when they call it. Oh, and fix if_cs.c to lock the driver_lock before calling it. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: Move actual transmission to main threadDavid Woodhouse
The locking issues with TX, especially TX from multiple netdevs, get _so_ much easier if you do it like this. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: refactor the 'should I sleep?' decision in lbs_thread()David Woodhouse
This was making my brain hurt. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: set dev_addr on rtap deviceDavid Woodhouse
This lets us bring it up, because eth_validate_addr() succeeds instead of returning -EINVAL. And finally monitor mode seems to (mostly) work. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: stop using ieee80211 for radiotap deviceDavid Woodhouse
There seems to be no point in doing it as an ieee80211 device instead of a normal netdev, and when we override its ->priv and then call free_ieee80211() it has a distressing tendency to crash horribly. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill lbs_pre_start_xmit(), lib_mesh_pre_start_xmit()David Woodhouse
These wrappers only do two things. Firstly, they set the frame type, which isn't necessary since lbs_hard_start_xmit() gets to see which device it belongs to anyway. Secondly, they return -EOPNOTSUPP if the device is in monitor mode. Which is a strange thing to do and will provide nasty warnings from qdisc_restart(). And lbs_hard_start_xmit() seems to have code to cope with monitor mode anyway. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: move lbs_hard_start_xmit() into tx.cDavid Woodhouse
... where it can shortly be merged with lbs_process_tx()... Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill internal tx queue for PS modeDavid Woodhouse
It was buggy as hell anyway, since it was just spewing packets at the device when it wasn't necessarily ready for them (in the USB case, while the URB was still busy). We could probably do with a better way of flushing packets to the device _immediately_, before we stick it back into sleep mode. But we can no longer just dequeue packets directly, it seems. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: use lbs_host_to_card_done() in lbs_tx_timeout()David Woodhouse
Also attempt some locking in lbs_host_to_card_done() Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill struct lbs_adapterDavid Woodhouse
There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28libertas: kill TxLockFlagDavid Woodhouse
We don't need this. We can use adapter->currenttxskb instead. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>