nrfxlib API 0.1.0
Loading...
Searching...
No Matches
fmac_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
11#ifndef __FMAC_UTIL_H__
12#define __FMAC_UTIL_H__
13
14#ifndef CONFIG_NRF700X_RADIO_TEST
15#include "fmac_structs.h"
16#include "pack_def.h"
17
18
19#define NRF_WIFI_FMAC_ETH_ADDR_LEN 6
20#define NRF_WIFI_FMAC_ETH_HDR_LEN 14
21
22#define NRF_WIFI_FMAC_FTYPE_DATA 0x0008
23#define NRF_WIFI_FMAC_STYPE_DATA 0x0000
24#define NRF_WIFI_FMAC_STYPE_QOS_DATA 0x0080
25
26#define NRF_WIFI_FMAC_FCTL_FTYPE 0x000c
27#define NRF_WIFI_FMAC_FCTL_PROTECTED 0x4000
28#define NRF_WIFI_FMAC_FCTL_TODS 0x0100
29#define NRF_WIFI_FMAC_FCTL_FROMDS 0x0200
30
31#define NRF_WIFI_FMAC_CIPHER_SUITE_WEP40 0x000FAC01
32#define NRF_WIFI_FMAC_CIPHER_SUITE_WEP104 0x000FAC05
33#define NRF_WIFI_FMAC_CIPHER_SUITE_TKIP 0x000FAC02
34#define NRF_WIFI_FMAC_CIPHER_SUITE_CCMP 0x000FAC04
35#define NRF_WIFI_FMAC_CIPHER_SUITE_CCMP_256 0x000FAC0A
36#define NRF_WIFI_FMAC_CIPHER_SUITE_OPEN 0x0
37#define NRF_WIFI_FMAC_CIPHER_SUITE_SMS4 0x00147201
38
39#define NRF_WIFI_FMAC_CCMP_HDR_LEN 8
40#define NRF_WIFI_FMAC_CCMP_256_HDR_LEN 8
41#define NRF_WIFI_FMAC_SMS4_HDR_LEN 18
42
43#define NRF_WIFI_FMAC_WEP_IV_LEN 4
44#define NRF_WIFI_FMAC_TKIP_IV_LEN 8
45
46#define NRF_WIFI_FCTL_TODS 0x0100
47#define NRF_WIFI_FCTL_FROMDS 0x0200
48#define NRF_WIFI_FMAC_ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
49#define NRF_WIFI_FMAC_ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
50#define NRF_WIFI_FMAC_ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
51#define NRF_WIFI_FMAC_ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
52#define NRF_WIFI_FMAC_ETH_P_IP 0x0800 /* Internet Protocol packet */
53#define NRF_WIFI_FMAC_ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
54#define NRF_WIFI_FMAC_ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */
55#define NRF_WIFI_FMAC_ETH_P_AARP 0x80F3 /* Appletalk AARP */
56#define NRF_WIFI_FMAC_ETH_P_IPX 0x8137 /* IPX over DIX */
57#define NRF_WIFI_FMAC_ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than
58 * this value then the frame is Ethernet II.
59 * Else it is 802.3
60 */
61#define NRF_WIFI_FMAC_VLAN_PRIO_SHIFT 0x0D /* 13 bit */
62#define NRF_WIFI_FMAC_VLAN_PRIO_MASK 0xE000
63#define NRF_WIFI_FMAC_MPLS_LS_TC_MASK 0x00000E00
64#define NRF_WIFI_FMAC_MPLS_LS_TC_SHIFT 0x09
65#define NRF_WIFI_FMAC_IPV6_TOS_MASK 0x0FF0
66#define NRF_WIFI_FMAC_IPV6_TOS_SHIFT 0x04 /* 4bit */
67#define NRF_WIFI_FMAC_ETH_TYPE_MASK 0xFFFF
70 unsigned short fc;
71 unsigned short dur_id;
75 unsigned short seq_ctrl;
77} __NRF_WIFI_PKD;
81 unsigned char dst[NRF_WIFI_FMAC_ETH_ADDR_LEN]; /* destination eth addr */
82 unsigned char src[NRF_WIFI_FMAC_ETH_ADDR_LEN]; /* source ether addr */
83 unsigned short proto; /* packet type ID field */
84} __NRF_WIFI_PKD;
88 unsigned char dst[NRF_WIFI_FMAC_ETH_ADDR_LEN]; /* destination eth addr */
89 unsigned char src[NRF_WIFI_FMAC_ETH_ADDR_LEN]; /* source ether addr */
90 unsigned short length; /* length*/
91} __NRF_WIFI_PKD;
93bool nrf_wifi_util_is_multicast_addr(const unsigned char *addr);
95bool nrf_wifi_util_is_unicast_addr(const unsigned char *addr);
96
97bool nrf_wifi_util_ether_addr_equal(const unsigned char *addr_1,
98 const unsigned char *addr_2);
99
101 void *nwb);
102
104 const unsigned char *mac_addr);
105
107 void *nwb);
108
109unsigned char *nrf_wifi_util_get_src(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
110 void *nwb);
111
112unsigned char *nrf_wifi_util_get_dest(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
113 void *nwb);
114
115unsigned short nrf_wifi_util_tx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
116 void *nwb);
117
118unsigned short nrf_wifi_util_rx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
119 void *nwb);
121int nrf_wifi_util_get_skip_header_bytes(unsigned short eth_type);
122
124 void *nwb,
126 unsigned short eth_type);
127
129 void *nwb);
130
131bool nrf_wifi_util_is_arr_zero(unsigned char *arr,
132 unsigned int arr_sz);
134#endif /* !CONFIG_NRF700X_RADIO_TEST */
135
136void *wifi_fmac_priv(struct nrf_wifi_fmac_priv *def);
137void *wifi_dev_priv(struct nrf_wifi_fmac_dev_ctx *def);
138
139#endif /* __FMAC_UTIL_H__ */
unsigned char * nrf_wifi_util_get_ra(struct nrf_wifi_fmac_vif_ctx *vif, void *nwb)
bool nrf_wifi_util_ether_addr_equal(const unsigned char *addr_1, const unsigned char *addr_2)
unsigned char * nrf_wifi_util_get_dest(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
bool nrf_wifi_util_is_unicast_addr(const unsigned char *addr)
unsigned char * nrf_wifi_util_get_src(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
int nrf_wifi_util_get_tid(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
bool nrf_wifi_util_is_multicast_addr(const unsigned char *addr)
unsigned short nrf_wifi_util_tx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
#define NRF_WIFI_FMAC_ETH_ADDR_LEN
Header containing utility declarations for the FMAC IF Layer of the Wi-Fi driver.
Definition: fmac_util.h:19
void * wifi_dev_priv(struct nrf_wifi_fmac_dev_ctx *def)
bool nrf_wifi_util_is_arr_zero(unsigned char *arr, unsigned int arr_sz)
int nrf_wifi_util_get_skip_header_bytes(unsigned short eth_type)
int nrf_wifi_util_get_vif_indx(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, const unsigned char *mac_addr)
void nrf_wifi_util_convert_to_eth(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb, struct nrf_wifi_fmac_ieee80211_hdr *hdr, unsigned short eth_type)
void * wifi_fmac_priv(struct nrf_wifi_fmac_priv *def)
void nrf_wifi_util_rx_convert_amsdu_to_eth(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
unsigned short nrf_wifi_util_rx_get_eth_type(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, void *nwb)
unsigned short length
Definition: fmac_util.h:87
unsigned char src[6]
Definition: fmac_util.h:86
unsigned char dst[6]
Definition: fmac_util.h:85
Definition: fmac_util.h:84
Structure to hold common fmac dev context parameter data.
Definition: fmac_structs_common.h:146
unsigned char src[6]
Definition: fmac_util.h:79
unsigned char dst[6]
Definition: fmac_util.h:78
unsigned short proto
Definition: fmac_util.h:80
Definition: fmac_util.h:77
unsigned char addr_1[6]
Definition: fmac_util.h:69
unsigned short seq_ctrl
Definition: fmac_util.h:72
unsigned char addr_4[6]
Definition: fmac_util.h:73
unsigned short fc
Definition: fmac_util.h:67
unsigned char addr_2[6]
Definition: fmac_util.h:70
unsigned short dur_id
Definition: fmac_util.h:68
unsigned char addr_3[6]
Definition: fmac_util.h:71
Definition: fmac_util.h:66
Structure to hold common fmac priv parameter data.
Definition: fmac_structs_common.h:135
Structure to hold per VIF context information for the UMAC IF layer.
Definition: fmac_structs.h:497