• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2002 Intersil Americas Inc.
4  *  Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
5  */
6 
7 #ifndef _ISLPCI_MGT_H
8 #define _ISLPCI_MGT_H
9 
10 #include <linux/wireless.h>
11 #include <linux/skbuff.h>
12 #include <linux/slab.h>
13 
14 /*
15  *  Function definitions
16  */
17 
18 #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
19 #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
20 
21 extern int pc_debug;
22 #define init_wds 0	/* help compiler optimize away dead code */
23 
24 
25 /* General driver definitions */
26 #define PCIDEVICE_LATENCY_TIMER_MIN		0x40
27 #define PCIDEVICE_LATENCY_TIMER_VAL		0x50
28 
29 /* Debugging verbose definitions */
30 #define SHOW_NOTHING                            0x00	/* overrules everything */
31 #define SHOW_ANYTHING                           0xFF
32 #define SHOW_ERROR_MESSAGES                     0x01
33 #define SHOW_TRAPS                              0x02
34 #define SHOW_FUNCTION_CALLS                     0x04
35 #define SHOW_TRACING                            0x08
36 #define SHOW_QUEUE_INDEXES                      0x10
37 #define SHOW_PIMFOR_FRAMES                      0x20
38 #define SHOW_BUFFER_CONTENTS                    0x40
39 #define VERBOSE                                 0x01
40 
41 /* Default card definitions */
42 #define CARD_DEFAULT_CHANNEL                    6
43 #define CARD_DEFAULT_MODE                       INL_MODE_CLIENT
44 #define CARD_DEFAULT_IW_MODE			IW_MODE_INFRA
45 #define CARD_DEFAULT_BSSTYPE                    DOT11_BSSTYPE_INFRA
46 #define CARD_DEFAULT_CLIENT_SSID		""
47 #define CARD_DEFAULT_AP_SSID			"default"
48 #define CARD_DEFAULT_KEY1                       "default_key_1"
49 #define CARD_DEFAULT_KEY2                       "default_key_2"
50 #define CARD_DEFAULT_KEY3                       "default_key_3"
51 #define CARD_DEFAULT_KEY4                       "default_key_4"
52 #define CARD_DEFAULT_WEP                        0
53 #define CARD_DEFAULT_FILTER                     0
54 #define CARD_DEFAULT_WDS                        0
55 #define	CARD_DEFAULT_AUTHEN                     DOT11_AUTH_OS
56 #define	CARD_DEFAULT_DOT1X			0
57 #define CARD_DEFAULT_MLME_MODE			DOT11_MLME_AUTO
58 #define CARD_DEFAULT_CONFORMANCE                OID_INL_CONFORMANCE_NONE
59 #define CARD_DEFAULT_PROFILE			DOT11_PROFILE_MIXED_G_WIFI
60 #define CARD_DEFAULT_MAXFRAMEBURST		DOT11_MAXFRAMEBURST_MIXED_SAFE
61 
62 /* PIMFOR package definitions */
63 #define PIMFOR_ETHERTYPE                        0x8828
64 #define PIMFOR_HEADER_SIZE                      12
65 #define PIMFOR_VERSION                          1
66 #define PIMFOR_OP_GET                           0
67 #define PIMFOR_OP_SET                           1
68 #define PIMFOR_OP_RESPONSE                      2
69 #define PIMFOR_OP_ERROR                         3
70 #define PIMFOR_OP_TRAP                          4
71 #define PIMFOR_OP_RESERVED                      5	/* till 255 */
72 #define PIMFOR_DEV_ID_MHLI_MIB                  0
73 #define PIMFOR_FLAG_APPLIC_ORIGIN               0x01
74 #define PIMFOR_FLAG_LITTLE_ENDIAN               0x02
75 
76 void display_buffer(char *, int);
77 
78 /*
79  *  Type definition section
80  *
81  *  the structure defines only the header allowing copyless
82  *  frame handling
83  */
84 typedef struct {
85 	u8 version;
86 	u8 operation;
87 	u32 oid;
88 	u8 device_id;
89 	u8 flags;
90 	u32 length;
91 } __packed
92 pimfor_header_t;
93 
94 /* A received and interrupt-processed management frame, either for
95  * schedule_work(prism54_process_trap) or for priv->mgmt_received,
96  * processed by islpci_mgt_transaction(). */
97 struct islpci_mgmtframe {
98 	struct net_device *ndev;      /* pointer to network device */
99 	pimfor_header_t *header;      /* payload header, points into buf */
100 	void *data;		      /* payload ex header, points into buf */
101         struct work_struct ws;	      /* argument for schedule_work() */
102 	char buf[];		      /* fragment buffer */
103 };
104 
105 int
106 islpci_mgt_receive(struct net_device *ndev);
107 
108 int
109 islpci_mgmt_rx_fill(struct net_device *ndev);
110 
111 void
112 islpci_mgt_cleanup_transmit(struct net_device *ndev);
113 
114 int
115 islpci_mgt_transaction(struct net_device *ndev,
116                        int operation, unsigned long oid,
117 		       void *senddata, int sendlen,
118 		       struct islpci_mgmtframe **recvframe);
119 
120 static inline void
islpci_mgt_release(struct islpci_mgmtframe * frame)121 islpci_mgt_release(struct islpci_mgmtframe *frame)
122 {
123         kfree(frame);
124 }
125 
126 #endif				/* _ISLPCI_MGT_H */
127