Linux Kernel
3.7.1
|
#include <stdarg.h>
#include "i2400m.h"
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/wimax/i2400m.h>
#include <linux/export.h>
#include <linux/moduleparam.h>
#include "debug-levels.h"
Go to the source code of this file.
Data Structures | |
struct | i2400m_cmd_enter_power_save |
Macros | |
#define | D_SUBMODULE control |
Enumerations | |
enum | { I2400M_WAKEUP_ENABLED = 0x01, I2400M_WAKEUP_DISABLED = 0x02, I2400M_TLV_TYPE_WAKEUP_MODE = 144 } |
enum | { I2400M_TLV_DETAILED_DEVICE_INFO = 140 } |
enum | { I2400M_HDIv_MAJOR = 9, I2400M_HDIv_MINOR = 1, I2400M_HDIv_MINOR_2 = 2 } |
Variables | |
struct i2400m_cmd_enter_power_save | __packed |
anonymous enum |
anonymous enum |
anonymous enum |
EXPORT_SYMBOL_GPL | ( | i2400m_cmd_enter_powersave | ) |
i2400m_dev_initialize - Initialize the device once communications are ready
: device descriptor
Returns: 0 if ok, < 0 errno code on error.
Configures the device to work the way we like it.
At the point of this call, the device is registered with the WiMAX and netdev stacks, firmware is uploaded and we can talk to the device normally.
i2400m_dev_shutdown - Shutdown a running device
: device descriptor
Release resources acquired during the running of the device; in theory, should also tell the device to go to sleep, switch off the radio, all that, but at this point, in most cases (driver disconnection, reset handling) we can't even talk to the device.
i2400m_firmware_check - check firmware versions are compatible with the driver
: device descriptor
Returns: 0 if ok, < 0 errno code an error and a message in the kernel log.
Long function, but quite simple; first chunk launches the command and double checks the reply for the right TLV. Then we process the TLV (where the meat is).
Once we process the TLV that gives us the firmware's interface version, we encode it and save it in i2400m->fw_version for future reference.
i2400m_get_device_info - Query the device for detailed device information
: device descriptor
Returns: an skb whose skb->data points to a 'struct i2400m_tlv_detailed_device_info'. When done, kfree_skb() it. The skb is guaranteed to contain the whole TLV data structure.
On error, IS_ERR(skb) is true and ERR_PTR(skb) is the error code.
i2400m_msg_to_dev - Send a control message to the device and get a response
: device descriptor
: an skb *
: pointer to the buffer containing the message to be sent; it has to start with a &struct i2400M_l3l4_hdr and then followed by the payload. Once this function returns, the buffer can be reused.
: buffer size
Returns:
Pointer to skb containing the ack message. You need to check the pointer with IS_ERR(), as it might be an error code. Error codes could happen because:
The returned skb has been allocated with wimax_msg_to_user_alloc(), it contains the response in a netlink attribute and is ready to be passed up to user space with wimax_msg_to_user_send(). To access the payload and its length, use wimax_msg_{data,len}() on the skb.
The skb has to be freed with kfree_skb() once done.
Description:
This function delivers a message/command to the device and waits for an ack to be received. The format is described in linux/wimax/i2400m.h. In summary, a command/get/set is followed by an ack.
This function will not check the ack status, that's left up to the caller. Once done with the ack skb, it has to be kfree_skb()ed.
The i2400m handles only one message at the same time, thus we need the mutex to exclude other players.
We write the message and then wait for an answer to come back. The RX path intercepts control messages and handles them in i2400m_rx_ctl(). Reports (notifications) are (maybe) processed locally and then forwarded (as needed) to user space on the WiMAX stack message pipe. Acks are saved and passed back to us through an skb in i2400m->ack_skb which is ready to be given to generic netlink if need be.
i2400m_set_idle_timeout - Set the device's idle mode timeout
: i2400m device descriptor
: milliseconds for the timeout to enter idle mode. Between 100 to 300000 (5m); 0 to disable. In increments of 100.
After this of the link being idle (no data being sent or received), the device will negotiate with the basestation entering idle mode for saving power. The connection is maintained, but getting out of it (done in tx.c) will require some negotiation, possible crypto re-handshake and a possible DHCP re-lease.
Only available if fw_version >= 0x00090002.
Returns: 0 if ok, < 0 errno code on error.
module_param_named | ( | idle_mode_disabled | , |
i2400m_idle_mode_disabled | , | ||
int | , | ||
0644 | |||
) |
module_param_named | ( | power_save_disabled | , |
i2400m_power_save_disabled | , | ||
int | , | ||
0644 | |||
) |
module_param_named | ( | passive_mode | , |
i2400m_passive_mode | , | ||
int | , | ||
0644 | |||
) |
MODULE_PARM_DESC | ( | idle_mode_disabled | , |
"If | true, | ||
the device will not enable idle mode negotiation""with the base station(when connected) to save power." | |||
) |
MODULE_PARM_DESC | ( | power_save_disabled | , |
"If | true, | ||
the driver will not tell the device to enter""power saving mode when it reports it is ready for it.""False by default(so the device is told to do power""saving)." | |||
) |
MODULE_PARM_DESC | ( | passive_mode | , |
"If | true, | ||
the driver will not do any device setup""and leave it up to user | space, | ||
who must be properly""setup." | |||
) |