Commit | Line | Data |
---|---|---|
f22dbb97 TK |
1 | /***************************************************************************** |
2 | * | |
b80be37a | 3 | * Copyright (c) 2012 - 2019 Samsung Electronics Co., Ltd. All rights reserved |
f22dbb97 TK |
4 | * |
5 | ****************************************************************************/ | |
6 | ||
7 | #include "dev.h" | |
8 | ||
9 | #ifndef __SLSI_NETIF_H__ | |
10 | #define __SLSI_NETIF_H__ | |
11 | ||
12 | /* net_device queues | |
13 | * --------------------------------------------- | |
14 | * 1 Queue for Security frames (EAPOL, WAPI etc) | |
15 | * 1 Queue for Broadcast/Multicast when in AP mode. | |
16 | * 4 Queues per Peer | |
17 | * | |
18 | * STA/ADHOC | |
19 | * Queues | |
20 | * ------------------------------------------------------- | |
21 | * | 0 | 1 | 2 - 5 | 6 | 7 | 8 | 9 | | |
22 | * ------------------------------------------------------- | |
23 | * | Eapol | Discard | Not | AC | AC | AC | AC | | |
24 | * | Frames | Queue | Used | 0 | 1 | 2 | 3 | | |
25 | * ------------------------------------------------------- | |
26 | * | |
27 | * AP | |
28 | * Queues | |
29 | * -------------------------------------------------------- | |
30 | * | Peer 1 ACs (0 - 4) | Peer 2 ACs (0 - 4) | ...... | |
31 | * -------------------------------------------------------------------------------------------------------------------- | |
32 | * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ...... | |
33 | * -------------------------------------------------------------------------------------------------------------------- | |
34 | * | Eapol | Discard |B/M Cast |B/M Cast |B/M Cast |B/M Cast | AC | AC | AC | AC | AC | AC | AC | AC | ...... | |
35 | * | Frames | Queue | AC 0 | AC 1 | AC 2 | AC 3 | 0 | 1 | 2 | 3 | 0 | 1 | 2 | 3 | ...... | |
36 | * -------------------------------------------------------------------------------------------------------------------- | |
37 | */ | |
38 | ||
39 | #ifndef ETH_P_PAE | |
40 | #define ETH_P_PAE 0x888e | |
41 | #endif | |
42 | #ifndef ETH_P_WAI | |
43 | #define ETH_P_WAI 0x88b4 | |
44 | #endif | |
45 | ||
46 | #define SLSI_NETIF_Q_PRIORITY 0 | |
47 | #define SLSI_NETIF_Q_DISCARD 1 | |
48 | #define SLSI_NETIF_Q_MULTICAST_START 2 | |
49 | #define SLSI_NETIF_Q_PEER_START 6 | |
50 | ||
51 | #define SLSI_NETIF_Q_PER_PEER 4 | |
52 | ||
53 | #define SLSI_NETIF_SKB_HEADROOM (68 + 160) /* sizeof ma_unitdata_req [36] + pad [30] + pad_words [2] */ | |
54 | #define SLSI_NETIF_SKB_TAILROOM 0 | |
55 | ||
56 | #define SLSI_IS_MULTICAST_QUEUE_MAPPING(queue) (queue >= SLSI_NETIF_Q_MULTICAST_START && queue < (SLSI_NETIF_Q_MULTICAST_START + SLSI_NETIF_Q_PER_PEER) ? 1 : 0) | |
57 | ||
58 | static inline u16 slsi_netif_get_peer_queue(s16 queueset, s16 ac) | |
59 | { | |
60 | WARN_ON(ac > SLSI_NETIF_Q_PER_PEER); | |
61 | return SLSI_NETIF_Q_PEER_START + (queueset * SLSI_NETIF_Q_PER_PEER) + ac; | |
62 | } | |
63 | ||
64 | /* queueset is one less than the assigned aid. */ | |
65 | static inline unsigned short slsi_netif_get_qs_from_queue(short queue, short ac) | |
66 | { | |
67 | return ((queue - ac - SLSI_NETIF_Q_PEER_START) / SLSI_NETIF_Q_PER_PEER); | |
68 | } | |
69 | ||
70 | static inline u16 slsi_netif_get_multicast_queue(s16 ac) | |
71 | { | |
72 | WARN_ON(ac > SLSI_NETIF_Q_PER_PEER); | |
73 | return SLSI_NETIF_Q_MULTICAST_START + ac; | |
74 | } | |
75 | ||
76 | #define MAP_QS_TO_AID(qs) (qs + 1) | |
77 | #define MAP_AID_TO_QS(aid) (aid - 1) | |
78 | ||
79 | enum slsi_traffic_q { | |
80 | SLSI_TRAFFIC_Q_BE = 0, | |
81 | SLSI_TRAFFIC_Q_BK, | |
82 | SLSI_TRAFFIC_Q_VI, | |
83 | SLSI_TRAFFIC_Q_VO, | |
84 | }; | |
85 | ||
86 | enum slsi_traffic_q slsi_frame_priority_to_ac_queue(u16 priority); | |
87 | int slsi_ac_to_tids(enum slsi_traffic_q ac, int *tids); | |
88 | ||
89 | struct slsi_dev; | |
90 | struct slsi_peer; | |
91 | ||
92 | int slsi_netif_init(struct slsi_dev *sdev); | |
93 | /* returns the index or -E<error> code */ | |
94 | int slsi_netif_dynamic_iface_add(struct slsi_dev *sdev, const char *name); | |
95 | int slsi_netif_register(struct slsi_dev *sdev, struct net_device *dev); | |
96 | int slsi_netif_register_rtlnl_locked(struct slsi_dev *sdev, struct net_device *dev); | |
97 | void slsi_netif_remove(struct slsi_dev *sdev, struct net_device *dev); | |
98 | void slsi_netif_remove_rtlnl_locked(struct slsi_dev *sdev, struct net_device *dev); | |
99 | void slsi_netif_remove_all(struct slsi_dev *sdev); | |
100 | void slsi_netif_deinit(struct slsi_dev *sdev); | |
101 | void slsi_tdls_move_packets(struct slsi_dev *sdev, struct net_device *dev, | |
102 | struct slsi_peer *sta_peer, struct slsi_peer *tdls_peer, bool connection); | |
103 | void slsi_netif_remove_locked(struct slsi_dev *sdev, struct net_device *dev); | |
b80be37a TK |
104 | int slsi_netif_add_locked(struct slsi_dev *sdev, const char *name, int ifnum); |
105 | int slsi_netif_register_locked(struct slsi_dev *sdev, struct net_device *dev); | |
106 | #ifdef CONFIG_SCSC_WIFI_NAN_ENABLE | |
107 | void slsi_net_randomize_nmi_ndi(struct slsi_dev *sdev); | |
108 | #endif | |
f22dbb97 TK |
109 | |
110 | #endif /*__SLSI_NETIF_H__*/ |