2023-05-16 09:13:19 +00:00
|
|
|
|
|
|
|
#ifdef __RTOS__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/unaligned.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/jiffies.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#else
|
|
|
|
#include <linux/version.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/net.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/wireless.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "hgicf.h"
|
|
|
|
#include "event.h"
|
|
|
|
|
2023-10-12 23:37:43 +00:00
|
|
|
#define HGIC_EVENT_MAX (16)
|
2023-05-16 09:13:19 +00:00
|
|
|
|
2023-10-12 23:37:43 +00:00
|
|
|
void hgicf_rx_fw_event(struct hgic_fwctrl *ctrl, struct sk_buff *skb)
|
2023-05-16 09:13:19 +00:00
|
|
|
{
|
2023-10-12 23:37:43 +00:00
|
|
|
char drop = 0;
|
2023-05-16 09:13:19 +00:00
|
|
|
char *data = NULL;
|
2023-10-12 23:37:43 +00:00
|
|
|
u32 data_len;
|
2023-05-16 09:13:19 +00:00
|
|
|
u32 evt_id = 0;
|
|
|
|
struct hgic_ctrl_hdr *evt = NULL;
|
2023-10-12 23:37:43 +00:00
|
|
|
struct hgicf_wdev *hg = container_of(ctrl, struct hgicf_wdev, ctrl);
|
2023-05-16 09:13:19 +00:00
|
|
|
|
2023-10-12 23:37:43 +00:00
|
|
|
if (skb == NULL || skb->len < sizeof(struct hgic_ctrl_hdr)) {
|
2023-05-16 09:13:19 +00:00
|
|
|
dev_kfree_skb(skb);
|
2023-10-12 23:37:43 +00:00
|
|
|
return;
|
2023-05-16 09:13:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
evt = (struct hgic_ctrl_hdr *)skb->data;
|
2023-10-12 23:37:43 +00:00
|
|
|
data = (char *)(evt + 1);
|
|
|
|
data_len = skb->len - sizeof(struct hgic_ctrl_hdr);
|
2023-05-16 09:13:19 +00:00
|
|
|
evt_id = HDR_EVTID(evt);
|
|
|
|
|
|
|
|
//hgic_dbg("event id:%d\r\n", evt->event.event_id);
|
|
|
|
switch (evt_id) {
|
|
|
|
case HGIC_EVENT_FWDBG_INFO:
|
2023-10-12 23:37:43 +00:00
|
|
|
drop = 1;
|
|
|
|
printk(data);
|
2023-05-16 09:13:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2023-10-12 23:37:43 +00:00
|
|
|
|
|
|
|
#ifdef __RTOS__
|
|
|
|
hgicf_event(hg, hg->vif->ndev->name, evt_id, data, data_len);
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
#else
|
|
|
|
if (!drop) {
|
|
|
|
if (skb_queue_len(&hg->evt_list) > HGIC_EVENT_MAX) {
|
|
|
|
kfree_skb(skb_dequeue(&hg->evt_list));
|
|
|
|
hgic_err("event list is full (max %d), drop old event\r\n", HGIC_EVENT_MAX);
|
|
|
|
}
|
|
|
|
skb_queue_tail(&hg->evt_list, skb);
|
|
|
|
up(&hg->evt_sema);
|
|
|
|
} else {
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2023-05-16 09:13:19 +00:00
|
|
|
}
|
|
|
|
|