blob: 700c434c8803e410468e72132f0500c7d1d639fe [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 2002 Intersil Americas Inc.
3 * Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
Jeff Kirsher4280db92013-12-06 03:32:12 -080015 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 *
17 */
18
19#ifndef _ISLPCI_MGT_H
20#define _ISLPCI_MGT_H
21
22#include <linux/wireless.h>
23#include <linux/skbuff.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090024#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26/*
27 * Function definitions
28 */
29
30#define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
31#define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
32
33extern int pc_debug;
34#define init_wds 0 /* help compiler optimize away dead code */
35
36
37/* General driver definitions */
Dmitry Torokhov93b2dd12006-10-08 00:38:15 -040038#define PCIDEVICE_LATENCY_TIMER_MIN 0x40
39#define PCIDEVICE_LATENCY_TIMER_VAL 0x50
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41/* Debugging verbose definitions */
42#define SHOW_NOTHING 0x00 /* overrules everything */
43#define SHOW_ANYTHING 0xFF
44#define SHOW_ERROR_MESSAGES 0x01
45#define SHOW_TRAPS 0x02
46#define SHOW_FUNCTION_CALLS 0x04
47#define SHOW_TRACING 0x08
48#define SHOW_QUEUE_INDEXES 0x10
49#define SHOW_PIMFOR_FRAMES 0x20
50#define SHOW_BUFFER_CONTENTS 0x40
51#define VERBOSE 0x01
52
53/* Default card definitions */
54#define CARD_DEFAULT_CHANNEL 6
55#define CARD_DEFAULT_MODE INL_MODE_CLIENT
56#define CARD_DEFAULT_IW_MODE IW_MODE_INFRA
57#define CARD_DEFAULT_BSSTYPE DOT11_BSSTYPE_INFRA
58#define CARD_DEFAULT_CLIENT_SSID ""
59#define CARD_DEFAULT_AP_SSID "default"
60#define CARD_DEFAULT_KEY1 "default_key_1"
61#define CARD_DEFAULT_KEY2 "default_key_2"
62#define CARD_DEFAULT_KEY3 "default_key_3"
63#define CARD_DEFAULT_KEY4 "default_key_4"
64#define CARD_DEFAULT_WEP 0
65#define CARD_DEFAULT_FILTER 0
66#define CARD_DEFAULT_WDS 0
67#define CARD_DEFAULT_AUTHEN DOT11_AUTH_OS
68#define CARD_DEFAULT_DOT1X 0
69#define CARD_DEFAULT_MLME_MODE DOT11_MLME_AUTO
70#define CARD_DEFAULT_CONFORMANCE OID_INL_CONFORMANCE_NONE
71#define CARD_DEFAULT_PROFILE DOT11_PROFILE_MIXED_G_WIFI
72#define CARD_DEFAULT_MAXFRAMEBURST DOT11_MAXFRAMEBURST_MIXED_SAFE
73
74/* PIMFOR package definitions */
75#define PIMFOR_ETHERTYPE 0x8828
76#define PIMFOR_HEADER_SIZE 12
77#define PIMFOR_VERSION 1
78#define PIMFOR_OP_GET 0
79#define PIMFOR_OP_SET 1
80#define PIMFOR_OP_RESPONSE 2
81#define PIMFOR_OP_ERROR 3
82#define PIMFOR_OP_TRAP 4
83#define PIMFOR_OP_RESERVED 5 /* till 255 */
84#define PIMFOR_DEV_ID_MHLI_MIB 0
85#define PIMFOR_FLAG_APPLIC_ORIGIN 0x01
86#define PIMFOR_FLAG_LITTLE_ENDIAN 0x02
87
Linus Torvalds1da177e2005-04-16 15:20:36 -070088void display_buffer(char *, int);
89
90/*
91 * Type definition section
92 *
93 * the structure defines only the header allowing copyless
94 * frame handling
95 */
96typedef struct {
97 u8 version;
98 u8 operation;
99 u32 oid;
100 u8 device_id;
101 u8 flags;
102 u32 length;
Eric Dumazetba2d3582010-06-02 18:10:09 +0000103} __packed
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104pimfor_header_t;
105
106/* A received and interrupt-processed management frame, either for
107 * schedule_work(prism54_process_trap) or for priv->mgmt_received,
108 * processed by islpci_mgt_transaction(). */
109struct islpci_mgmtframe {
110 struct net_device *ndev; /* pointer to network device */
111 pimfor_header_t *header; /* payload header, points into buf */
112 void *data; /* payload ex header, points into buf */
113 struct work_struct ws; /* argument for schedule_work() */
114 char buf[0]; /* fragment buffer */
115};
116
117int
118islpci_mgt_receive(struct net_device *ndev);
119
120int
121islpci_mgmt_rx_fill(struct net_device *ndev);
122
123void
124islpci_mgt_cleanup_transmit(struct net_device *ndev);
125
126int
127islpci_mgt_transaction(struct net_device *ndev,
128 int operation, unsigned long oid,
129 void *senddata, int sendlen,
130 struct islpci_mgmtframe **recvframe);
131
132static inline void
133islpci_mgt_release(struct islpci_mgmtframe *frame)
134{
135 kfree(frame);
136}
137
138#endif /* _ISLPCI_MGT_H */