blob: bbc8aab338b50138a9cd40bf6acd658aa924302b [file] [log] [blame]
Sage Ahn247e9cf2012-05-15 13:20:36 +09001/*
2 * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
Ben Chanbbd500d2014-06-30 22:13:17 -070014#ifndef __GDM72XX_GDM_QOS_H__
15#define __GDM72XX_GDM_QOS_H__
Sage Ahn247e9cf2012-05-15 13:20:36 +090016
17#include <linux/types.h>
18#include <linux/usb.h>
19#include <linux/list.h>
20
Macpaul Lin13b26632012-09-11 15:55:31 +080021#define QOS_MAX 16
22#define IPTYPEOFSERVICE 0x8000
23#define PROTOCOL 0x4000
24#define IPMASKEDSRCADDRESS 0x2000
25#define IPMASKEDDSTADDRESS 0x1000
Sage Ahn247e9cf2012-05-15 13:20:36 +090026#define PROTOCOLSRCPORTRANGE 0x800
27#define PROTOCOLDSTPORTRANGE 0x400
Macpaul Lin13b26632012-09-11 15:55:31 +080028#define DSTMACADDR 0x200
29#define SRCMACADDR 0x100
30#define ETHERTYPE 0x80
Sage Ahn247e9cf2012-05-15 13:20:36 +090031#define IEEE802_1DUSERPRIORITY 0x40
Macpaul Lin13b26632012-09-11 15:55:31 +080032#define IEEE802_1QVLANID 0x10
Sage Ahn247e9cf2012-05-15 13:20:36 +090033
34struct gdm_wimax_csr_s {
Ben Chan8fea7d02014-06-27 23:17:25 -070035 bool enabled;
Ben Chanc047b442014-06-27 23:17:27 -070036 u32 sfid;
Macpaul Lin13b26632012-09-11 15:55:31 +080037 u8 qos_buf_count;
38 u16 classifier_rule_en;
39 u8 ip2s_lo;
40 u8 ip2s_hi;
41 u8 ip2s_mask;
42 u8 protocol;
43 u8 ipsrc_addr[16];
44 u8 ipsrc_addrmask[16];
45 u8 ipdst_addr[16];
46 u8 ipdst_addrmask[16];
47 u16 srcport_lo;
48 u16 srcport_hi;
49 u16 dstport_lo;
50 u16 dstport_hi;
Sage Ahn247e9cf2012-05-15 13:20:36 +090051};
52
53struct qos_entry_s {
Macpaul Lin13b26632012-09-11 15:55:31 +080054 struct list_head list;
55 struct sk_buff *skb;
56 struct net_device *dev;
Sage Ahn247e9cf2012-05-15 13:20:36 +090057
58};
59
60struct qos_cb_s {
61 struct list_head qos_list[QOS_MAX];
Ben Chane60cc3b2014-06-27 23:17:26 -070062 int qos_list_cnt;
63 int qos_null_idx;
Sage Ahn247e9cf2012-05-15 13:20:36 +090064 struct gdm_wimax_csr_s csr[QOS_MAX];
Macpaul Lin13b26632012-09-11 15:55:31 +080065 spinlock_t qos_lock;
Ben Chane60cc3b2014-06-27 23:17:26 -070066 int qos_limit_size;
Sage Ahn247e9cf2012-05-15 13:20:36 +090067};
68
69void gdm_qos_init(void *nic_ptr);
70void gdm_qos_release_list(void *nic_ptr);
71int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev);
72void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size);
73
Ben Chanbbd500d2014-06-30 22:13:17 -070074#endif /* __GDM72XX_GDM_QOS_H__ */