forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 223293205a7265c8b02882461ba8996650048ade
kernel/drivers/net/wireless/ath/wil6210/txrx.h
....@@ -1,18 +1,7 @@
1
+/* SPDX-License-Identifier: ISC */
12 /*
23 * Copyright (c) 2012-2016 Qualcomm Atheros, Inc.
3
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
165 */
176
187 #ifndef WIL6210_TXRX_H
....@@ -423,6 +412,46 @@
423412 #define RX_DMA_STATUS_PHY_INFO BIT(6)
424413 #define RX_DMA_STATUS_FFM BIT(7) /* EtherType Flex Filter Match */
425414
415
+/* IEEE 802.11, 8.5.2 EAPOL-Key frames */
416
+#define WIL_KEY_INFO_KEY_TYPE BIT(3) /* val of 1 = Pairwise, 0 = Group key */
417
+
418
+#define WIL_KEY_INFO_MIC BIT(8)
419
+#define WIL_KEY_INFO_ENCR_KEY_DATA BIT(12) /* for rsn only */
420
+
421
+#define WIL_EAP_NONCE_LEN 32
422
+#define WIL_EAP_KEY_RSC_LEN 8
423
+#define WIL_EAP_REPLAY_COUNTER_LEN 8
424
+#define WIL_EAP_KEY_IV_LEN 16
425
+#define WIL_EAP_KEY_ID_LEN 8
426
+
427
+enum {
428
+ WIL_1X_TYPE_EAP_PACKET = 0,
429
+ WIL_1X_TYPE_EAPOL_START = 1,
430
+ WIL_1X_TYPE_EAPOL_LOGOFF = 2,
431
+ WIL_1X_TYPE_EAPOL_KEY = 3,
432
+};
433
+
434
+#define WIL_EAPOL_KEY_TYPE_RSN 2
435
+#define WIL_EAPOL_KEY_TYPE_WPA 254
436
+
437
+struct wil_1x_hdr {
438
+ u8 version;
439
+ u8 type;
440
+ __be16 length;
441
+ /* followed by data */
442
+} __packed;
443
+
444
+struct wil_eapol_key {
445
+ u8 type;
446
+ __be16 key_info;
447
+ __be16 key_length;
448
+ u8 replay_counter[WIL_EAP_REPLAY_COUNTER_LEN];
449
+ u8 key_nonce[WIL_EAP_NONCE_LEN];
450
+ u8 key_iv[WIL_EAP_KEY_IV_LEN];
451
+ u8 key_rsc[WIL_EAP_KEY_RSC_LEN];
452
+ u8 key_id[WIL_EAP_KEY_ID_LEN];
453
+} __packed;
454
+
426455 struct vring_rx_dma {
427456 u32 d0;
428457 struct wil_ring_dma_addr addr;
....@@ -457,6 +486,18 @@
457486 union wil_tx_desc tx;
458487 union wil_rx_desc rx;
459488 } __packed;
489
+
490
+struct packet_rx_info {
491
+ u8 cid;
492
+};
493
+
494
+/* this struct will be stored in the skb cb buffer
495
+ * max length of the struct is limited to 48 bytes
496
+ */
497
+struct skb_rx_info {
498
+ struct vring_rx_desc rx_desc;
499
+ struct packet_rx_info rx_info;
500
+};
460501
461502 static inline int wil_rxdesc_tid(struct vring_rx_desc *d)
462503 {
....@@ -530,11 +571,6 @@
530571 return WIL_GET_BITS(d->mac.d1, 13, 14);
531572 }
532573
533
-static inline int wil_rxdesc_phy_length(struct vring_rx_desc *d)
534
-{
535
- return WIL_GET_BITS(d->dma.d0, 16, 29);
536
-}
537
-
538574 static inline struct vring_rx_desc *wil_skb_rxdesc(struct sk_buff *skb)
539575 {
540576 return (void *)skb->cb;
....@@ -560,11 +596,25 @@
560596 return wil_ring_next_tail(ring) == ring->swhead;
561597 }
562598
563
-static inline bool wil_need_txstat(struct sk_buff *skb)
599
+static inline u8 *wil_skb_get_da(struct sk_buff *skb)
564600 {
565601 struct ethhdr *eth = (void *)skb->data;
566602
567
- return is_unicast_ether_addr(eth->h_dest) && skb->sk &&
603
+ return eth->h_dest;
604
+}
605
+
606
+static inline u8 *wil_skb_get_sa(struct sk_buff *skb)
607
+{
608
+ struct ethhdr *eth = (void *)skb->data;
609
+
610
+ return eth->h_source;
611
+}
612
+
613
+static inline bool wil_need_txstat(struct sk_buff *skb)
614
+{
615
+ const u8 *da = wil_skb_get_da(skb);
616
+
617
+ return is_unicast_ether_addr(da) && skb->sk &&
568618 (skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS);
569619 }
570620
....@@ -610,7 +660,23 @@
610660 return val >= min && val < max;
611661 }
612662
663
+static inline u8 wil_skb_get_cid(struct sk_buff *skb)
664
+{
665
+ struct skb_rx_info *skb_rx_info = (void *)skb->cb;
666
+
667
+ return skb_rx_info->rx_info.cid;
668
+}
669
+
670
+static inline void wil_skb_set_cid(struct sk_buff *skb, u8 cid)
671
+{
672
+ struct skb_rx_info *skb_rx_info = (void *)skb->cb;
673
+
674
+ skb_rx_info->rx_info.cid = cid;
675
+}
676
+
613677 void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev);
678
+void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid,
679
+ struct wil_net_stats *stats, bool gro);
614680 void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb);
615681 void wil_rx_bar(struct wil6210_priv *wil, struct wil6210_vif *vif,
616682 u8 cid, u8 tid, u16 seq);