hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/ethernet/amazon/ena/ena_com.h
....@@ -1,33 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
2
- * Copyright 2015 Amazon.com, Inc. or its affiliates.
3
- *
4
- * This software is available to you under a choice of one of two
5
- * licenses. You may choose to be licensed under the terms of the GNU
6
- * General Public License (GPL) Version 2, available from the file
7
- * COPYING in the main directory of this source tree, or the
8
- * BSD license below:
9
- *
10
- * Redistribution and use in source and binary forms, with or
11
- * without modification, are permitted provided that the following
12
- * conditions are met:
13
- *
14
- * - Redistributions of source code must retain the above
15
- * copyright notice, this list of conditions and the following
16
- * disclaimer.
17
- *
18
- * - Redistributions in binary form must reproduce the above
19
- * copyright notice, this list of conditions and the following
20
- * disclaimer in the documentation and/or other materials
21
- * provided with the distribution.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- * SOFTWARE.
3
+ * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
314 */
325
336 #ifndef ENA_COM
....@@ -37,6 +10,8 @@
3710 #include <linux/delay.h>
3811 #include <linux/dma-mapping.h>
3912 #include <linux/gfp.h>
13
+#include <linux/io.h>
14
+#include <linux/prefetch.h>
4015 #include <linux/sched.h>
4116 #include <linux/sizes.h>
4217 #include <linux/spinlock.h>
....@@ -52,9 +27,9 @@
5227 #undef pr_fmt
5328 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
5429
55
-#define ENA_MAX_NUM_IO_QUEUES 128U
30
+#define ENA_MAX_NUM_IO_QUEUES 128U
5631 /* We need to queues for each IO (on for Tx and one for Rx) */
57
-#define ENA_TOTAL_NUM_QUEUES (2 * (ENA_MAX_NUM_IO_QUEUES))
32
+#define ENA_TOTAL_NUM_QUEUES (2 * (ENA_MAX_NUM_IO_QUEUES))
5833
5934 #define ENA_MAX_HANDLERS 256
6035
....@@ -71,48 +46,22 @@
7146 /*****************************************************************************/
7247 /* ENA adaptive interrupt moderation settings */
7348
74
-#define ENA_INTR_LOWEST_USECS (0)
75
-#define ENA_INTR_LOWEST_PKTS (3)
76
-#define ENA_INTR_LOWEST_BYTES (2 * 1524)
49
+#define ENA_INTR_INITIAL_TX_INTERVAL_USECS 64
50
+#define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0
51
+#define ENA_DEFAULT_INTR_DELAY_RESOLUTION 1
7752
78
-#define ENA_INTR_LOW_USECS (32)
79
-#define ENA_INTR_LOW_PKTS (12)
80
-#define ENA_INTR_LOW_BYTES (16 * 1024)
53
+#define ENA_HASH_KEY_SIZE 40
8154
82
-#define ENA_INTR_MID_USECS (80)
83
-#define ENA_INTR_MID_PKTS (48)
84
-#define ENA_INTR_MID_BYTES (64 * 1024)
55
+#define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF
8556
86
-#define ENA_INTR_HIGH_USECS (128)
87
-#define ENA_INTR_HIGH_PKTS (96)
88
-#define ENA_INTR_HIGH_BYTES (128 * 1024)
57
+#define ENA_FEATURE_MAX_QUEUE_EXT_VER 1
8958
90
-#define ENA_INTR_HIGHEST_USECS (192)
91
-#define ENA_INTR_HIGHEST_PKTS (128)
92
-#define ENA_INTR_HIGHEST_BYTES (192 * 1024)
93
-
94
-#define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196
95
-#define ENA_INTR_INITIAL_RX_INTERVAL_USECS 4
96
-#define ENA_INTR_DELAY_OLD_VALUE_WEIGHT 6
97
-#define ENA_INTR_DELAY_NEW_VALUE_WEIGHT 4
98
-#define ENA_INTR_MODER_LEVEL_STRIDE 2
99
-#define ENA_INTR_BYTE_COUNT_NOT_SUPPORTED 0xFFFFFF
100
-
101
-#define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF
102
-
103
-enum ena_intr_moder_level {
104
- ENA_INTR_MODER_LOWEST = 0,
105
- ENA_INTR_MODER_LOW,
106
- ENA_INTR_MODER_MID,
107
- ENA_INTR_MODER_HIGH,
108
- ENA_INTR_MODER_HIGHEST,
109
- ENA_INTR_MAX_NUM_OF_LEVELS,
110
-};
111
-
112
-struct ena_intr_moder_entry {
113
- unsigned int intr_moder_interval;
114
- unsigned int pkts_per_interval;
115
- unsigned int bytes_per_interval;
59
+struct ena_llq_configurations {
60
+ enum ena_admin_llq_header_location llq_header_location;
61
+ enum ena_admin_llq_ring_entry_size llq_ring_entry_size;
62
+ enum ena_admin_llq_stride_ctrl llq_stride_ctrl;
63
+ enum ena_admin_llq_num_descs_before_header llq_num_decs_before_header;
64
+ u16 llq_ring_entry_size_value;
11665 };
11766
11867 enum queue_direction {
....@@ -141,6 +90,17 @@
14190 u16 l3_hdr_len;
14291 u16 l3_hdr_offset;
14392 u16 l4_hdr_len; /* In words */
93
+};
94
+
95
+struct ena_com_llq_info {
96
+ u16 header_location_ctrl;
97
+ u16 desc_stride_ctrl;
98
+ u16 desc_list_entry_size_ctrl;
99
+ u16 desc_list_entry_size;
100
+ u16 descs_num_before_header;
101
+ u16 descs_per_entry;
102
+ u16 max_entries_in_tx_burst;
103
+ bool disable_meta_caching;
144104 };
145105
146106 struct ena_com_io_cq {
....@@ -180,6 +140,20 @@
180140
181141 } ____cacheline_aligned;
182142
143
+struct ena_com_io_bounce_buffer_control {
144
+ u8 *base_buffer;
145
+ u16 next_to_use;
146
+ u16 buffer_size;
147
+ u16 buffers_num; /* Must be a power of 2 */
148
+};
149
+
150
+/* This struct is to keep tracking the current location of the next llq entry */
151
+struct ena_com_llq_pkt_ctrl {
152
+ u8 *curr_bounce_buf;
153
+ u16 idx;
154
+ u16 descs_left_in_line;
155
+};
156
+
183157 struct ena_com_io_sq {
184158 struct ena_com_io_desc_addr desc_addr;
185159
....@@ -189,8 +163,13 @@
189163 enum queue_direction direction;
190164 enum ena_admin_placement_policy_type mem_queue_type;
191165
166
+ bool disable_meta_caching;
167
+
192168 u32 msix_vector;
193169 struct ena_com_tx_meta cached_tx_meta;
170
+ struct ena_com_llq_info llq_info;
171
+ struct ena_com_llq_pkt_ctrl llq_buf_ctrl;
172
+ struct ena_com_io_bounce_buffer_control bounce_buf_ctrl;
194173
195174 u16 q_depth;
196175 u16 qid;
....@@ -198,10 +177,12 @@
198177 u16 idx;
199178 u16 tail;
200179 u16 next_to_comp;
180
+ u16 llq_last_copy_tail;
201181 u32 tx_max_header_size;
202182 u8 phase;
203183 u8 desc_entry_size;
204184 u8 dma_addr_bits;
185
+ u16 entries_in_tx_burst_left;
205186 } ____cacheline_aligned;
206187
207188 struct ena_com_admin_cq {
....@@ -225,15 +206,16 @@
225206 };
226207
227208 struct ena_com_stats_admin {
228
- u32 aborted_cmd;
229
- u32 submitted_cmd;
230
- u32 completed_cmd;
231
- u32 out_of_space;
232
- u32 no_completion;
209
+ u64 aborted_cmd;
210
+ u64 submitted_cmd;
211
+ u64 completed_cmd;
212
+ u64 out_of_space;
213
+ u64 no_completion;
233214 };
234215
235216 struct ena_com_admin_queue {
236217 void *q_dmadev;
218
+ struct ena_com_dev *ena_dev;
237219 spinlock_t q_lock; /* spinlock for the admin queue */
238220
239221 struct ena_comp_ctx *comp_ctx;
....@@ -244,6 +226,9 @@
244226
245227 /* Indicate if the admin queue should poll for completion */
246228 bool polling;
229
+
230
+ /* Define if fallback to polling mode should occur */
231
+ bool auto_polling;
247232
248233 u16 curr_cmd_id;
249234
....@@ -333,16 +318,28 @@
333318 struct ena_host_attribute host_attr;
334319 bool adaptive_coalescing;
335320 u16 intr_delay_resolution;
321
+
322
+ /* interrupt moderation intervals are in usec divided by
323
+ * intr_delay_resolution, which is supplied by the device.
324
+ */
336325 u32 intr_moder_tx_interval;
326
+ u32 intr_moder_rx_interval;
327
+
337328 struct ena_intr_moder_entry *intr_moder_tbl;
329
+
330
+ struct ena_com_llq_info llq_info;
331
+
332
+ u32 ena_min_poll_delay_us;
338333 };
339334
340335 struct ena_com_dev_get_features_ctx {
341336 struct ena_admin_queue_feature_desc max_queues;
337
+ struct ena_admin_queue_ext_feature_desc max_queue_ext;
342338 struct ena_admin_device_attr_feature_desc dev_attr;
343339 struct ena_admin_feature_aenq_desc aenq;
344340 struct ena_admin_feature_offload_desc offload;
345341 struct ena_admin_ena_hw_hints hw_hints;
342
+ struct ena_admin_feature_llq_desc llq;
346343 };
347344
348345 struct ena_com_create_io_ctx {
....@@ -377,7 +374,7 @@
377374 */
378375 int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev);
379376
380
-/* ena_com_set_mmio_read_mode - Enable/disable the mmio reg read mechanism
377
+/* ena_com_set_mmio_read_mode - Enable/disable the indirect mmio reg read mechanism
381378 * @ena_dev: ENA communication layer struct
382379 * @readless_supported: readless mode (enable/disable)
383380 */
....@@ -398,8 +395,6 @@
398395 /* ena_com_admin_init - Init the admin and the async queues
399396 * @ena_dev: ENA communication layer struct
400397 * @aenq_handlers: Those handlers to be called upon event.
401
- * @init_spinlock: Indicate if this method should init the admin spinlock or
402
- * the spinlock was init before (for example, in a case of FLR).
403398 *
404399 * Initialize the admin submission and completion queues.
405400 * Initialize the asynchronous events notification queues.
....@@ -407,8 +402,7 @@
407402 * @return - 0 on success, negative value on failure.
408403 */
409404 int ena_com_admin_init(struct ena_com_dev *ena_dev,
410
- struct ena_aenq_handlers *aenq_handlers,
411
- bool init_spinlock);
405
+ struct ena_aenq_handlers *aenq_handlers);
412406
413407 /* ena_com_admin_destroy - Destroy the admin and the async events queues.
414408 * @ena_dev: ENA communication layer struct
....@@ -488,22 +482,21 @@
488482 */
489483 void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling);
490484
491
-/* ena_com_set_admin_polling_mode - Get the admin completion queue polling mode
485
+/* ena_com_set_admin_auto_polling_mode - Enable autoswitch to polling mode
492486 * @ena_dev: ENA communication layer struct
487
+ * @polling: Enable/Disable polling mode
493488 *
494
- * Get the admin completion mode.
495
- * If polling mode is on, ena_com_execute_admin_command will perform a
496
- * polling on the admin completion queue for the commands completion,
497
- * otherwise it will wait on wait event.
498
- *
499
- * @return state
489
+ * Set the autopolling mode.
490
+ * If autopolling is on:
491
+ * In case of missing interrupt when data is available switch to polling.
500492 */
501
-bool ena_com_get_ena_admin_polling_mode(struct ena_com_dev *ena_dev);
493
+void ena_com_set_admin_auto_polling_mode(struct ena_com_dev *ena_dev,
494
+ bool polling);
502495
503496 /* ena_com_admin_q_comp_intr_handler - admin queue interrupt handler
504497 * @ena_dev: ENA communication layer struct
505498 *
506
- * This method go over the admin completion queue and wake up all the pending
499
+ * This method goes over the admin completion queue and wakes up all the pending
507500 * threads that wait on the commands wait event.
508501 *
509502 * @note: Should be called after MSI-X interrupt.
....@@ -513,10 +506,10 @@
513506 /* ena_com_aenq_intr_handler - AENQ interrupt handler
514507 * @ena_dev: ENA communication layer struct
515508 *
516
- * This method go over the async event notification queue and call the proper
509
+ * This method goes over the async event notification queue and calls the proper
517510 * aenq handler.
518511 */
519
-void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data);
512
+void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data);
520513
521514 /* ena_com_abort_admin_commands - Abort all the outstanding admin commands.
522515 * @ena_dev: ENA communication layer struct
....@@ -530,14 +523,14 @@
530523 /* ena_com_wait_for_abort_completion - Wait for admin commands abort.
531524 * @ena_dev: ENA communication layer struct
532525 *
533
- * This method wait until all the outstanding admin commands will be completed.
526
+ * This method waits until all the outstanding admin commands are completed.
534527 */
535528 void ena_com_wait_for_abort_completion(struct ena_com_dev *ena_dev);
536529
537530 /* ena_com_validate_version - Validate the device parameters
538531 * @ena_dev: ENA communication layer struct
539532 *
540
- * This method validate the device parameters are the same as the saved
533
+ * This method verifies the device parameters are the same as the saved
541534 * parameters in ena_dev.
542535 * This method is useful after device reset, to validate the device mac address
543536 * and the device offloads are the same as before the reset.
....@@ -595,6 +588,15 @@
595588 */
596589 int ena_com_get_dev_basic_stats(struct ena_com_dev *ena_dev,
597590 struct ena_admin_basic_stats *stats);
591
+
592
+/* ena_com_get_eni_stats - Get extended network interface statistics
593
+ * @ena_dev: ENA communication layer struct
594
+ * @stats: stats return value
595
+ *
596
+ * @return: 0 on Success and negative value otherwise.
597
+ */
598
+int ena_com_get_eni_stats(struct ena_com_dev *ena_dev,
599
+ struct ena_admin_eni_stats *stats);
598600
599601 /* ena_com_set_dev_mtu - Configure the device mtu.
600602 * @ena_dev: ENA communication layer struct
....@@ -671,23 +673,32 @@
671673 */
672674 int ena_com_set_hash_function(struct ena_com_dev *ena_dev);
673675
674
-/* ena_com_get_hash_function - Retrieve the hash function and the hash key
675
- * from the device.
676
+/* ena_com_get_hash_function - Retrieve the hash function from the device.
676677 * @ena_dev: ENA communication layer struct
677678 * @func: hash function
678
- * @key: hash key
679679 *
680
- * Retrieve the hash function and the hash key from the device.
680
+ * Retrieve the hash function from the device.
681681 *
682
- * @note: If the caller called ena_com_fill_hash_function but didn't flash
682
+ * @note: If the caller called ena_com_fill_hash_function but didn't flush
683683 * it to the device, the new configuration will be lost.
684684 *
685685 * @return: 0 on Success and negative value otherwise.
686686 */
687687 int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
688
- enum ena_admin_hash_functions *func,
689
- u8 *key);
688
+ enum ena_admin_hash_functions *func);
690689
690
+/* ena_com_get_hash_key - Retrieve the hash key
691
+ * @ena_dev: ENA communication layer struct
692
+ * @key: hash key
693
+ *
694
+ * Retrieve the hash key.
695
+ *
696
+ * @note: If the caller called ena_com_fill_hash_key but didn't flush
697
+ * it to the device, the new configuration will be lost.
698
+ *
699
+ * @return: 0 on Success and negative value otherwise.
700
+ */
701
+int ena_com_get_hash_key(struct ena_com_dev *ena_dev, u8 *key);
691702 /* ena_com_fill_hash_ctrl - Fill RSS hash control
692703 * @ena_dev: ENA communication layer struct.
693704 * @proto: The protocol to configure.
....@@ -722,7 +733,7 @@
722733 *
723734 * Retrieve the hash control from the device.
724735 *
725
- * @note, If the caller called ena_com_fill_hash_ctrl but didn't flash
736
+ * @note: If the caller called ena_com_fill_hash_ctrl but didn't flush
726737 * it to the device, the new configuration will be lost.
727738 *
728739 * @return: 0 on Success and negative value otherwise.
....@@ -774,7 +785,7 @@
774785 *
775786 * Retrieve the RSS indirection table from the device.
776787 *
777
- * @note: If the caller called ena_com_indirect_table_fill_entry but didn't flash
788
+ * @note: If the caller called ena_com_indirect_table_fill_entry but didn't flush
778789 * it to the device, the new configuration will be lost.
779790 *
780791 * @return: 0 on Success and negative value otherwise.
....@@ -800,14 +811,14 @@
800811 /* ena_com_delete_debug_area - Free the debug area resources.
801812 * @ena_dev: ENA communication layer struct
802813 *
803
- * Free the allocate debug area.
814
+ * Free the allocated debug area.
804815 */
805816 void ena_com_delete_debug_area(struct ena_com_dev *ena_dev);
806817
807818 /* ena_com_delete_host_info - Free the host info resources.
808819 * @ena_dev: ENA communication layer struct
809820 *
810
- * Free the allocate host info.
821
+ * Free the allocated host info.
811822 */
812823 void ena_com_delete_host_info(struct ena_com_dev *ena_dev);
813824
....@@ -848,9 +859,9 @@
848859 * @cmd_completion: command completion return value.
849860 * @cmd_comp_size: command completion size.
850861
851
- * Submit an admin command and then wait until the device will return a
862
+ * Submit an admin command and then wait until the device returns a
852863 * completion.
853
- * The completion will be copyed into cmd_comp.
864
+ * The completion will be copied into cmd_comp.
854865 *
855866 * @return - 0 on success, negative value on failure.
856867 */
....@@ -867,23 +878,12 @@
867878 */
868879 int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev);
869880
870
-/* ena_com_destroy_interrupt_moderation - Destroy interrupt moderation resources
871
- * @ena_dev: ENA communication layer struct
872
- */
873
-void ena_com_destroy_interrupt_moderation(struct ena_com_dev *ena_dev);
874
-
875881 /* ena_com_interrupt_moderation_supported - Return if interrupt moderation
876882 * capability is supported by the device.
877883 *
878884 * @return - supported or not.
879885 */
880886 bool ena_com_interrupt_moderation_supported(struct ena_com_dev *ena_dev);
881
-
882
-/* ena_com_config_default_interrupt_moderation_table - Restore the interrupt
883
- * moderation table back to the default parameters.
884
- * @ena_dev: ENA communication layer struct
885
- */
886
-void ena_com_config_default_interrupt_moderation_table(struct ena_com_dev *ena_dev);
887887
888888 /* ena_com_update_nonadaptive_moderation_interval_tx - Update the
889889 * non-adaptive interval in Tx direction.
....@@ -921,28 +921,15 @@
921921 */
922922 unsigned int ena_com_get_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev);
923923
924
-/* ena_com_init_intr_moderation_entry - Update a single entry in the interrupt
925
- * moderation table.
924
+/* ena_com_config_dev_mode - Configure the placement policy of the device.
926925 * @ena_dev: ENA communication layer struct
927
- * @level: Interrupt moderation table level
928
- * @entry: Entry value
929
- *
930
- * Update a single entry in the interrupt moderation table.
926
+ * @llq_features: LLQ feature descriptor, retrieve via
927
+ * ena_com_get_dev_attr_feat.
928
+ * @ena_llq_config: The default driver LLQ parameters configurations
931929 */
932
-void ena_com_init_intr_moderation_entry(struct ena_com_dev *ena_dev,
933
- enum ena_intr_moder_level level,
934
- struct ena_intr_moder_entry *entry);
935
-
936
-/* ena_com_get_intr_moderation_entry - Init ena_intr_moder_entry.
937
- * @ena_dev: ENA communication layer struct
938
- * @level: Interrupt moderation table level
939
- * @entry: Entry to fill.
940
- *
941
- * Initialize the entry according to the adaptive interrupt moderation table.
942
- */
943
-void ena_com_get_intr_moderation_entry(struct ena_com_dev *ena_dev,
944
- enum ena_intr_moder_level level,
945
- struct ena_intr_moder_entry *entry);
930
+int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,
931
+ struct ena_admin_feature_llq_desc *llq_features,
932
+ struct ena_llq_configurations *llq_default_config);
946933
947934 static inline bool ena_com_get_adaptive_moderation_enabled(struct ena_com_dev *ena_dev)
948935 {
....@@ -959,80 +946,11 @@
959946 ena_dev->adaptive_coalescing = false;
960947 }
961948
962
-/* ena_com_calculate_interrupt_delay - Calculate new interrupt delay
963
- * @ena_dev: ENA communication layer struct
964
- * @pkts: Number of packets since the last update
965
- * @bytes: Number of bytes received since the last update.
966
- * @smoothed_interval: Returned interval
967
- * @moder_tbl_idx: Current table level as input update new level as return
968
- * value.
969
- */
970
-static inline void ena_com_calculate_interrupt_delay(struct ena_com_dev *ena_dev,
971
- unsigned int pkts,
972
- unsigned int bytes,
973
- unsigned int *smoothed_interval,
974
- unsigned int *moder_tbl_idx)
975
-{
976
- enum ena_intr_moder_level curr_moder_idx, new_moder_idx;
977
- struct ena_intr_moder_entry *curr_moder_entry;
978
- struct ena_intr_moder_entry *pred_moder_entry;
979
- struct ena_intr_moder_entry *new_moder_entry;
980
- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl;
981
- unsigned int interval;
982
-
983
- /* We apply adaptive moderation on Rx path only.
984
- * Tx uses static interrupt moderation.
985
- */
986
- if (!pkts || !bytes)
987
- /* Tx interrupt, or spurious interrupt,
988
- * in both cases we just use same delay values
989
- */
990
- return;
991
-
992
- curr_moder_idx = (enum ena_intr_moder_level)(*moder_tbl_idx);
993
- if (unlikely(curr_moder_idx >= ENA_INTR_MAX_NUM_OF_LEVELS)) {
994
- pr_err("Wrong moderation index %u\n", curr_moder_idx);
995
- return;
996
- }
997
-
998
- curr_moder_entry = &intr_moder_tbl[curr_moder_idx];
999
- new_moder_idx = curr_moder_idx;
1000
-
1001
- if (curr_moder_idx == ENA_INTR_MODER_LOWEST) {
1002
- if ((pkts > curr_moder_entry->pkts_per_interval) ||
1003
- (bytes > curr_moder_entry->bytes_per_interval))
1004
- new_moder_idx =
1005
- (enum ena_intr_moder_level)(curr_moder_idx + ENA_INTR_MODER_LEVEL_STRIDE);
1006
- } else {
1007
- pred_moder_entry = &intr_moder_tbl[curr_moder_idx - ENA_INTR_MODER_LEVEL_STRIDE];
1008
-
1009
- if ((pkts <= pred_moder_entry->pkts_per_interval) ||
1010
- (bytes <= pred_moder_entry->bytes_per_interval))
1011
- new_moder_idx =
1012
- (enum ena_intr_moder_level)(curr_moder_idx - ENA_INTR_MODER_LEVEL_STRIDE);
1013
- else if ((pkts > curr_moder_entry->pkts_per_interval) ||
1014
- (bytes > curr_moder_entry->bytes_per_interval)) {
1015
- if (curr_moder_idx != ENA_INTR_MODER_HIGHEST)
1016
- new_moder_idx =
1017
- (enum ena_intr_moder_level)(curr_moder_idx + ENA_INTR_MODER_LEVEL_STRIDE);
1018
- }
1019
- }
1020
- new_moder_entry = &intr_moder_tbl[new_moder_idx];
1021
-
1022
- interval = new_moder_entry->intr_moder_interval;
1023
- *smoothed_interval = (
1024
- (interval * ENA_INTR_DELAY_NEW_VALUE_WEIGHT +
1025
- ENA_INTR_DELAY_OLD_VALUE_WEIGHT * (*smoothed_interval)) + 5) /
1026
- 10;
1027
-
1028
- *moder_tbl_idx = new_moder_idx;
1029
-}
1030
-
1031949 /* ena_com_update_intr_reg - Prepare interrupt register
1032950 * @intr_reg: interrupt register to update.
1033951 * @rx_delay_interval: Rx interval in usecs
1034952 * @tx_delay_interval: Tx interval in usecs
1035
- * @unmask: unask enable/disable
953
+ * @unmask: unmask enable/disable
1036954 *
1037955 * Prepare interrupt update register with the supplied parameters.
1038956 */
....@@ -1053,4 +971,21 @@
1053971 intr_reg->intr_control |= ENA_ETH_IO_INTR_REG_INTR_UNMASK_MASK;
1054972 }
1055973
974
+static inline u8 *ena_com_get_next_bounce_buffer(struct ena_com_io_bounce_buffer_control *bounce_buf_ctrl)
975
+{
976
+ u16 size, buffers_num;
977
+ u8 *buf;
978
+
979
+ size = bounce_buf_ctrl->buffer_size;
980
+ buffers_num = bounce_buf_ctrl->buffers_num;
981
+
982
+ buf = bounce_buf_ctrl->base_buffer +
983
+ (bounce_buf_ctrl->next_to_use++ & (buffers_num - 1)) * size;
984
+
985
+ prefetchw(bounce_buf_ctrl->base_buffer +
986
+ (bounce_buf_ctrl->next_to_use & (buffers_num - 1)) * size);
987
+
988
+ return buf;
989
+}
990
+
1056991 #endif /* !(ENA_COM) */