freebsd_wlan: Implement ieee80211_{add|get}_toa_params.

Required by the FreeBSD 12 atheroswifi driver.
This commit is contained in:
Augustin Cavalier
2019-01-07 21:39:08 -05:00
parent 2e07eed8ae
commit cf55254350
2 changed files with 47 additions and 1 deletions
@@ -516,6 +516,44 @@ ieee80211_get_rx_params_ptr(struct mbuf *m)
}
/*
* Add TOA parameters to the given mbuf.
*/
int
ieee80211_add_toa_params(struct mbuf *m, const struct ieee80211_toa_params *p)
{
struct m_tag *mtag;
struct ieee80211_toa_params *rp;
mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_TOA_PARAMS,
sizeof(struct ieee80211_toa_params), M_NOWAIT);
if (mtag == NULL)
return (0);
rp = (struct ieee80211_toa_params *)(mtag + 1);
memcpy(rp, p, sizeof(*rp));
m_tag_prepend(m, mtag);
return (1);
}
int
ieee80211_get_toa_params(struct mbuf *m, struct ieee80211_toa_params *p)
{
struct m_tag *mtag;
struct ieee80211_toa_params *rp;
mtag = m_tag_locate(m, MTAG_ABI_NET80211, NET80211_TAG_TOA_PARAMS,
NULL);
if (mtag == NULL)
return (0);
rp = (struct ieee80211_toa_params *)(mtag + 1);
if (p != NULL)
memcpy(p, rp, sizeof(*p));
return (1);
}
/*
* Transmit a frame to the parent interface.
*/
@@ -344,8 +344,10 @@ struct ieee80211_cb {
void *arg;
};
#define NET80211_TAG_CALLBACK 0 /* xmit complete callback */
#define NET80211_TAG_XMIT_PARAMS 1 /* See below; this is after the bpf_params definition */
#define NET80211_TAG_XMIT_PARAMS 1
/* See below; this is after the bpf_params definition */
#define NET80211_TAG_RECV_PARAMS 2
#define NET80211_TAG_TOA_PARAMS 3
int ieee80211_add_callback(struct mbuf *m,
void (*func)(struct ieee80211_node *, void *, int), void *arg);
@@ -473,6 +475,12 @@ int ieee80211_add_rx_params(struct mbuf *m, const struct ieee80211_rx_stats *rxs
int ieee80211_get_rx_params(struct mbuf *m, struct ieee80211_rx_stats *rxs);
const struct ieee80211_rx_stats * ieee80211_get_rx_params_ptr(struct mbuf *m);
struct ieee80211_toa_params {
int request_id;
};
int ieee80211_add_toa_params(struct mbuf *m, const struct ieee80211_toa_params *p);
int ieee80211_get_toa_params(struct mbuf *m, struct ieee80211_toa_params *p);
#ifdef __cplusplus
}
#endif