hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
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
....@@ -354,8 +343,10 @@
354343 u32 d0;
355344 u32 d1;
356345 u16 w4;
357
- u16 pn_15_0;
358
- u32 pn_47_16;
346
+ struct_group_attr(pn, __packed,
347
+ u16 pn_15_0;
348
+ u32 pn_47_16;
349
+ );
359350 } __packed;
360351
361352 /* Rx descriptor - DMA part
....@@ -423,6 +414,46 @@
423414 #define RX_DMA_STATUS_PHY_INFO BIT(6)
424415 #define RX_DMA_STATUS_FFM BIT(7) /* EtherType Flex Filter Match */
425416
417
+/* IEEE 802.11, 8.5.2 EAPOL-Key frames */
418
+#define WIL_KEY_INFO_KEY_TYPE BIT(3) /* val of 1 = Pairwise, 0 = Group key */
419
+
420
+#define WIL_KEY_INFO_MIC BIT(8)
421
+#define WIL_KEY_INFO_ENCR_KEY_DATA BIT(12) /* for rsn only */
422
+
423
+#define WIL_EAP_NONCE_LEN 32
424
+#define WIL_EAP_KEY_RSC_LEN 8
425
+#define WIL_EAP_REPLAY_COUNTER_LEN 8
426
+#define WIL_EAP_KEY_IV_LEN 16
427
+#define WIL_EAP_KEY_ID_LEN 8
428
+
429
+enum {
430
+ WIL_1X_TYPE_EAP_PACKET = 0,
431
+ WIL_1X_TYPE_EAPOL_START = 1,
432
+ WIL_1X_TYPE_EAPOL_LOGOFF = 2,
433
+ WIL_1X_TYPE_EAPOL_KEY = 3,
434
+};
435
+
436
+#define WIL_EAPOL_KEY_TYPE_RSN 2
437
+#define WIL_EAPOL_KEY_TYPE_WPA 254
438
+
439
+struct wil_1x_hdr {
440
+ u8 version;
441
+ u8 type;
442
+ __be16 length;
443
+ /* followed by data */
444
+} __packed;
445
+
446
+struct wil_eapol_key {
447
+ u8 type;
448
+ __be16 key_info;
449
+ __be16 key_length;
450
+ u8 replay_counter[WIL_EAP_REPLAY_COUNTER_LEN];
451
+ u8 key_nonce[WIL_EAP_NONCE_LEN];
452
+ u8 key_iv[WIL_EAP_KEY_IV_LEN];
453
+ u8 key_rsc[WIL_EAP_KEY_RSC_LEN];
454
+ u8 key_id[WIL_EAP_KEY_ID_LEN];
455
+} __packed;
456
+
426457 struct vring_rx_dma {
427458 u32 d0;
428459 struct wil_ring_dma_addr addr;
....@@ -457,6 +488,18 @@
457488 union wil_tx_desc tx;
458489 union wil_rx_desc rx;
459490 } __packed;
491
+
492
+struct packet_rx_info {
493
+ u8 cid;
494
+};
495
+
496
+/* this struct will be stored in the skb cb buffer
497
+ * max length of the struct is limited to 48 bytes
498
+ */
499
+struct skb_rx_info {
500
+ struct vring_rx_desc rx_desc;
501
+ struct packet_rx_info rx_info;
502
+};
460503
461504 static inline int wil_rxdesc_tid(struct vring_rx_desc *d)
462505 {
....@@ -530,11 +573,6 @@
530573 return WIL_GET_BITS(d->mac.d1, 13, 14);
531574 }
532575
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
-
538576 static inline struct vring_rx_desc *wil_skb_rxdesc(struct sk_buff *skb)
539577 {
540578 return (void *)skb->cb;
....@@ -560,11 +598,25 @@
560598 return wil_ring_next_tail(ring) == ring->swhead;
561599 }
562600
563
-static inline bool wil_need_txstat(struct sk_buff *skb)
601
+static inline u8 *wil_skb_get_da(struct sk_buff *skb)
564602 {
565603 struct ethhdr *eth = (void *)skb->data;
566604
567
- return is_unicast_ether_addr(eth->h_dest) && skb->sk &&
605
+ return eth->h_dest;
606
+}
607
+
608
+static inline u8 *wil_skb_get_sa(struct sk_buff *skb)
609
+{
610
+ struct ethhdr *eth = (void *)skb->data;
611
+
612
+ return eth->h_source;
613
+}
614
+
615
+static inline bool wil_need_txstat(struct sk_buff *skb)
616
+{
617
+ const u8 *da = wil_skb_get_da(skb);
618
+
619
+ return is_unicast_ether_addr(da) && skb->sk &&
568620 (skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS);
569621 }
570622
....@@ -610,7 +662,23 @@
610662 return val >= min && val < max;
611663 }
612664
665
+static inline u8 wil_skb_get_cid(struct sk_buff *skb)
666
+{
667
+ struct skb_rx_info *skb_rx_info = (void *)skb->cb;
668
+
669
+ return skb_rx_info->rx_info.cid;
670
+}
671
+
672
+static inline void wil_skb_set_cid(struct sk_buff *skb, u8 cid)
673
+{
674
+ struct skb_rx_info *skb_rx_info = (void *)skb->cb;
675
+
676
+ skb_rx_info->rx_info.cid = cid;
677
+}
678
+
613679 void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev);
680
+void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid,
681
+ struct wil_net_stats *stats, bool gro);
614682 void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb);
615683 void wil_rx_bar(struct wil6210_priv *wil, struct wil6210_vif *vif,
616684 u8 cid, u8 tid, u16 seq);