|
@@ -41,12 +41,6 @@ struct evt_entry {
|
|
|
int size;
|
|
|
};
|
|
|
|
|
|
-static void __gdm_wimax_event_send(struct work_struct *work);
|
|
|
-static inline struct evt_entry *alloc_event_entry(void);
|
|
|
-static inline void free_event_entry(struct evt_entry *e);
|
|
|
-static struct evt_entry *get_event_entry(void);
|
|
|
-static void put_event_entry(struct evt_entry *e);
|
|
|
-
|
|
|
static struct {
|
|
|
int ref_cnt;
|
|
|
struct sock *sock;
|
|
@@ -58,9 +52,6 @@ static struct {
|
|
|
|
|
|
static u8 gdm_wimax_macaddr[6] = {0x00, 0x0a, 0x3b, 0xf0, 0x01, 0x30};
|
|
|
|
|
|
-static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm);
|
|
|
-static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up);
|
|
|
-
|
|
|
static const char *get_protocol_name(u16 protocol)
|
|
|
{
|
|
|
static char buf[32];
|
|
@@ -190,6 +181,37 @@ static inline int gdm_wimax_header(struct sk_buff **pskb)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static inline struct evt_entry *alloc_event_entry(void)
|
|
|
+{
|
|
|
+ return kmalloc(sizeof(struct evt_entry), GFP_ATOMIC);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void free_event_entry(struct evt_entry *e)
|
|
|
+{
|
|
|
+ kfree(e);
|
|
|
+}
|
|
|
+
|
|
|
+static struct evt_entry *get_event_entry(void)
|
|
|
+{
|
|
|
+ struct evt_entry *e;
|
|
|
+
|
|
|
+ if (list_empty(&wm_event.freeq)) {
|
|
|
+ e = alloc_event_entry();
|
|
|
+ } else {
|
|
|
+ e = list_entry(wm_event.freeq.next, struct evt_entry, list);
|
|
|
+ list_del(&e->list);
|
|
|
+ }
|
|
|
+
|
|
|
+ return e;
|
|
|
+}
|
|
|
+
|
|
|
+static void put_event_entry(struct evt_entry *e)
|
|
|
+{
|
|
|
+ BUG_ON(!e);
|
|
|
+
|
|
|
+ list_add_tail(&e->list, &wm_event.freeq);
|
|
|
+}
|
|
|
+
|
|
|
static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,
|
|
|
int len)
|
|
|
{
|
|
@@ -204,6 +226,30 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,
|
|
|
gdm_wimax_send(nic, msg, len);
|
|
|
}
|
|
|
|
|
|
+static void __gdm_wimax_event_send(struct work_struct *work)
|
|
|
+{
|
|
|
+ int idx;
|
|
|
+ unsigned long flags;
|
|
|
+ struct evt_entry *e;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&wm_event.evt_lock, flags);
|
|
|
+
|
|
|
+ while (!list_empty(&wm_event.evtq)) {
|
|
|
+ e = list_entry(wm_event.evtq.next, struct evt_entry, list);
|
|
|
+ spin_unlock_irqrestore(&wm_event.evt_lock, flags);
|
|
|
+
|
|
|
+ if (sscanf(e->dev->name, "wm%d", &idx) == 1)
|
|
|
+ netlink_send(wm_event.sock, idx, 0, e->evt_data,
|
|
|
+ e->size);
|
|
|
+
|
|
|
+ spin_lock_irqsave(&wm_event.evt_lock, flags);
|
|
|
+ list_del(&e->list);
|
|
|
+ put_event_entry(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ spin_unlock_irqrestore(&wm_event.evt_lock, flags);
|
|
|
+}
|
|
|
+
|
|
|
static int gdm_wimax_event_init(void)
|
|
|
{
|
|
|
if (!wm_event.ref_cnt) {
|
|
@@ -249,61 +295,6 @@ static void gdm_wimax_event_exit(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline struct evt_entry *alloc_event_entry(void)
|
|
|
-{
|
|
|
- return kmalloc(sizeof(struct evt_entry), GFP_ATOMIC);
|
|
|
-}
|
|
|
-
|
|
|
-static inline void free_event_entry(struct evt_entry *e)
|
|
|
-{
|
|
|
- kfree(e);
|
|
|
-}
|
|
|
-
|
|
|
-static struct evt_entry *get_event_entry(void)
|
|
|
-{
|
|
|
- struct evt_entry *e;
|
|
|
-
|
|
|
- if (list_empty(&wm_event.freeq)) {
|
|
|
- e = alloc_event_entry();
|
|
|
- } else {
|
|
|
- e = list_entry(wm_event.freeq.next, struct evt_entry, list);
|
|
|
- list_del(&e->list);
|
|
|
- }
|
|
|
-
|
|
|
- return e;
|
|
|
-}
|
|
|
-
|
|
|
-static void put_event_entry(struct evt_entry *e)
|
|
|
-{
|
|
|
- BUG_ON(!e);
|
|
|
-
|
|
|
- list_add_tail(&e->list, &wm_event.freeq);
|
|
|
-}
|
|
|
-
|
|
|
-static void __gdm_wimax_event_send(struct work_struct *work)
|
|
|
-{
|
|
|
- int idx;
|
|
|
- unsigned long flags;
|
|
|
- struct evt_entry *e;
|
|
|
-
|
|
|
- spin_lock_irqsave(&wm_event.evt_lock, flags);
|
|
|
-
|
|
|
- while (!list_empty(&wm_event.evtq)) {
|
|
|
- e = list_entry(wm_event.evtq.next, struct evt_entry, list);
|
|
|
- spin_unlock_irqrestore(&wm_event.evt_lock, flags);
|
|
|
-
|
|
|
- if (sscanf(e->dev->name, "wm%d", &idx) == 1)
|
|
|
- netlink_send(wm_event.sock, idx, 0, e->evt_data,
|
|
|
- e->size);
|
|
|
-
|
|
|
- spin_lock_irqsave(&wm_event.evt_lock, flags);
|
|
|
- list_del(&e->list);
|
|
|
- put_event_entry(e);
|
|
|
- }
|
|
|
-
|
|
|
- spin_unlock_irqrestore(&wm_event.evt_lock, flags);
|
|
|
-}
|
|
|
-
|
|
|
static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size)
|
|
|
{
|
|
|
struct evt_entry *e;
|
|
@@ -433,6 +424,22 @@ static int gdm_wimax_set_mac_addr(struct net_device *dev, void *p)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up)
|
|
|
+{
|
|
|
+ u16 buf[32 / sizeof(u16)];
|
|
|
+ struct hci_s *hci = (struct hci_s *)buf;
|
|
|
+ unsigned char up_down;
|
|
|
+
|
|
|
+ up_down = if_up ? WIMAX_IF_UP : WIMAX_IF_DOWN;
|
|
|
+
|
|
|
+ /* Indicate updating fsm */
|
|
|
+ hci->cmd_evt = cpu_to_be16(WIMAX_IF_UPDOWN);
|
|
|
+ hci->length = cpu_to_be16(sizeof(up_down));
|
|
|
+ hci->data[0] = up_down;
|
|
|
+
|
|
|
+ gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
|
|
|
+}
|
|
|
+
|
|
|
static int gdm_wimax_open(struct net_device *dev)
|
|
|
{
|
|
|
struct nic *nic = netdev_priv(dev);
|
|
@@ -515,6 +522,20 @@ static void gdm_wimax_cleanup_ioctl(struct net_device *dev)
|
|
|
kdelete(&nic->sdk_data[i].buf);
|
|
|
}
|
|
|
|
|
|
+static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm)
|
|
|
+{
|
|
|
+ u16 buf[32 / sizeof(u16)];
|
|
|
+ struct hci_s *hci = (struct hci_s *)buf;
|
|
|
+
|
|
|
+ /* Indicate updating fsm */
|
|
|
+ hci->cmd_evt = cpu_to_be16(WIMAX_FSM_UPDATE);
|
|
|
+ hci->length = cpu_to_be16(sizeof(struct fsm_s));
|
|
|
+ memcpy(&hci->data[0], fsm, sizeof(struct fsm_s));
|
|
|
+
|
|
|
+ gdm_wimax_event_send(dev, (char *)hci,
|
|
|
+ HCI_HEADER_SIZE + sizeof(struct fsm_s));
|
|
|
+}
|
|
|
+
|
|
|
static void gdm_update_fsm(struct net_device *dev, struct fsm_s *new_fsm)
|
|
|
{
|
|
|
struct nic *nic = netdev_priv(dev);
|
|
@@ -789,36 +810,6 @@ static void gdm_wimax_transmit_pkt(struct net_device *dev, char *buf, int len)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm)
|
|
|
-{
|
|
|
- u16 buf[32 / sizeof(u16)];
|
|
|
- struct hci_s *hci = (struct hci_s *)buf;
|
|
|
-
|
|
|
- /* Indicate updating fsm */
|
|
|
- hci->cmd_evt = cpu_to_be16(WIMAX_FSM_UPDATE);
|
|
|
- hci->length = cpu_to_be16(sizeof(struct fsm_s));
|
|
|
- memcpy(&hci->data[0], fsm, sizeof(struct fsm_s));
|
|
|
-
|
|
|
- gdm_wimax_event_send(dev, (char *)hci,
|
|
|
- HCI_HEADER_SIZE + sizeof(struct fsm_s));
|
|
|
-}
|
|
|
-
|
|
|
-static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up)
|
|
|
-{
|
|
|
- u16 buf[32 / sizeof(u16)];
|
|
|
- struct hci_s *hci = (struct hci_s *)buf;
|
|
|
- unsigned char up_down;
|
|
|
-
|
|
|
- up_down = if_up ? WIMAX_IF_UP : WIMAX_IF_DOWN;
|
|
|
-
|
|
|
- /* Indicate updating fsm */
|
|
|
- hci->cmd_evt = cpu_to_be16(WIMAX_IF_UPDOWN);
|
|
|
- hci->length = cpu_to_be16(sizeof(up_down));
|
|
|
- hci->data[0] = up_down;
|
|
|
-
|
|
|
- gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
|
|
|
-}
|
|
|
-
|
|
|
static void rx_complete(void *arg, void *data, int len)
|
|
|
{
|
|
|
struct nic *nic = arg;
|