3 #ifndef __i1480_wlp_h__
4 #define __i1480_wlp_h__
6 #include <linux/spinlock.h>
7 #include <linux/list.h>
9 #include <linux/if_ether.h>
10 #include <asm/byteorder.h>
12 /* New simplified header format? */
16 * Values of the Delivery ID & Type field when PCA or DRP
18 * The Delivery ID & Type field in the WLP TX header indicates whether
19 * the frame is PCA or DRP. This is done based on the high level bit of
21 * We use this constant to test if the traffic is PCA or DRP as follows:
22 * if (wlp_tx_hdr_delivery_id_type(wlp_tx_hdr) & WLP_DRP)
27 enum deliver_id_type_bit
{
34 * Indicates UWB/WLP-specific transmission parameters for a network
39 struct uwb_dev_addr dstaddr
;
48 u8 oui2
; /* if all LE, it could be merged */
51 } __attribute__((packed
));
53 static inline int wlp_tx_hdr_delivery_id_type(const struct wlp_tx_hdr
*hdr
)
55 return hdr
->mac_params
& 0x0f;
58 static inline int wlp_tx_hdr_ack_policy(const struct wlp_tx_hdr
*hdr
)
60 return (hdr
->mac_params
>> 4) & 0x07;
63 static inline int wlp_tx_hdr_rts_cts(const struct wlp_tx_hdr
*hdr
)
65 return (hdr
->mac_params
>> 7) & 0x01;
68 static inline void wlp_tx_hdr_set_delivery_id_type(struct wlp_tx_hdr
*hdr
, int id
)
70 hdr
->mac_params
= (hdr
->mac_params
& ~0x0f) | id
;
73 static inline void wlp_tx_hdr_set_ack_policy(struct wlp_tx_hdr
*hdr
,
74 enum uwb_ack_pol policy
)
76 hdr
->mac_params
= (hdr
->mac_params
& ~0x70) | (policy
<< 4);
79 static inline void wlp_tx_hdr_set_rts_cts(struct wlp_tx_hdr
*hdr
, int rts_cts
)
81 hdr
->mac_params
= (hdr
->mac_params
& ~0x80) | (rts_cts
<< 7);
84 static inline enum uwb_phy_rate
wlp_tx_hdr_phy_rate(const struct wlp_tx_hdr
*hdr
)
86 return hdr
->phy_params
& 0x0f;
89 static inline int wlp_tx_hdr_tx_power(const struct wlp_tx_hdr
*hdr
)
91 return (hdr
->phy_params
>> 4) & 0x0f;
94 static inline void wlp_tx_hdr_set_phy_rate(struct wlp_tx_hdr
*hdr
, enum uwb_phy_rate rate
)
96 hdr
->phy_params
= (hdr
->phy_params
& ~0x0f) | rate
;
99 static inline void wlp_tx_hdr_set_tx_power(struct wlp_tx_hdr
*hdr
, int pwr
)
101 hdr
->phy_params
= (hdr
->phy_params
& ~0xf0) | (pwr
<< 4);
108 * Provides UWB/WLP-specific transmission data for a received
113 struct uwb_dev_addr dstaddr
;
114 struct uwb_dev_addr srcaddr
;
119 #ifndef WLP_HDR_FMT_2
125 } __attribute__((packed
));
128 /** User configurable options for WLP */
130 struct mutex mutex
; /* access to user configurable options*/
131 struct wlp_tx_hdr def_tx_hdr
; /* default tx hdr */
132 u8 pca_base_priority
;
133 u8 bw_alloc
; /*index into bw_allocs[] for PCA/DRP reservations*/
138 void wlp_options_init(struct wlp_options
*options
)
140 mutex_init(&options
->mutex
);
141 wlp_tx_hdr_set_ack_policy(&options
->def_tx_hdr
, UWB_ACK_INM
);
142 wlp_tx_hdr_set_rts_cts(&options
->def_tx_hdr
, 1);
143 wlp_tx_hdr_set_phy_rate(&options
->def_tx_hdr
, UWB_PHY_RATE_480
);
144 #ifndef WLP_HDR_FMT_2
145 options
->def_tx_hdr
.prid
= cpu_to_le16(0x0000);
152 extern ssize_t
uwb_pca_base_priority_store(struct wlp_options
*,
153 const char *, size_t);
154 extern ssize_t
uwb_pca_base_priority_show(const struct wlp_options
*, char *);
155 extern ssize_t
uwb_bw_alloc_store(struct wlp_options
*, const char *, size_t);
156 extern ssize_t
uwb_bw_alloc_show(const struct wlp_options
*, char *);
157 extern ssize_t
uwb_ack_policy_store(struct wlp_options
*,
158 const char *, size_t);
159 extern ssize_t
uwb_ack_policy_show(const struct wlp_options
*, char *);
160 extern ssize_t
uwb_rts_cts_store(struct wlp_options
*, const char *, size_t);
161 extern ssize_t
uwb_rts_cts_show(const struct wlp_options
*, char *);
162 extern ssize_t
uwb_phy_rate_store(struct wlp_options
*, const char *, size_t);
163 extern ssize_t
uwb_phy_rate_show(const struct wlp_options
*, char *);
166 /** Simple bandwidth allocation (temporary and too simple) */
167 struct wlp_bw_allocs
{
175 #endif /* #ifndef __i1480_wlp_h__ */