Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 1 | /* |
| 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 Chan | bbd500d | 2014-06-30 22:13:17 -0700 | [diff] [blame] | 14 | #ifndef __GDM72XX_GDM_QOS_H__ |
| 15 | #define __GDM72XX_GDM_QOS_H__ |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/usb.h> |
| 19 | #include <linux/list.h> |
| 20 | |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 21 | #define QOS_MAX 16 |
| 22 | #define IPTYPEOFSERVICE 0x8000 |
| 23 | #define PROTOCOL 0x4000 |
| 24 | #define IPMASKEDSRCADDRESS 0x2000 |
| 25 | #define IPMASKEDDSTADDRESS 0x1000 |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 26 | #define PROTOCOLSRCPORTRANGE 0x800 |
| 27 | #define PROTOCOLDSTPORTRANGE 0x400 |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 28 | #define DSTMACADDR 0x200 |
| 29 | #define SRCMACADDR 0x100 |
| 30 | #define ETHERTYPE 0x80 |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 31 | #define IEEE802_1DUSERPRIORITY 0x40 |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 32 | #define IEEE802_1QVLANID 0x10 |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 33 | |
| 34 | struct gdm_wimax_csr_s { |
Ben Chan | 8fea7d0 | 2014-06-27 23:17:25 -0700 | [diff] [blame] | 35 | bool enabled; |
Ben Chan | c047b44 | 2014-06-27 23:17:27 -0700 | [diff] [blame] | 36 | u32 sfid; |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 37 | 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 Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | struct qos_entry_s { |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 54 | struct list_head list; |
| 55 | struct sk_buff *skb; |
| 56 | struct net_device *dev; |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 57 | |
| 58 | }; |
| 59 | |
| 60 | struct qos_cb_s { |
| 61 | struct list_head qos_list[QOS_MAX]; |
Ben Chan | e60cc3b | 2014-06-27 23:17:26 -0700 | [diff] [blame] | 62 | int qos_list_cnt; |
| 63 | int qos_null_idx; |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 64 | struct gdm_wimax_csr_s csr[QOS_MAX]; |
Macpaul Lin | 13b2663 | 2012-09-11 15:55:31 +0800 | [diff] [blame] | 65 | spinlock_t qos_lock; |
Ben Chan | e60cc3b | 2014-06-27 23:17:26 -0700 | [diff] [blame] | 66 | int qos_limit_size; |
Sage Ahn | 247e9cf | 2012-05-15 13:20:36 +0900 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | void gdm_qos_init(void *nic_ptr); |
| 70 | void gdm_qos_release_list(void *nic_ptr); |
| 71 | int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev); |
| 72 | void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size); |
| 73 | |
Ben Chan | bbd500d | 2014-06-30 22:13:17 -0700 | [diff] [blame] | 74 | #endif /* __GDM72XX_GDM_QOS_H__ */ |