hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/wireless/ath/wil6210/txrx_edma.h
....@@ -1,17 +1,6 @@
1
+/* SPDX-License-Identifier: ISC */
12 /*
2
- * Copyright (c) 2012-2016,2018, The Linux Foundation. All rights reserved.
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3
+ * Copyright (c) 2012-2016,2018-2019, The Linux Foundation. All rights reserved.
154 */
165
176 #ifndef WIL6210_TXRX_EDMA_H
....@@ -23,9 +12,9 @@
2312 #define WIL_SRING_SIZE_ORDER_MIN (WIL_RING_SIZE_ORDER_MIN)
2413 #define WIL_SRING_SIZE_ORDER_MAX (WIL_RING_SIZE_ORDER_MAX)
2514 /* RX sring order should be bigger than RX ring order */
26
-#define WIL_RX_SRING_SIZE_ORDER_DEFAULT (11)
27
-#define WIL_TX_SRING_SIZE_ORDER_DEFAULT (12)
28
-#define WIL_RX_BUFF_ARR_SIZE_DEFAULT (1536)
15
+#define WIL_RX_SRING_SIZE_ORDER_DEFAULT (12)
16
+#define WIL_TX_SRING_SIZE_ORDER_DEFAULT (14)
17
+#define WIL_RX_BUFF_ARR_SIZE_DEFAULT (2600)
2918
3019 #define WIL_DEFAULT_RX_STATUS_RING_ID 0
3120 #define WIL_RX_DESC_RING_ID 0
....@@ -57,7 +46,7 @@
5746
5847 #define WIL_RX_EDMA_DLPF_LU_MISS_TID_POS 5
5948
60
-#define WIL_RX_EDMA_MID_VALID_BIT BIT(22)
49
+#define WIL_RX_EDMA_MID_VALID_BIT BIT(20)
6150
6251 #define WIL_EDMA_DESC_TX_MAC_CFG_0_QID_POS 16
6352 #define WIL_EDMA_DESC_TX_MAC_CFG_0_QID_LEN 6
....@@ -255,8 +244,8 @@
255244 * calculated, Bit1- L4Err - TCP/UDP Checksum Error
256245 * bit 7 : Reserved:1
257246 * bit 8..19 : Flow ID:12 - MSDU flow ID
258
- * bit 20..21 : MID:2 - The MAC ID
259
- * bit 22 : MID_V:1 - The MAC ID field is valid
247
+ * bit 20 : MID_V:1 - The MAC ID field is valid
248
+ * bit 21..22 : MID:2 - The MAC ID
260249 * bit 23 : L3T:1 - IP types: 0-IPv6, 1-IPv4
261250 * bit 24 : L4T:1 - Layer 4 Type: 0-UDP, 1-TCP
262251 * bit 25 : BC:1 - The received MPDU is broadcast
....@@ -341,8 +330,10 @@
341330 u32 d0;
342331 u32 d1;
343332 __le16 seq_num; /* only lower 12 bits */
344
- u16 pn_15_0;
345
- u32 pn_47_16;
333
+ struct_group_attr(pn, __packed,
334
+ u16 pn_15_0;
335
+ u32 pn_47_16;
336
+ );
346337 } __packed;
347338
348339 struct wil_rx_status_extended {
....@@ -364,6 +355,12 @@
364355 {
365356 return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d1,
366357 16, 21);
358
+}
359
+
360
+static inline u8 wil_rx_status_get_cb_mode(void *msg)
361
+{
362
+ return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d1,
363
+ 22, 23);
367364 }
368365
369366 static inline u16 wil_rx_status_get_flow_id(void *msg)
....@@ -415,16 +412,16 @@
415412 return val & WIL_RX_EDMA_DLPF_LU_MISS_CID_TID_MASK;
416413 }
417414
418
-static inline int wil_rx_status_get_desc_rdy_bit(void *msg)
419
-{
420
- return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d0,
421
- 31, 31);
422
-}
423
-
424415 static inline int wil_rx_status_get_eop(void *msg) /* EoP = End of Packet */
425416 {
426417 return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d0,
427418 30, 30);
419
+}
420
+
421
+static inline void wil_rx_status_reset_buff_id(struct wil_status_ring *s)
422
+{
423
+ ((struct wil_rx_status_compressed *)
424
+ (s->va + (s->elem_size * s->swhead)))->buff_id = 0;
428425 }
429426
430427 static inline __le16 wil_rx_status_get_buff_id(void *msg)
....@@ -484,7 +481,7 @@
484481 return 0; /* use the default MID */
485482
486483 return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d0,
487
- 20, 21);
484
+ 21, 22);
488485 }
489486
490487 static inline int wil_rx_status_get_error(void *msg)
....@@ -511,6 +508,45 @@
511508 5, 6);
512509 }
513510
511
+/* L4 L3 Expected result
512
+ * 0 0 Ok. No L3 and no L4 known protocols found.
513
+ * Treated as L2 packet. (no offloads on this packet)
514
+ * 0 1 Ok. It means that L3 was found, and checksum check passed.
515
+ * No known L4 protocol was found.
516
+ * 0 2 It means that L3 protocol was found, and checksum check failed.
517
+ * No L4 known protocol was found.
518
+ * 1 any Ok. It means that L4 was found, and checksum check passed.
519
+ * 3 0 Not a possible scenario.
520
+ * 3 1 Recalculate. It means that L3 protocol was found, and checksum
521
+ * passed. But L4 checksum failed. Need to see if really failed,
522
+ * or due to fragmentation.
523
+ * 3 2 Both L3 and L4 checksum check failed.
524
+ */
525
+static inline int wil_rx_status_get_checksum(void *msg,
526
+ struct wil_net_stats *stats)
527
+{
528
+ int l3_rx_status = wil_rx_status_get_l3_rx_status(msg);
529
+ int l4_rx_status = wil_rx_status_get_l4_rx_status(msg);
530
+
531
+ if (l4_rx_status == 1)
532
+ return CHECKSUM_UNNECESSARY;
533
+
534
+ if (l4_rx_status == 0 && l3_rx_status == 1)
535
+ return CHECKSUM_UNNECESSARY;
536
+
537
+ if (l3_rx_status == 0 && l4_rx_status == 0)
538
+ /* L2 packet */
539
+ return CHECKSUM_NONE;
540
+
541
+ /* If HW reports bad checksum, let IP stack re-check it
542
+ * For example, HW doesn't understand Microsoft IP stack that
543
+ * mis-calculates TCP checksum - if it should be 0x0,
544
+ * it writes 0xffff in violation of RFC 1624
545
+ */
546
+ stats->rx_csum_err++;
547
+ return CHECKSUM_NONE;
548
+}
549
+
514550 static inline int wil_rx_status_get_security(void *msg)
515551 {
516552 return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d0,