xf.li | bfc6e71 | 2025-02-07 01:54:34 -0800 | [diff] [blame^] | 1 | #ifndef _DDRNET_H_ |
| 2 | #define _DDRNET_H_ |
| 3 | |
| 4 | #include <linux/interrupt.h> |
| 5 | |
| 6 | #include <linux/netdevice.h> |
| 7 | |
| 8 | #include <linux/kthread.h> |
| 9 | |
| 10 | #include <linux/skbuff.h> |
| 11 | #include <linux/spinlock.h> |
| 12 | #include <linux/semaphore.h> |
| 13 | |
| 14 | #include <linux/soc/zte/rpm/rpmsg.h> |
| 15 | |
| 16 | |
| 17 | #define USE_DDRNET_PACKET |
| 18 | #include "ddrnet_queue.h" |
| 19 | #ifdef USE_DDRNET_PACKET |
| 20 | #define PACKET_SIZE_LIMIT 1000 |
| 21 | #define WRAP_PACKET_THRESHHOLD 10 |
| 22 | #define WRAP_FREE_PACKET_THRESHHOLD 10 |
| 23 | #define DDRNET_PACKET_QUEUE_COUNT 5000//1024 |
| 24 | #define DDRNET_WRAP_TIMER_OUT_MS 10 |
| 25 | #define DDRNET_TRANS_THREDHOLD 50 |
| 26 | |
| 27 | #define WRAP_CONTENT_SIZE 1024 |
| 28 | #define DDRNET_PSB_PACKET_UNIT_SIZE sizeof(struct T_FromExt_mem) |
| 29 | #define DDRNET_SKB_PACKET_UNIT_SIZE sizeof(struct T_ToExt_info) |
| 30 | #endif |
| 31 | struct ddrnet { |
| 32 | struct net_device *net; |
| 33 | |
| 34 | /*lan0 or wan0*/ |
| 35 | unsigned char lan; |
| 36 | |
| 37 | T_ZDrvRpMsg_ActorID actor_id; |
| 38 | T_ZDrvRpMsg_ChID channel_id; |
| 39 | unsigned int channel_size; |
| 40 | |
| 41 | //struct sk_buff_head txq; |
| 42 | struct sk_buff_head rxq; |
| 43 | //struct sk_buff_head done; |
| 44 | |
| 45 | struct task_struct *rcv_thread; /* the receive thread */ |
| 46 | struct task_struct *rel_thread; |
| 47 | #ifdef USE_DDRNET_PACKET |
| 48 | struct task_struct *skb_wrap_thread; |
| 49 | #endif |
| 50 | struct tasklet_struct bh; |
| 51 | #ifdef USE_DDRNET_PACKET |
| 52 | struct ddrnet_queue skb_que; |
| 53 | struct ddrnet_queue skb_que_free; |
| 54 | struct timer_list wrap_timer; |
| 55 | struct semaphore skb_que_sem; |
| 56 | #endif |
| 57 | |
| 58 | }; |
| 59 | #ifdef USE_DDRNET_PACKET |
| 60 | struct ddrnet_package{ |
| 61 | u32 pkg_length; // package length |
| 62 | u8 contents[WRAP_CONTENT_SIZE]; // package contents |
| 63 | }; |
| 64 | s32 ddrnet_skb_pkg_xmit(struct ddrnet * dev, struct ddrnet_package* pkg); |
| 65 | s32 ddrnet_freepsb_pkg_xmit(struct ddrnet_package* pkg); |
| 66 | void ddrnet_skb_Wrap_TimerCallBack(u32 hnd); |
| 67 | void ddrnet_freepsb_Wrap_TimerCallBack(u32 hnd); |
| 68 | s32 ddrnet_skb_wrap_thread(void * __dev); |
| 69 | s32 ddrnet_freepsb_wrap_thread(void); |
| 70 | s32 ddrnet_skb_packet_enqueue(struct ddrnet* dev, struct T_ToExt_info* buf); |
| 71 | s32 ddrnet_freepsb_packet_enqueue(void *addr); |
| 72 | #endif |
| 73 | #endif /* _DDRNET_H_ */ |
| 74 | |