1247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn/*
2247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
3247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn *
4247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * This software is licensed under the terms of the GNU General Public
5247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * License version 2, as published by the Free Software Foundation, and
6247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * may be copied, distributed, and modified under those terms.
7247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn *
8247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * This program is distributed in the hope that it will be useful,
9247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * but WITHOUT ANY WARRANTY; without even the implied warranty of
10247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn * GNU General Public License for more details.
12247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn */
13247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
14bbd500d8cdb071e7964fc07ab988817d719e1578Ben Chan#ifndef __GDM72XX_GDM_QOS_H__
15bbd500d8cdb071e7964fc07ab988817d719e1578Ben Chan#define __GDM72XX_GDM_QOS_H__
16247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
17247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#include <linux/types.h>
18247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#include <linux/usb.h>
19247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#include <linux/list.h>
20247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
2113b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define QOS_MAX				16
2213b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define IPTYPEOFSERVICE			0x8000
2313b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	PROTOCOL			0x4000
2413b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	IPMASKEDSRCADDRESS		0x2000
2513b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	IPMASKEDDSTADDRESS		0x1000
26247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#define	PROTOCOLSRCPORTRANGE		0x800
27247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#define	PROTOCOLDSTPORTRANGE		0x400
2813b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	DSTMACADDR			0x200
2913b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	SRCMACADDR			0x100
3013b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	ETHERTYPE			0x80
31247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn#define	IEEE802_1DUSERPRIORITY		0x40
3213b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin#define	IEEE802_1QVLANID		0x10
33247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
34247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnstruct gdm_wimax_csr_s {
358fea7d0944faa37fcaf82305f3e756fd2a7ccdf5Ben Chan	bool		enabled;
36c047b443ac33f599ada99f8d0b36c8c13bee4b65Ben Chan	u32		sfid;
3713b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		qos_buf_count;
3813b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u16		classifier_rule_en;
3913b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ip2s_lo;
4013b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ip2s_hi;
4113b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ip2s_mask;
4213b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		protocol;
4313b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ipsrc_addr[16];
4413b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ipsrc_addrmask[16];
4513b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ipdst_addr[16];
4613b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u8		ipdst_addrmask[16];
4713b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u16		srcport_lo;
4813b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u16		srcport_hi;
4913b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u16		dstport_lo;
5013b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	u16		dstport_hi;
51247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn};
52247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
53247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnstruct qos_entry_s {
5413b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	struct list_head	list;
5513b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	struct sk_buff		*skb;
5613b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	struct net_device	*dev;
57247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
58247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn};
59247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
60247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnstruct qos_cb_s {
61247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn	struct list_head	qos_list[QOS_MAX];
62e60cc3bd453737491f72a89f3c395cbb4022eb98Ben Chan	int			qos_list_cnt;
63e60cc3bd453737491f72a89f3c395cbb4022eb98Ben Chan	int			qos_null_idx;
64247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn	struct gdm_wimax_csr_s	csr[QOS_MAX];
6513b2663c95f6f30f835ef92ef51c9aff0b3f09d6Macpaul Lin	spinlock_t		qos_lock;
66e60cc3bd453737491f72a89f3c395cbb4022eb98Ben Chan	int			qos_limit_size;
67247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn};
68247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
69247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnvoid gdm_qos_init(void *nic_ptr);
70247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnvoid gdm_qos_release_list(void *nic_ptr);
71247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnint gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev);
72247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahnvoid gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size);
73247e9cffdce024fec5f55f76a8592f2fa8b3aa7bSage Ahn
74bbd500d8cdb071e7964fc07ab988817d719e1578Ben Chan#endif /* __GDM72XX_GDM_QOS_H__ */
75