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 14 #ifndef __GDM72XX_GDM_QOS_H__ 15 #define __GDM72XX_GDM_QOS_H__ 16 17 #include <linux/types.h> 18 #include <linux/usb.h> 19 #include <linux/list.h> 20 21 #define QOS_MAX 16 22 #define IPTYPEOFSERVICE 0x8000 23 #define PROTOCOL 0x4000 24 #define IPMASKEDSRCADDRESS 0x2000 25 #define IPMASKEDDSTADDRESS 0x1000 26 #define PROTOCOLSRCPORTRANGE 0x800 27 #define PROTOCOLDSTPORTRANGE 0x400 28 #define DSTMACADDR 0x200 29 #define SRCMACADDR 0x100 30 #define ETHERTYPE 0x80 31 #define IEEE802_1DUSERPRIORITY 0x40 32 #define IEEE802_1QVLANID 0x10 33 34 struct gdm_wimax_csr_s { 35 bool enabled; 36 u32 sfid; 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; 51 }; 52 53 struct qos_entry_s { 54 struct list_head list; 55 struct sk_buff *skb; 56 struct net_device *dev; 57 58 }; 59 60 struct qos_cb_s { 61 struct list_head qos_list[QOS_MAX]; 62 int qos_list_cnt; 63 int qos_null_idx; 64 struct gdm_wimax_csr_s csr[QOS_MAX]; 65 spinlock_t qos_lock; 66 int qos_limit_size; 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 74 #endif /* __GDM72XX_GDM_QOS_H__ */ 75