From 87c48ee54f5b0d4c56f1705256f19a5311ec5bf8 Mon Sep 17 00:00:00 2001 From: Noah Meyerhans Date: Mon, 30 Sep 2019 17:20:24 -0700 Subject: [PATCH] drivers/net/ethernet/amazon: Backport ENA driver from Linux 5.4 --- debian/changelog | 4 + ...where-ring-allocation-backoff-stoppe.patch | 39 ++ ...QUEUES_EXT-get-feature-admin-command.patch | 351 +++++++++++++++++ ...ool-function-for-changing-io-queue-s.patch | 106 +++++ .../net-ena-add-good-checksum-counter.patch | 72 ++++ ...dd-handling-of-llq-max-tx-burst-size.patch | 232 +++++++++++ ..._moder_rx_interval-to-struct-ena_com.patch | 118 ++++++ ...-newline-at-the-end-of-pr_err-prints.patch | 91 +++++ ...ort-for-changing-max_header_size-in-.patch | 54 +++ ...w-automatic-fallback-to-polling-mode.patch | 103 +++++ ...eue-allocation-backoff-when-low-on-m.patch | 323 ++++++++++++++++ ...ena_probe-function-variables-in-reve.patch | 49 +++ ...ena-don-t-wake-up-tx-queue-when-down.patch | 52 +++ ...able-negotiating-larger-Rx-ring-size.patch | 270 +++++++++++++ ...he-interrupt_moderation-in-driver_su.patch | 63 +++ ...ree-napi-resources-when-ena_up-fails.patch | 34 ++ ...com_fill_hash_function-implementatio.patch | 31 ++ ...rrect-test-of-supported-hash-functio.patch | 36 ++ ...rrect-update-of-intr_delay_resolutio.patch | 89 +++++ ...ieval-of-nonadaptive-interrupt-moder.patch | 45 +++ ...urn-value-of-ena_com_config_llq_info.patch | 34 ++ ...freed-objects-to-NULL-to-avoid-faili.patch | 91 +++++ ...ped-parameters-when-calling-ena_com_.patch | 32 ++ ...ate-of-interrupt-moderation-register.patch | 39 ++ ...latency-by-disabling-adaptive-interr.patch | 41 ++ ...tool-show-correct-current-and-max-qu.patch | 53 +++ ...ptimise-calculations-for-CQ-doorbell.patch | 50 +++ ...net-ena-reimplement-set-get_coalesce.patch | 158 ++++++++ ...ll-old-adaptive-rx-interrupt-moderat.patch | 361 ++++++++++++++++++ ...ode-duplication-in-ena_com_update_no.patch | 71 ++++ ...na_restore_ethtool_params-and-releva.patch | 59 +++ ...-inline-keyword-from-functions-in-.c.patch | 244 ++++++++++++ ...ld-adaptive-interrupt-moderation-cod.patch | 83 ++++ ...free_tx-rx_ids-union-with-single-fre.patch | 198 ++++++++++ ...o-dim-algorithm-for-rx-adaptive-inte.patch | 163 ++++++++ ...e-driver-version-from-2.0.2-to-2.0.3.patch | 27 ++ ...e-driver-version-from-2.0.3-to-2.1.0.patch | 32 ++ ...info_once-instead-of-static-variable.patch | 34 ++ debian/patches/series | 38 ++ 39 files changed, 3970 insertions(+) create mode 100644 debian/patches/features/all/ena/net-ena-Fix-bug-where-ring-allocation-backoff-stoppe.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-MAX_QUEUES_EXT-get-feature-admin-command.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-ethtool-function-for-changing-io-queue-s.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-good-checksum-counter.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-handling-of-llq-max-tx-burst-size.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-intr_moder_rx_interval-to-struct-ena_com.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-newline-at-the-end-of-pr_err-prints.patch create mode 100644 debian/patches/features/all/ena/net-ena-add-support-for-changing-max_header_size-in-.patch create mode 100644 debian/patches/features/all/ena/net-ena-allow-automatic-fallback-to-polling-mode.patch create mode 100644 debian/patches/features/all/ena/net-ena-allow-queue-allocation-backoff-when-low-on-m.patch create mode 100644 debian/patches/features/all/ena/net-ena-arrange-ena_probe-function-variables-in-reve.patch create mode 100644 debian/patches/features/all/ena/net-ena-don-t-wake-up-tx-queue-when-down.patch create mode 100644 debian/patches/features/all/ena/net-ena-enable-negotiating-larger-Rx-ring-size.patch create mode 100644 debian/patches/features/all/ena/net-ena-enable-the-interrupt_moderation-in-driver_su.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-Free-napi-resources-when-ena_up-fails.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-ena_com_fill_hash_function-implementatio.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-incorrect-test-of-supported-hash-functio.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-incorrect-update-of-intr_delay_resolutio.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-retrieval-of-nonadaptive-interrupt-moder.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-return-value-of-ena_com_config_llq_info.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-set-freed-objects-to-NULL-to-avoid-faili.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-swapped-parameters-when-calling-ena_com_.patch create mode 100644 debian/patches/features/all/ena/net-ena-fix-update-of-interrupt-moderation-register.patch create mode 100644 debian/patches/features/all/ena/net-ena-improve-latency-by-disabling-adaptive-interr.patch create mode 100644 debian/patches/features/all/ena/net-ena-make-ethtool-show-correct-current-and-max-qu.patch create mode 100644 debian/patches/features/all/ena/net-ena-optimise-calculations-for-CQ-doorbell.patch create mode 100644 debian/patches/features/all/ena/net-ena-reimplement-set-get_coalesce.patch create mode 100644 debian/patches/features/all/ena/net-ena-remove-all-old-adaptive-rx-interrupt-moderat.patch create mode 100644 debian/patches/features/all/ena/net-ena-remove-code-duplication-in-ena_com_update_no.patch create mode 100644 debian/patches/features/all/ena/net-ena-remove-ena_restore_ethtool_params-and-releva.patch create mode 100644 debian/patches/features/all/ena/net-ena-remove-inline-keyword-from-functions-in-.c.patch create mode 100644 debian/patches/features/all/ena/net-ena-remove-old-adaptive-interrupt-moderation-cod.patch create mode 100644 debian/patches/features/all/ena/net-ena-replace-free_tx-rx_ids-union-with-single-fre.patch create mode 100644 debian/patches/features/all/ena/net-ena-switch-to-dim-algorithm-for-rx-adaptive-inte.patch create mode 100644 debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.2-to-2.0.3.patch create mode 100644 debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.3-to-2.1.0.patch create mode 100644 debian/patches/features/all/ena/net-ena-use-dev_info_once-instead-of-static-variable.patch diff --git a/debian/changelog b/debian/changelog index 3a1f9a496..87f764c57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,10 @@ linux (4.19.67-3) UNRELEASED; urgency=medium [ Bastian Blank ] * [amd64/cloud-amd64] Re-enable RTC drivers. (closes: #931341) + [ Noah Meyerhans ] + * drivers/net/ethernet/amazon: Backport driver fixes from Linux 5.4 + (Closes: #941291) + -- Romain Perier Wed, 28 Aug 2019 13:28:09 +0200 linux (4.19.67-2+deb10u1) buster-security; urgency=high diff --git a/debian/patches/features/all/ena/net-ena-Fix-bug-where-ring-allocation-backoff-stoppe.patch b/debian/patches/features/all/ena/net-ena-Fix-bug-where-ring-allocation-backoff-stoppe.patch new file mode 100644 index 000000000..d2e7da1ab --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-Fix-bug-where-ring-allocation-backoff-stoppe.patch @@ -0,0 +1,39 @@ +From: Sameeh Jubran +Date: Sun, 23 Jun 2019 10:11:10 +0300 +Subject: [PATCH] net: ena: Fix bug where ring allocation backoff stopped too + late +Origin: https://git.kernel.org/linus/3e5bfb189e1a65df132fd0e3fa00fbb6feec1431 +Bug-Debian: https://bugs.debian.org/941291 + +The current code of create_queues_with_size_backoff() allows the ring size +to become as small as ENA_MIN_RING_SIZE/2. This is a bug since we don't +want the queue ring to be smaller than ENA_MIN_RING_SIZE + +In this commit we change the loop's termination condition to look at the +queue size of the next iteration instead of that of the current one, +so that the minimal queue size again becomes ENA_MIN_RING_SIZE. + +Fixes: eece4d2ab9d2 ("net: ena: add ethtool function for changing io queue sizes") + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -1836,8 +1836,8 @@ err_setup_tx: + if (cur_rx_ring_size >= cur_tx_ring_size) + new_rx_ring_size = cur_rx_ring_size / 2; + +- if (cur_tx_ring_size < ENA_MIN_RING_SIZE || +- cur_rx_ring_size < ENA_MIN_RING_SIZE) { ++ if (new_tx_ring_size < ENA_MIN_RING_SIZE || ++ new_rx_ring_size < ENA_MIN_RING_SIZE) { + netif_err(adapter, ifup, adapter->netdev, + "Queue creation failed with the smallest possible queue size of %d for both queues. Not retrying with smaller queues\n", + ENA_MIN_RING_SIZE); diff --git a/debian/patches/features/all/ena/net-ena-add-MAX_QUEUES_EXT-get-feature-admin-command.patch b/debian/patches/features/all/ena/net-ena-add-MAX_QUEUES_EXT-get-feature-admin-command.patch new file mode 100644 index 000000000..79129d9f5 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-MAX_QUEUES_EXT-get-feature-admin-command.patch @@ -0,0 +1,351 @@ +From: Arthur Kiyanovski +Date: Tue, 11 Jun 2019 14:58:05 +0300 +Subject: [PATCH] net: ena: add MAX_QUEUES_EXT get feature admin command +Origin: https://git.kernel.org/linus/ba8ef506fb91005fc4808370b7587ab7bf4bd918 +Bug-Debian: https://bugs.debian.org/941291 + +Add a new admin command to support different queue size for Tx/Rx +queues (the change also support different SQ/CQ sizes) + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + .../net/ethernet/amazon/ena/ena_admin_defs.h | 56 +++++++++++++- + drivers/net/ethernet/amazon/ena/ena_com.c | 76 ++++++++++++------- + drivers/net/ethernet/amazon/ena/ena_com.h | 3 + + 3 files changed, 105 insertions(+), 30 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_admin_defs.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +@@ -60,6 +60,7 @@ enum ena_admin_aq_feature_id { + ENA_ADMIN_MAX_QUEUES_NUM = 2, + ENA_ADMIN_HW_HINTS = 3, + ENA_ADMIN_LLQ = 4, ++ ENA_ADMIN_MAX_QUEUES_EXT = 7, + ENA_ADMIN_RSS_HASH_FUNCTION = 10, + ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11, + ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG = 12, +@@ -421,7 +422,13 @@ struct ena_admin_get_set_feature_common_ + /* as appears in ena_admin_aq_feature_id */ + u8 feature_id; + +- u16 reserved16; ++ /* The driver specifies the max feature version it supports and the ++ * device responds with the currently supported feature version. The ++ * field is zero based ++ */ ++ u8 feature_version; ++ ++ u8 reserved8; + }; + + struct ena_admin_device_attr_feature_desc { +@@ -531,6 +538,34 @@ struct ena_admin_feature_llq_desc { + u32 max_tx_burst_size; + }; + ++struct ena_admin_queue_ext_feature_fields { ++ u32 max_tx_sq_num; ++ ++ u32 max_tx_cq_num; ++ ++ u32 max_rx_sq_num; ++ ++ u32 max_rx_cq_num; ++ ++ u32 max_tx_sq_depth; ++ ++ u32 max_tx_cq_depth; ++ ++ u32 max_rx_sq_depth; ++ ++ u32 max_rx_cq_depth; ++ ++ u32 max_tx_header_size; ++ ++ /* Maximum Descriptors number, including meta descriptor, allowed for ++ * a single Tx packet ++ */ ++ u16 max_per_packet_tx_descs; ++ ++ /* Maximum Descriptors number allowed for a single Rx packet */ ++ u16 max_per_packet_rx_descs; ++}; ++ + struct ena_admin_queue_feature_desc { + u32 max_sq_num; + +@@ -837,6 +872,19 @@ struct ena_admin_get_feat_cmd { + u32 raw[11]; + }; + ++struct ena_admin_queue_ext_feature_desc { ++ /* version */ ++ u8 version; ++ ++ u8 reserved1[3]; ++ ++ union { ++ struct ena_admin_queue_ext_feature_fields max_queue_ext; ++ ++ u32 raw[10]; ++ }; ++}; ++ + struct ena_admin_get_feat_resp { + struct ena_admin_acq_common_desc acq_common_desc; + +@@ -849,6 +897,8 @@ struct ena_admin_get_feat_resp { + + struct ena_admin_queue_feature_desc max_queue; + ++ struct ena_admin_queue_ext_feature_desc max_queue_ext; ++ + struct ena_admin_feature_aenq_desc aenq; + + struct ena_admin_get_feature_link_desc link; +@@ -913,7 +963,9 @@ struct ena_admin_aenq_common_desc { + + u16 syndrom; + +- /* 0 : phase */ ++ /* 0 : phase ++ * 7:1 : reserved - MBZ ++ */ + u8 flags; + + u8 reserved1[3]; +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -978,7 +978,8 @@ static int ena_com_get_feature_ex(struct + struct ena_admin_get_feat_resp *get_resp, + enum ena_admin_aq_feature_id feature_id, + dma_addr_t control_buf_dma_addr, +- u32 control_buff_size) ++ u32 control_buff_size, ++ u8 feature_ver) + { + struct ena_com_admin_queue *admin_queue; + struct ena_admin_get_feat_cmd get_cmd; +@@ -1009,7 +1010,7 @@ static int ena_com_get_feature_ex(struct + } + + get_cmd.control_buffer.length = control_buff_size; +- ++ get_cmd.feat_common.feature_version = feature_ver; + get_cmd.feat_common.feature_id = feature_id; + + ret = ena_com_execute_admin_command(admin_queue, +@@ -1029,13 +1030,15 @@ static int ena_com_get_feature_ex(struct + + static int ena_com_get_feature(struct ena_com_dev *ena_dev, + struct ena_admin_get_feat_resp *get_resp, +- enum ena_admin_aq_feature_id feature_id) ++ enum ena_admin_aq_feature_id feature_id, ++ u8 feature_ver) + { + return ena_com_get_feature_ex(ena_dev, + get_resp, + feature_id, + 0, +- 0); ++ 0, ++ feature_ver); + } + + static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev) +@@ -1095,7 +1098,7 @@ static int ena_com_indirect_table_alloca + int ret; + + ret = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG); ++ ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG, 0); + if (unlikely(ret)) + return ret; + +@@ -1515,7 +1518,7 @@ int ena_com_set_aenq_config(struct ena_c + struct ena_admin_get_feat_resp get_resp; + int ret; + +- ret = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_AENQ_CONFIG); ++ ret = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_AENQ_CONFIG, 0); + if (ret) { + pr_info("Can't get aenq configuration\n"); + return ret; +@@ -1890,7 +1893,7 @@ void ena_com_destroy_io_queue(struct ena + int ena_com_get_link_params(struct ena_com_dev *ena_dev, + struct ena_admin_get_feat_resp *resp) + { +- return ena_com_get_feature(ena_dev, resp, ENA_ADMIN_LINK_CONFIG); ++ return ena_com_get_feature(ena_dev, resp, ENA_ADMIN_LINK_CONFIG, 0); + } + + int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev, +@@ -1900,7 +1903,7 @@ int ena_com_get_dev_attr_feat(struct ena + int rc; + + rc = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_DEVICE_ATTRIBUTES); ++ ENA_ADMIN_DEVICE_ATTRIBUTES, 0); + if (rc) + return rc; + +@@ -1908,17 +1911,34 @@ int ena_com_get_dev_attr_feat(struct ena + sizeof(get_resp.u.dev_attr)); + ena_dev->supported_features = get_resp.u.dev_attr.supported_features; + +- rc = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_MAX_QUEUES_NUM); +- if (rc) +- return rc; ++ if (ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) { ++ rc = ena_com_get_feature(ena_dev, &get_resp, ++ ENA_ADMIN_MAX_QUEUES_EXT, ++ ENA_FEATURE_MAX_QUEUE_EXT_VER); ++ if (rc) ++ return rc; + +- memcpy(&get_feat_ctx->max_queues, &get_resp.u.max_queue, +- sizeof(get_resp.u.max_queue)); +- ena_dev->tx_max_header_size = get_resp.u.max_queue.max_header_size; ++ if (get_resp.u.max_queue_ext.version != ENA_FEATURE_MAX_QUEUE_EXT_VER) ++ return -EINVAL; ++ ++ memcpy(&get_feat_ctx->max_queue_ext, &get_resp.u.max_queue_ext, ++ sizeof(get_resp.u.max_queue_ext)); ++ ena_dev->tx_max_header_size = ++ get_resp.u.max_queue_ext.max_queue_ext.max_tx_header_size; ++ } else { ++ rc = ena_com_get_feature(ena_dev, &get_resp, ++ ENA_ADMIN_MAX_QUEUES_NUM, 0); ++ memcpy(&get_feat_ctx->max_queues, &get_resp.u.max_queue, ++ sizeof(get_resp.u.max_queue)); ++ ena_dev->tx_max_header_size = ++ get_resp.u.max_queue.max_header_size; ++ ++ if (rc) ++ return rc; ++ } + + rc = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_AENQ_CONFIG); ++ ENA_ADMIN_AENQ_CONFIG, 0); + if (rc) + return rc; + +@@ -1926,7 +1946,7 @@ int ena_com_get_dev_attr_feat(struct ena + sizeof(get_resp.u.aenq)); + + rc = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_STATELESS_OFFLOAD_CONFIG); ++ ENA_ADMIN_STATELESS_OFFLOAD_CONFIG, 0); + if (rc) + return rc; + +@@ -1936,7 +1956,7 @@ int ena_com_get_dev_attr_feat(struct ena + /* Driver hints isn't mandatory admin command. So in case the + * command isn't supported set driver hints to 0 + */ +- rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_HW_HINTS); ++ rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_HW_HINTS, 0); + + if (!rc) + memcpy(&get_feat_ctx->hw_hints, &get_resp.u.hw_hints, +@@ -1947,7 +1967,7 @@ int ena_com_get_dev_attr_feat(struct ena + else + return rc; + +- rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_LLQ); ++ rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_LLQ, 0); + if (!rc) + memcpy(&get_feat_ctx->llq, &get_resp.u.llq, + sizeof(get_resp.u.llq)); +@@ -2185,7 +2205,7 @@ int ena_com_get_offload_settings(struct + struct ena_admin_get_feat_resp resp; + + ret = ena_com_get_feature(ena_dev, &resp, +- ENA_ADMIN_STATELESS_OFFLOAD_CONFIG); ++ ENA_ADMIN_STATELESS_OFFLOAD_CONFIG, 0); + if (unlikely(ret)) { + pr_err("Failed to get offload capabilities %d\n", ret); + return ret; +@@ -2214,7 +2234,7 @@ int ena_com_set_hash_function(struct ena + + /* Validate hash function is supported */ + ret = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_RSS_HASH_FUNCTION); ++ ENA_ADMIN_RSS_HASH_FUNCTION, 0); + if (unlikely(ret)) + return ret; + +@@ -2274,7 +2294,7 @@ int ena_com_fill_hash_function(struct en + rc = ena_com_get_feature_ex(ena_dev, &get_resp, + ENA_ADMIN_RSS_HASH_FUNCTION, + rss->hash_key_dma_addr, +- sizeof(*rss->hash_key)); ++ sizeof(*rss->hash_key), 0); + if (unlikely(rc)) + return rc; + +@@ -2326,7 +2346,7 @@ int ena_com_get_hash_function(struct ena + rc = ena_com_get_feature_ex(ena_dev, &get_resp, + ENA_ADMIN_RSS_HASH_FUNCTION, + rss->hash_key_dma_addr, +- sizeof(*rss->hash_key)); ++ sizeof(*rss->hash_key), 0); + if (unlikely(rc)) + return rc; + +@@ -2351,7 +2371,7 @@ int ena_com_get_hash_ctrl(struct ena_com + rc = ena_com_get_feature_ex(ena_dev, &get_resp, + ENA_ADMIN_RSS_HASH_INPUT, + rss->hash_ctrl_dma_addr, +- sizeof(*rss->hash_ctrl)); ++ sizeof(*rss->hash_ctrl), 0); + if (unlikely(rc)) + return rc; + +@@ -2587,7 +2607,7 @@ int ena_com_indirect_table_get(struct en + rc = ena_com_get_feature_ex(ena_dev, &get_resp, + ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG, + rss->rss_ind_tbl_dma_addr, +- tbl_size); ++ tbl_size, 0); + if (unlikely(rc)) + return rc; + +@@ -2801,7 +2821,7 @@ int ena_com_init_interrupt_moderation(st + int rc; + + rc = ena_com_get_feature(ena_dev, &get_resp, +- ENA_ADMIN_INTERRUPT_MODERATION); ++ ENA_ADMIN_INTERRUPT_MODERATION, 0); + + if (rc) { + if (rc == -EOPNOTSUPP) { +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -101,6 +101,8 @@ + + #define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF + ++#define ENA_FEATURE_MAX_QUEUE_EXT_VER 1 ++ + enum ena_intr_moder_level { + ENA_INTR_MODER_LOWEST = 0, + ENA_INTR_MODER_LOW, +@@ -382,6 +384,7 @@ struct ena_com_dev { + + struct ena_com_dev_get_features_ctx { + struct ena_admin_queue_feature_desc max_queues; ++ struct ena_admin_queue_ext_feature_desc max_queue_ext; + struct ena_admin_device_attr_feature_desc dev_attr; + struct ena_admin_feature_aenq_desc aenq; + struct ena_admin_feature_offload_desc offload; diff --git a/debian/patches/features/all/ena/net-ena-add-ethtool-function-for-changing-io-queue-s.patch b/debian/patches/features/all/ena/net-ena-add-ethtool-function-for-changing-io-queue-s.patch new file mode 100644 index 000000000..227f39b3b --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-ethtool-function-for-changing-io-queue-s.patch @@ -0,0 +1,106 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:09 +0300 +Subject: [PATCH] net: ena: add ethtool function for changing io queue sizes +Origin: https://git.kernel.org/linus/eece4d2ab9d214e3b12f5ac1ed189a05793b28a5 +Bug-Debian: https://bugs.debian.org/941291 + +Implement the set_ringparam() function of the ethtool interface +to enable the changing of io queue sizes. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 22 +++++++++++++++++++ + drivers/net/ethernet/amazon/ena/ena_netdev.c | 14 ++++++++++++ + drivers/net/ethernet/amazon/ena/ena_netdev.h | 5 ++++- + 3 files changed, 40 insertions(+), 1 deletion(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -454,6 +454,27 @@ static void ena_get_ringparam(struct net + ring->rx_pending = adapter->rx_ring[0].ring_size; + } + ++static int ena_set_ringparam(struct net_device *netdev, ++ struct ethtool_ringparam *ring) ++{ ++ struct ena_adapter *adapter = netdev_priv(netdev); ++ u32 new_tx_size, new_rx_size; ++ ++ new_tx_size = ring->tx_pending < ENA_MIN_RING_SIZE ? ++ ENA_MIN_RING_SIZE : ring->tx_pending; ++ new_tx_size = rounddown_pow_of_two(new_tx_size); ++ ++ new_rx_size = ring->rx_pending < ENA_MIN_RING_SIZE ? ++ ENA_MIN_RING_SIZE : ring->rx_pending; ++ new_rx_size = rounddown_pow_of_two(new_rx_size); ++ ++ if (new_tx_size == adapter->requested_tx_ring_size && ++ new_rx_size == adapter->requested_rx_ring_size) ++ return 0; ++ ++ return ena_update_queue_sizes(adapter, new_tx_size, new_rx_size); ++} ++ + static u32 ena_flow_hash_to_flow_type(u16 hash_fields) + { + u32 data = 0; +@@ -805,6 +826,7 @@ static const struct ethtool_ops ena_etht + .get_coalesce = ena_get_coalesce, + .set_coalesce = ena_set_coalesce, + .get_ringparam = ena_get_ringparam, ++ .set_ringparam = ena_set_ringparam, + .get_sset_count = ena_get_sset_count, + .get_strings = ena_get_strings, + .get_ethtool_stats = ena_get_ethtool_stats, +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -2028,6 +2028,20 @@ static int ena_close(struct net_device * + return 0; + } + ++int ena_update_queue_sizes(struct ena_adapter *adapter, ++ u32 new_tx_size, ++ u32 new_rx_size) ++{ ++ bool dev_up; ++ ++ dev_up = test_bit(ENA_FLAG_DEV_UP, &adapter->flags); ++ ena_close(adapter->netdev); ++ adapter->requested_tx_ring_size = new_tx_size; ++ adapter->requested_rx_ring_size = new_rx_size; ++ ena_init_io_rings(adapter); ++ return dev_up ? ena_up(adapter) : 0; ++} ++ + static void ena_tx_csum(struct ena_com_tx_ctx *ena_tx_ctx, struct sk_buff *skb) + { + u32 mss = skb_shinfo(skb)->gso_size; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -81,7 +81,6 @@ + #define ENA_DEFAULT_RING_SIZE (1024) + #define ENA_MIN_RING_SIZE (256) + +- + #define ENA_TX_WAKEUP_THRESH (MAX_SKB_FRAGS + 2) + #define ENA_DEFAULT_RX_COPYBREAK (256 - NET_IP_ALIGN) + +@@ -386,6 +385,10 @@ void ena_dump_stats_to_dmesg(struct ena_ + + void ena_dump_stats_to_buf(struct ena_adapter *adapter, u8 *buf); + ++int ena_update_queue_sizes(struct ena_adapter *adapter, ++ u32 new_tx_size, ++ u32 new_rx_size); ++ + int ena_get_sset_count(struct net_device *netdev, int sset); + + #endif /* !(ENA_H) */ diff --git a/debian/patches/features/all/ena/net-ena-add-good-checksum-counter.patch b/debian/patches/features/all/ena/net-ena-add-good-checksum-counter.patch new file mode 100644 index 000000000..cde5cdad4 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-good-checksum-counter.patch @@ -0,0 +1,72 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:28 +0300 +Subject: [PATCH] net: ena: add good checksum counter +Origin: https://git.kernel.org/linus/d2eecc6ee8c92053797513e34931334dd0e85e18 +Bug-Debian: https://bugs.debian.org/941291 + +Add a new statistics to ETHTOOL to specify if the device calculated +and validated the Rx csum. + +Signed-off-by: Evgeny Shmeilin +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 3 ++- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 3 +++ + drivers/net/ethernet/amazon/ena/ena_netdev.h | 3 ++- + 3 files changed, 7 insertions(+), 2 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -88,13 +88,14 @@ static const struct ena_stats ena_stats_ + static const struct ena_stats ena_stats_rx_strings[] = { + ENA_STAT_RX_ENTRY(cnt), + ENA_STAT_RX_ENTRY(bytes), ++ ENA_STAT_RX_ENTRY(rx_copybreak_pkt), ++ ENA_STAT_RX_ENTRY(csum_good), + ENA_STAT_RX_ENTRY(refil_partial), + ENA_STAT_RX_ENTRY(bad_csum), + ENA_STAT_RX_ENTRY(page_alloc_fail), + ENA_STAT_RX_ENTRY(skb_alloc_fail), + ENA_STAT_RX_ENTRY(dma_mapping_err), + ENA_STAT_RX_ENTRY(bad_desc_num), +- ENA_STAT_RX_ENTRY(rx_copybreak_pkt), + ENA_STAT_RX_ENTRY(bad_req_id), + ENA_STAT_RX_ENTRY(empty_rx_ring), + ENA_STAT_RX_ENTRY(csum_unchecked), +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -1001,6 +1001,9 @@ static inline void ena_rx_checksum(struc + + if (likely(ena_rx_ctx->l4_csum_checked)) { + skb->ip_summed = CHECKSUM_UNNECESSARY; ++ u64_stats_update_begin(&rx_ring->syncp); ++ rx_ring->rx_stats.csum_good++; ++ u64_stats_update_end(&rx_ring->syncp); + } else { + u64_stats_update_begin(&rx_ring->syncp); + rx_ring->rx_stats.csum_unchecked++; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -221,13 +221,14 @@ struct ena_stats_tx { + struct ena_stats_rx { + u64 cnt; + u64 bytes; ++ u64 rx_copybreak_pkt; ++ u64 csum_good; + u64 refil_partial; + u64 bad_csum; + u64 page_alloc_fail; + u64 skb_alloc_fail; + u64 dma_mapping_err; + u64 bad_desc_num; +- u64 rx_copybreak_pkt; + u64 bad_req_id; + u64 empty_rx_ring; + u64 csum_unchecked; diff --git a/debian/patches/features/all/ena/net-ena-add-handling-of-llq-max-tx-burst-size.patch b/debian/patches/features/all/ena/net-ena-add-handling-of-llq-max-tx-burst-size.patch new file mode 100644 index 000000000..4034439eb --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-handling-of-llq-max-tx-burst-size.patch @@ -0,0 +1,232 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:19 +0300 +Subject: [PATCH] net: ena: add handling of llq max tx burst size +Origin: https://git.kernel.org/linus/05d62ca218f8425c70389d0416c15bd0d455b416 +Bug-Debian: https://bugs.debian.org/941291 + +There is a maximum TX burst size that the ENA device can handle. +It is exposed by the device to the driver and the driver +needs to comply with it to avoid bugs. + +In this commit we: +1. Add ena_com_is_doorbell_needed(), which calculates the number of + llq entries that will be used to hold a packet, and will return + true if they exceed the number of allowed entries in a burst. + If the function returns true, a doorbell needs to be invoked + to send this packet in the next burst. + +2. Follow the available entries in the current burst: + - Every doorbell a new burst begins + - With each write of an llq entry, the available entries in the + current burst are decreased by 1. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + .../net/ethernet/amazon/ena/ena_admin_defs.h | 5 ++ + drivers/net/ethernet/amazon/ena/ena_com.c | 7 +++ + drivers/net/ethernet/amazon/ena/ena_com.h | 2 + + drivers/net/ethernet/amazon/ena/ena_eth_com.c | 28 ++++------ + drivers/net/ethernet/amazon/ena/ena_eth_com.h | 53 +++++++++++++++++++ + drivers/net/ethernet/amazon/ena/ena_netdev.c | 7 +++ + 6 files changed, 85 insertions(+), 17 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_admin_defs.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +@@ -524,6 +524,11 @@ struct ena_admin_feature_llq_desc { + + /* the stride control the driver selected to use */ + u16 descriptors_stride_ctrl_enabled; ++ ++ /* Maximum size in bytes taken by llq entries in a single tx burst. ++ * Set to 0 when there is no such limit. ++ */ ++ u32 max_tx_burst_size; + }; + + struct ena_admin_queue_feature_desc { +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -396,6 +396,10 @@ static int ena_com_init_io_sq(struct ena + 0x0, io_sq->llq_info.desc_list_entry_size); + io_sq->llq_buf_ctrl.descs_left_in_line = + io_sq->llq_info.descs_num_before_header; ++ ++ if (io_sq->llq_info.max_entries_in_tx_burst > 0) ++ io_sq->entries_in_tx_burst_left = ++ io_sq->llq_info.max_entries_in_tx_burst; + } + + io_sq->tail = 0; +@@ -727,6 +731,9 @@ static int ena_com_config_llq_info(struc + supported_feat, llq_info->descs_num_before_header); + } + ++ llq_info->max_entries_in_tx_burst = ++ (u16)(llq_features->max_tx_burst_size / llq_default_cfg->llq_ring_entry_size_value); ++ + rc = ena_com_set_llq(ena_dev); + if (rc) + pr_err("Cannot set LLQ configuration: %d\n", rc); +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -159,6 +159,7 @@ struct ena_com_llq_info { + u16 desc_list_entry_size; + u16 descs_num_before_header; + u16 descs_per_entry; ++ u16 max_entries_in_tx_burst; + }; + + struct ena_com_io_cq { +@@ -238,6 +239,7 @@ struct ena_com_io_sq { + u8 phase; + u8 desc_entry_size; + u8 dma_addr_bits; ++ u16 entries_in_tx_burst_left; + } ____cacheline_aligned; + + struct ena_com_admin_cq { +Index: linux/drivers/net/ethernet/amazon/ena/ena_eth_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_eth_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_eth_com.c +@@ -82,6 +82,17 @@ static inline int ena_com_write_bounce_b + dst_tail_mask = io_sq->tail & (io_sq->q_depth - 1); + dst_offset = dst_tail_mask * llq_info->desc_list_entry_size; + ++ if (is_llq_max_tx_burst_exists(io_sq)) { ++ if (unlikely(!io_sq->entries_in_tx_burst_left)) { ++ pr_err("Error: trying to send more packets than tx burst allows\n"); ++ return -ENOSPC; ++ } ++ ++ io_sq->entries_in_tx_burst_left--; ++ pr_debug("decreasing entries_in_tx_burst_left of queue %d to %d\n", ++ io_sq->qid, io_sq->entries_in_tx_burst_left); ++ } ++ + /* Make sure everything was written into the bounce buffer before + * writing the bounce buffer to the device + */ +@@ -274,23 +285,6 @@ static inline u16 ena_com_cdesc_rx_pkt_g + return count; + } + +-static inline bool ena_com_meta_desc_changed(struct ena_com_io_sq *io_sq, +- struct ena_com_tx_ctx *ena_tx_ctx) +-{ +- int rc; +- +- if (ena_tx_ctx->meta_valid) { +- rc = memcmp(&io_sq->cached_tx_meta, +- &ena_tx_ctx->ena_meta, +- sizeof(struct ena_com_tx_meta)); +- +- if (unlikely(rc != 0)) +- return true; +- } +- +- return false; +-} +- + static inline int ena_com_create_and_store_tx_meta_desc(struct ena_com_io_sq *io_sq, + struct ena_com_tx_ctx *ena_tx_ctx) + { +Index: linux/drivers/net/ethernet/amazon/ena/ena_eth_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_eth_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_eth_com.h +@@ -125,8 +125,55 @@ static inline bool ena_com_sq_have_enoug + return ena_com_free_desc(io_sq) > temp; + } + ++static inline bool ena_com_meta_desc_changed(struct ena_com_io_sq *io_sq, ++ struct ena_com_tx_ctx *ena_tx_ctx) ++{ ++ if (!ena_tx_ctx->meta_valid) ++ return false; ++ ++ return !!memcmp(&io_sq->cached_tx_meta, ++ &ena_tx_ctx->ena_meta, ++ sizeof(struct ena_com_tx_meta)); ++} ++ ++static inline bool is_llq_max_tx_burst_exists(struct ena_com_io_sq *io_sq) ++{ ++ return (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) && ++ io_sq->llq_info.max_entries_in_tx_burst > 0; ++} ++ ++static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq, ++ struct ena_com_tx_ctx *ena_tx_ctx) ++{ ++ struct ena_com_llq_info *llq_info; ++ int descs_after_first_entry; ++ int num_entries_needed = 1; ++ u16 num_descs; ++ ++ if (!is_llq_max_tx_burst_exists(io_sq)) ++ return false; ++ ++ llq_info = &io_sq->llq_info; ++ num_descs = ena_tx_ctx->num_bufs; ++ ++ if (unlikely(ena_com_meta_desc_changed(io_sq, ena_tx_ctx))) ++ ++num_descs; ++ ++ if (num_descs > llq_info->descs_num_before_header) { ++ descs_after_first_entry = num_descs - llq_info->descs_num_before_header; ++ num_entries_needed += DIV_ROUND_UP(descs_after_first_entry, ++ llq_info->descs_per_entry); ++ } ++ ++ pr_debug("queue: %d num_descs: %d num_entries_needed: %d\n", io_sq->qid, ++ num_descs, num_entries_needed); ++ ++ return num_entries_needed > io_sq->entries_in_tx_burst_left; ++} ++ + static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq) + { ++ u16 max_entries_in_tx_burst = io_sq->llq_info.max_entries_in_tx_burst; + u16 tail = io_sq->tail; + + pr_debug("write submission queue doorbell for queue: %d tail: %d\n", +@@ -134,6 +181,12 @@ static inline int ena_com_write_sq_doorb + + writel(tail, io_sq->db_addr); + ++ if (is_llq_max_tx_burst_exists(io_sq)) { ++ pr_debug("reset available entries in tx burst for queue %d to %d\n", ++ io_sq->qid, max_entries_in_tx_burst); ++ io_sq->entries_in_tx_burst_left = max_entries_in_tx_burst; ++ } ++ + return 0; + } + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -2172,6 +2172,13 @@ static netdev_tx_t ena_start_xmit(struct + /* set flags and meta data */ + ena_tx_csum(&ena_tx_ctx, skb); + ++ if (unlikely(ena_com_is_doorbell_needed(tx_ring->ena_com_io_sq, &ena_tx_ctx))) { ++ netif_dbg(adapter, tx_queued, dev, ++ "llq tx max burst size of queue %d achieved, writing doorbell to send burst\n", ++ qid); ++ ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq); ++ } ++ + /* prepare the packet's descriptors to dma engine */ + rc = ena_com_prepare_tx(tx_ring->ena_com_io_sq, &ena_tx_ctx, + &nb_hw_desc); diff --git a/debian/patches/features/all/ena/net-ena-add-intr_moder_rx_interval-to-struct-ena_com.patch b/debian/patches/features/all/ena/net-ena-add-intr_moder_rx_interval-to-struct-ena_com.patch new file mode 100644 index 000000000..086da850a --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-intr_moder_rx_interval-to-struct-ena_com.patch @@ -0,0 +1,118 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:26 +0300 +Subject: [PATCH] net: ena: add intr_moder_rx_interval to struct ena_com_dev + and use it +Origin: https://git.kernel.org/linus/15619e722b16aaa40f942b93631aa92581a7b393 +Bug-Debian: https://bugs.debian.org/941291 + +Add intr_moder_rx_interval to struct ena_com_dev and use it as the +location where the interrupt moderation rx interval is saved, instead +of the interrupt moderation table. + +This is done as a first step before removing the old interrupt moderation +code. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 20 ++++---------------- + drivers/net/ethernet/amazon/ena/ena_com.h | 8 +++++++- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 3 ++- + 3 files changed, 13 insertions(+), 18 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -1297,9 +1297,6 @@ static int ena_com_init_interrupt_modera + static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev, + u16 intr_delay_resolution) + { +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- unsigned int i; +- + if (!intr_delay_resolution) { + pr_err("Illegal intr_delay_resolution provided. Going to use default 1 usec resolution\n"); + intr_delay_resolution = 1; +@@ -1307,8 +1304,7 @@ static void ena_com_update_intr_delay_re + ena_dev->intr_delay_resolution = intr_delay_resolution; + + /* update Rx */ +- for (i = 0; i < ENA_INTR_MAX_NUM_OF_LEVELS; i++) +- intr_moder_tbl[i].intr_moder_interval /= intr_delay_resolution; ++ ena_dev->intr_moder_rx_interval /= intr_delay_resolution; + + /* update Tx */ + ena_dev->intr_moder_tx_interval /= intr_delay_resolution; +@@ -2798,11 +2794,8 @@ int ena_com_update_nonadaptive_moderatio + return -EFAULT; + } + +- /* We use LOWEST entry of moderation table for storing +- * nonadaptive interrupt coalescing values +- */ +- ena_dev->intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval = +- rx_coalesce_usecs / ena_dev->intr_delay_resolution; ++ ena_dev->intr_moder_rx_interval = rx_coalesce_usecs / ++ ena_dev->intr_delay_resolution; + + return 0; + } +@@ -2907,12 +2900,7 @@ unsigned int ena_com_get_nonadaptive_mod + + unsigned int ena_com_get_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev) + { +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- +- if (intr_moder_tbl) +- return intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval; +- +- return 0; ++ return ena_dev->intr_moder_rx_interval; + } + + void ena_com_init_intr_moderation_entry(struct ena_com_dev *ena_dev, +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -93,7 +93,7 @@ + #define ENA_INTR_HIGHEST_BYTES (192 * 1024) + + #define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196 +-#define ENA_INTR_INITIAL_RX_INTERVAL_USECS 4 ++#define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0 + #define ENA_INTR_DELAY_OLD_VALUE_WEIGHT 6 + #define ENA_INTR_DELAY_NEW_VALUE_WEIGHT 4 + #define ENA_INTR_MODER_LEVEL_STRIDE 2 +@@ -376,7 +376,13 @@ struct ena_com_dev { + struct ena_host_attribute host_attr; + bool adaptive_coalescing; + u16 intr_delay_resolution; ++ ++ /* interrupt moderation intervals are in usec divided by ++ * intr_delay_resolution, which is supplied by the device. ++ */ + u32 intr_moder_tx_interval; ++ u32 intr_moder_rx_interval; ++ + struct ena_intr_moder_entry *intr_moder_tbl; + + struct ena_com_llq_info llq_info; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3487,10 +3487,11 @@ static int ena_probe(struct pci_dev *pde + calc_queue_ctx.get_feat_ctx = &get_feat_ctx; + calc_queue_ctx.pdev = pdev; + +- /* initial Tx interrupt delay, Assumes 1 usec granularity. ++ /* Initial Tx and RX interrupt delay. Assumes 1 usec granularity. + * Updated during device initialization with the real granularity + */ + ena_dev->intr_moder_tx_interval = ENA_INTR_INITIAL_TX_INTERVAL_USECS; ++ ena_dev->intr_moder_rx_interval = ENA_INTR_INITIAL_RX_INTERVAL_USECS; + io_queue_num = ena_calc_io_queue_num(pdev, ena_dev, &get_feat_ctx); + rc = ena_calc_queue_size(&calc_queue_ctx); + if (rc || io_queue_num <= 0) { diff --git a/debian/patches/features/all/ena/net-ena-add-newline-at-the-end-of-pr_err-prints.patch b/debian/patches/features/all/ena/net-ena-add-newline-at-the-end-of-pr_err-prints.patch new file mode 100644 index 000000000..3b1c6c4cb --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-newline-at-the-end-of-pr_err-prints.patch @@ -0,0 +1,91 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:23 +0300 +Subject: [PATCH] net: ena: add newline at the end of pr_err prints +Origin: https://git.kernel.org/linus/9cb9c0de266f1ea52f01589f2f4019f163c01cd1 +Bug-Debian: https://bugs.debian.org/941291 + +Some pr_err prints lacked '\n' in the end. Added where missing. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -115,7 +115,7 @@ static int ena_com_admin_init_sq(struct + GFP_KERNEL); + + if (!sq->entries) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + +@@ -137,7 +137,7 @@ static int ena_com_admin_init_cq(struct + GFP_KERNEL); + + if (!cq->entries) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + +@@ -160,7 +160,7 @@ static int ena_com_admin_init_aenq(struc + GFP_KERNEL); + + if (!aenq->entries) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + +@@ -285,7 +285,7 @@ static inline int ena_com_init_comp_ctxt + + queue->comp_ctx = devm_kzalloc(queue->q_dmadev, size, GFP_KERNEL); + if (unlikely(!queue->comp_ctx)) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + +@@ -356,7 +356,7 @@ static int ena_com_init_io_sq(struct ena + } + + if (!io_sq->desc_addr.virt_addr) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + } +@@ -382,7 +382,7 @@ static int ena_com_init_io_sq(struct ena + devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); + + if (!io_sq->bounce_buf_ctrl.base_buffer) { +- pr_err("bounce buffer memory allocation failed"); ++ pr_err("bounce buffer memory allocation failed\n"); + return -ENOMEM; + } + +@@ -440,7 +440,7 @@ static int ena_com_init_io_cq(struct ena + } + + if (!io_cq->cdesc_addr.virt_addr) { +- pr_err("memory allocation failed"); ++ pr_err("memory allocation failed\n"); + return -ENOMEM; + } + +@@ -829,7 +829,7 @@ static u32 ena_com_reg_bar_read32(struct + } + + if (read_resp->reg_off != offset) { +- pr_err("Read failure: wrong offset provided"); ++ pr_err("Read failure: wrong offset provided\n"); + ret = ENA_MMIO_READ_TIMEOUT; + } else { + ret = read_resp->reg_val; diff --git a/debian/patches/features/all/ena/net-ena-add-support-for-changing-max_header_size-in-.patch b/debian/patches/features/all/ena/net-ena-add-support-for-changing-max_header_size-in-.patch new file mode 100644 index 000000000..ac5bc89e7 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-add-support-for-changing-max_header_size-in-.patch @@ -0,0 +1,54 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:26 +0300 +Subject: [PATCH] net: ena: add support for changing max_header_size in LLQ + mode +Origin: https://git.kernel.org/linus/cdf449eccc5946d5dd4145b38347874a7423c50d +Bug-Debian: https://bugs.debian.org/941291 + +Up until now the driver always used a single setting for the sizes +of the different parts of the llq entry - 128 for entry size, 2 for +descriptors before header and 96 for maximum header size. + +The current code makes sure that the parts of the llq entry are +compatible with each other and with the initial llq entry size given +by the device. + +This commit changes this code to support any llq entry size + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2936,8 +2936,8 @@ int ena_com_config_dev_mode(struct ena_c + struct ena_admin_feature_llq_desc *llq_features, + struct ena_llq_configurations *llq_default_cfg) + { ++ struct ena_com_llq_info *llq_info = &ena_dev->llq_info; + int rc; +- int size; + + if (!llq_features->max_llq_num) { + ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST; +@@ -2948,12 +2948,10 @@ int ena_com_config_dev_mode(struct ena_c + if (rc) + return rc; + +- /* Validate the descriptor is not too big */ +- size = ena_dev->tx_max_header_size; +- size += ena_dev->llq_info.descs_num_before_header * +- sizeof(struct ena_eth_io_tx_desc); ++ ena_dev->tx_max_header_size = llq_info->desc_list_entry_size - ++ (llq_info->descs_num_before_header * sizeof(struct ena_eth_io_tx_desc)); + +- if (unlikely(ena_dev->llq_info.desc_list_entry_size < size)) { ++ if (unlikely(ena_dev->tx_max_header_size == 0)) { + pr_err("the size of the LLQ entry is smaller than needed\n"); + return -EINVAL; + } diff --git a/debian/patches/features/all/ena/net-ena-allow-automatic-fallback-to-polling-mode.patch b/debian/patches/features/all/ena/net-ena-allow-automatic-fallback-to-polling-mode.patch new file mode 100644 index 000000000..dab6166e1 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-allow-automatic-fallback-to-polling-mode.patch @@ -0,0 +1,103 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:25 +0300 +Subject: [PATCH] net: ena: allow automatic fallback to polling mode +Origin: https://git.kernel.org/linus/a4e262cde3cda4491ce666e7c5270954c4d926b9 +Bug-Debian: https://bugs.debian.org/941291 + +Enable fallback to polling mode for Admin queue +when identified a command response arrival +without an accompanying MSI-X interrupt + +Signed-off-by: Igor Chauskin +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 34 +++++++++++++++++------ + drivers/net/ethernet/amazon/ena/ena_com.h | 14 ++++++++++ + 2 files changed, 39 insertions(+), 9 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -762,16 +762,26 @@ static int ena_com_wait_and_process_admi + admin_queue->stats.no_completion++; + spin_unlock_irqrestore(&admin_queue->q_lock, flags); + +- if (comp_ctx->status == ENA_CMD_COMPLETED) +- pr_err("The ena device have completion but the driver didn't receive any MSI-X interrupt (cmd %d)\n", +- comp_ctx->cmd_opcode); +- else +- pr_err("The ena device doesn't send any completion for the admin cmd %d status %d\n", ++ if (comp_ctx->status == ENA_CMD_COMPLETED) { ++ pr_err("The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n", ++ comp_ctx->cmd_opcode, ++ admin_queue->auto_polling ? "ON" : "OFF"); ++ /* Check if fallback to polling is enabled */ ++ if (admin_queue->auto_polling) ++ admin_queue->polling = true; ++ } else { ++ pr_err("The ena device doesn't send a completion for the admin cmd %d status %d\n", + comp_ctx->cmd_opcode, comp_ctx->status); +- +- admin_queue->running_state = false; +- ret = -ETIME; +- goto err; ++ } ++ /* Check if shifted to polling mode. ++ * This will happen if there is a completion without an interrupt ++ * and autopolling mode is enabled. Continuing normal execution in such case ++ */ ++ if (!admin_queue->polling) { ++ admin_queue->running_state = false; ++ ret = -ETIME; ++ goto err; ++ } + } + + ret = ena_com_comp_status_to_errno(comp_ctx->comp_status); +@@ -1650,6 +1660,12 @@ void ena_com_set_admin_polling_mode(stru + ena_dev->admin_queue.polling = polling; + } + ++void ena_com_set_admin_auto_polling_mode(struct ena_com_dev *ena_dev, ++ bool polling) ++{ ++ ena_dev->admin_queue.auto_polling = polling; ++} ++ + int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev) + { + struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read; +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -283,6 +283,9 @@ struct ena_com_admin_queue { + /* Indicate if the admin queue should poll for completion */ + bool polling; + ++ /* Define if fallback to polling mode should occur */ ++ bool auto_polling; ++ + u16 curr_cmd_id; + + /* Indicate that the ena was initialized and can +@@ -538,6 +541,17 @@ void ena_com_set_admin_polling_mode(stru + */ + bool ena_com_get_ena_admin_polling_mode(struct ena_com_dev *ena_dev); + ++/* ena_com_set_admin_auto_polling_mode - Enable autoswitch to polling mode ++ * @ena_dev: ENA communication layer struct ++ * @polling: Enable/Disable polling mode ++ * ++ * Set the autopolling mode. ++ * If autopolling is on: ++ * In case of missing interrupt when data is available switch to polling. ++ */ ++void ena_com_set_admin_auto_polling_mode(struct ena_com_dev *ena_dev, ++ bool polling); ++ + /* ena_com_admin_q_comp_intr_handler - admin queue interrupt handler + * @ena_dev: ENA communication layer struct + * diff --git a/debian/patches/features/all/ena/net-ena-allow-queue-allocation-backoff-when-low-on-m.patch b/debian/patches/features/all/ena/net-ena-allow-queue-allocation-backoff-when-low-on-m.patch new file mode 100644 index 000000000..6f902b864 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-allow-queue-allocation-backoff-when-low-on-m.patch @@ -0,0 +1,323 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:08 +0300 +Subject: [PATCH] net: ena: allow queue allocation backoff when low on memory +Origin: https://git.kernel.org/linus/13ca32a69e29f3a0fe72094dd930f312b3f3ee44 +Bug-Debian: https://bugs.debian.org/941291 + +If there is not enough memory to allocate io queues the driver will +try to allocate smaller queues. + +The backoff algorithm is as follows: + +1. Try to allocate TX and RX and if successful. +1.1. return success + +2. Divide by 2 the size of the larger of RX and TX queues (or both if their size is the same). + +3. If TX or RX is smaller than 256 +3.1. return failure. +4. else +4.1. go back to 1. + +Also change the tx_queue_size, rx_queue_size field names in struct +adapter to requested_tx_queue_size and requested_rx_queue_size, and +use RX and TX queue 0 for actual queue sizes. +Explanation: +The original fields were useless as they were simply used to assign +values once from them to each of the queues in the adapter in ena_probe(). +They could simply be deleted. However now that we have a backoff +feature, we have use for them. In case of backoff there is a difference +between the requested queue sizes and the actual sizes. Therefore there +is a need to save the requested queue size for future retries of queue +allocation (for example if allocation failed and then ifdown + ifup was +called we want to start the allocation from the original requested size of +the queues). + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 +- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 159 +++++++++++++----- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 6 +- + 3 files changed, 127 insertions(+), 42 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -450,8 +450,8 @@ static void ena_get_ringparam(struct net + + ring->tx_max_pending = adapter->max_tx_ring_size; + ring->rx_max_pending = adapter->max_rx_ring_size; +- ring->tx_pending = adapter->tx_ring_size; +- ring->rx_pending = adapter->rx_ring_size; ++ ring->tx_pending = adapter->tx_ring[0].ring_size; ++ ring->rx_pending = adapter->rx_ring[0].ring_size; + } + + static u32 ena_flow_hash_to_flow_type(u16 hash_fields) +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -182,7 +182,7 @@ static void ena_init_io_rings(struct ena + ena_init_io_rings_common(adapter, rxr, i); + + /* TX specific ring state */ +- txr->ring_size = adapter->tx_ring_size; ++ txr->ring_size = adapter->requested_tx_ring_size; + txr->tx_max_header_size = ena_dev->tx_max_header_size; + txr->tx_mem_queue_type = ena_dev->tx_mem_queue_type; + txr->sgl_size = adapter->max_tx_sgl_size; +@@ -190,7 +190,7 @@ static void ena_init_io_rings(struct ena + ena_com_get_nonadaptive_moderation_interval_tx(ena_dev); + + /* RX specific ring state */ +- rxr->ring_size = adapter->rx_ring_size; ++ rxr->ring_size = adapter->requested_rx_ring_size; + rxr->rx_copybreak = adapter->rx_copybreak; + rxr->sgl_size = adapter->max_rx_sgl_size; + rxr->smoothed_interval = +@@ -594,7 +594,6 @@ static void ena_free_rx_bufs(struct ena_ + + /* ena_refill_all_rx_bufs - allocate all queues Rx buffers + * @adapter: board private structure +- * + */ + static void ena_refill_all_rx_bufs(struct ena_adapter *adapter) + { +@@ -1635,7 +1634,7 @@ static int ena_create_io_tx_queue(struct + ctx.qid = ena_qid; + ctx.mem_queue_type = ena_dev->tx_mem_queue_type; + ctx.msix_vector = msix_vector; +- ctx.queue_size = adapter->tx_ring_size; ++ ctx.queue_size = tx_ring->ring_size; + ctx.numa_node = cpu_to_node(tx_ring->cpu); + + rc = ena_com_create_io_queue(ena_dev, &ctx); +@@ -1702,7 +1701,7 @@ static int ena_create_io_rx_queue(struct + ctx.direction = ENA_COM_IO_QUEUE_DIRECTION_RX; + ctx.mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST; + ctx.msix_vector = msix_vector; +- ctx.queue_size = adapter->rx_ring_size; ++ ctx.queue_size = rx_ring->ring_size; + ctx.numa_node = cpu_to_node(rx_ring->cpu); + + rc = ena_com_create_io_queue(ena_dev, &ctx); +@@ -1749,6 +1748,112 @@ create_err: + return rc; + } + ++static void set_io_rings_size(struct ena_adapter *adapter, ++ int new_tx_size, int new_rx_size) ++{ ++ int i; ++ ++ for (i = 0; i < adapter->num_queues; i++) { ++ adapter->tx_ring[i].ring_size = new_tx_size; ++ adapter->rx_ring[i].ring_size = new_rx_size; ++ } ++} ++ ++/* This function allows queue allocation to backoff when the system is ++ * low on memory. If there is not enough memory to allocate io queues ++ * the driver will try to allocate smaller queues. ++ * ++ * The backoff algorithm is as follows: ++ * 1. Try to allocate TX and RX and if successful. ++ * 1.1. return success ++ * ++ * 2. Divide by 2 the size of the larger of RX and TX queues (or both if their size is the same). ++ * ++ * 3. If TX or RX is smaller than 256 ++ * 3.1. return failure. ++ * 4. else ++ * 4.1. go back to 1. ++ */ ++static int create_queues_with_size_backoff(struct ena_adapter *adapter) ++{ ++ int rc, cur_rx_ring_size, cur_tx_ring_size; ++ int new_rx_ring_size, new_tx_ring_size; ++ ++ /* current queue sizes might be set to smaller than the requested ++ * ones due to past queue allocation failures. ++ */ ++ set_io_rings_size(adapter, adapter->requested_tx_ring_size, ++ adapter->requested_rx_ring_size); ++ ++ while (1) { ++ rc = ena_setup_all_tx_resources(adapter); ++ if (rc) ++ goto err_setup_tx; ++ ++ rc = ena_create_all_io_tx_queues(adapter); ++ if (rc) ++ goto err_create_tx_queues; ++ ++ rc = ena_setup_all_rx_resources(adapter); ++ if (rc) ++ goto err_setup_rx; ++ ++ rc = ena_create_all_io_rx_queues(adapter); ++ if (rc) ++ goto err_create_rx_queues; ++ ++ return 0; ++ ++err_create_rx_queues: ++ ena_free_all_io_rx_resources(adapter); ++err_setup_rx: ++ ena_destroy_all_tx_queues(adapter); ++err_create_tx_queues: ++ ena_free_all_io_tx_resources(adapter); ++err_setup_tx: ++ if (rc != -ENOMEM) { ++ netif_err(adapter, ifup, adapter->netdev, ++ "Queue creation failed with error code %d\n", ++ rc); ++ return rc; ++ } ++ ++ cur_tx_ring_size = adapter->tx_ring[0].ring_size; ++ cur_rx_ring_size = adapter->rx_ring[0].ring_size; ++ ++ netif_err(adapter, ifup, adapter->netdev, ++ "Not enough memory to create queues with sizes TX=%d, RX=%d\n", ++ cur_tx_ring_size, cur_rx_ring_size); ++ ++ new_tx_ring_size = cur_tx_ring_size; ++ new_rx_ring_size = cur_rx_ring_size; ++ ++ /* Decrease the size of the larger queue, or ++ * decrease both if they are the same size. ++ */ ++ if (cur_rx_ring_size <= cur_tx_ring_size) ++ new_tx_ring_size = cur_tx_ring_size / 2; ++ if (cur_rx_ring_size >= cur_tx_ring_size) ++ new_rx_ring_size = cur_rx_ring_size / 2; ++ ++ if (cur_tx_ring_size < ENA_MIN_RING_SIZE || ++ cur_rx_ring_size < ENA_MIN_RING_SIZE) { ++ netif_err(adapter, ifup, adapter->netdev, ++ "Queue creation failed with the smallest possible queue size of %d for both queues. Not retrying with smaller queues\n", ++ ENA_MIN_RING_SIZE); ++ return rc; ++ } ++ ++ netif_err(adapter, ifup, adapter->netdev, ++ "Retrying queue creation with sizes TX=%d, RX=%d\n", ++ new_tx_ring_size, ++ new_rx_ring_size); ++ ++ set_io_rings_size(adapter, new_tx_ring_size, ++ new_rx_ring_size); ++ } ++} ++ + static int ena_up(struct ena_adapter *adapter) + { + int rc, i; +@@ -1768,25 +1873,9 @@ static int ena_up(struct ena_adapter *ad + if (rc) + goto err_req_irq; + +- /* allocate transmit descriptors */ +- rc = ena_setup_all_tx_resources(adapter); ++ rc = create_queues_with_size_backoff(adapter); + if (rc) +- goto err_setup_tx; +- +- /* allocate receive descriptors */ +- rc = ena_setup_all_rx_resources(adapter); +- if (rc) +- goto err_setup_rx; +- +- /* Create TX queues */ +- rc = ena_create_all_io_tx_queues(adapter); +- if (rc) +- goto err_create_tx_queues; +- +- /* Create RX queues */ +- rc = ena_create_all_io_rx_queues(adapter); +- if (rc) +- goto err_create_rx_queues; ++ goto err_create_queues_with_backoff; + + rc = ena_up_complete(adapter); + if (rc) +@@ -1815,14 +1904,11 @@ static int ena_up(struct ena_adapter *ad + return rc; + + err_up: +- ena_destroy_all_rx_queues(adapter); +-err_create_rx_queues: + ena_destroy_all_tx_queues(adapter); +-err_create_tx_queues: +- ena_free_all_io_rx_resources(adapter); +-err_setup_rx: + ena_free_all_io_tx_resources(adapter); +-err_setup_tx: ++ ena_destroy_all_rx_queues(adapter); ++ ena_free_all_io_rx_resources(adapter); ++err_create_queues_with_backoff: + ena_free_io_irq(adapter); + err_req_irq: + ena_del_napi(adapter); +@@ -3286,17 +3372,14 @@ static int ena_calc_queue_size(struct en + max_tx_queue_size = rounddown_pow_of_two(max_tx_queue_size); + max_rx_queue_size = rounddown_pow_of_two(max_rx_queue_size); + +- tx_queue_size = min_t(u32, tx_queue_size, max_tx_queue_size); +- rx_queue_size = min_t(u32, rx_queue_size, max_rx_queue_size); ++ tx_queue_size = clamp_val(tx_queue_size, ENA_MIN_RING_SIZE, ++ max_tx_queue_size); ++ rx_queue_size = clamp_val(rx_queue_size, ENA_MIN_RING_SIZE, ++ max_rx_queue_size); + + tx_queue_size = rounddown_pow_of_two(tx_queue_size); + rx_queue_size = rounddown_pow_of_two(rx_queue_size); + +- if (unlikely(!rx_queue_size || !tx_queue_size)) { +- dev_err(&ctx->pdev->dev, "Invalid queue size\n"); +- return -EFAULT; +- } +- + ctx->max_tx_queue_size = max_tx_queue_size; + ctx->max_rx_queue_size = max_rx_queue_size; + ctx->tx_queue_size = tx_queue_size; +@@ -3426,8 +3509,8 @@ static int ena_probe(struct pci_dev *pde + adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); + adapter->reset_reason = ENA_REGS_RESET_NORMAL; + +- adapter->tx_ring_size = calc_queue_ctx.tx_queue_size; +- adapter->rx_ring_size = calc_queue_ctx.rx_queue_size; ++ adapter->requested_tx_ring_size = calc_queue_ctx.tx_queue_size; ++ adapter->requested_rx_ring_size = calc_queue_ctx.rx_queue_size; + adapter->max_tx_ring_size = calc_queue_ctx.max_tx_queue_size; + adapter->max_rx_ring_size = calc_queue_ctx.max_rx_queue_size; + adapter->max_tx_sgl_size = calc_queue_ctx.max_tx_sgl_size; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -79,6 +79,8 @@ + #define ENA_BAR_MASK (BIT(ENA_REG_BAR) | BIT(ENA_MEM_BAR)) + + #define ENA_DEFAULT_RING_SIZE (1024) ++#define ENA_MIN_RING_SIZE (256) ++ + + #define ENA_TX_WAKEUP_THRESH (MAX_SKB_FRAGS + 2) + #define ENA_DEFAULT_RX_COPYBREAK (256 - NET_IP_ALIGN) +@@ -330,8 +332,8 @@ struct ena_adapter { + u32 tx_usecs, rx_usecs; /* interrupt moderation */ + u32 tx_frames, rx_frames; /* interrupt moderation */ + +- u32 tx_ring_size; +- u32 rx_ring_size; ++ u32 requested_tx_ring_size; ++ u32 requested_rx_ring_size; + + u32 max_tx_ring_size; + u32 max_rx_ring_size; diff --git a/debian/patches/features/all/ena/net-ena-arrange-ena_probe-function-variables-in-reve.patch b/debian/patches/features/all/ena/net-ena-arrange-ena_probe-function-variables-in-reve.patch new file mode 100644 index 000000000..af89762f1 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-arrange-ena_probe-function-variables-in-reve.patch @@ -0,0 +1,49 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:22 +0300 +Subject: [PATCH] net: ena: arrange ena_probe() function variables in reverse + christmas tree +Origin: https://git.kernel.org/linus/83b9240428a66da3c8e24e719b985d533cf58067 +Bug-Debian: https://bugs.debian.org/941291 + +Reverse christmas tree arrangement is when strings are written from longer +to shorter with each line. Most of our functions are abiding this +arrangement but this function does not. + +In this commit we arrange the variables of ena_probe() in reverse christmas +tree. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3274,17 +3274,17 @@ static int ena_calc_queue_size(struct pc + static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct ena_com_dev_get_features_ctx get_feat_ctx; +- static int version_printed; +- struct net_device *netdev; +- struct ena_adapter *adapter; + struct ena_llq_configurations llq_config; + struct ena_com_dev *ena_dev = NULL; +- char *queue_type_str; +- static int adapters_found; ++ struct ena_adapter *adapter; ++ static int version_printed; + int io_queue_num, bars, rc; +- int queue_size; ++ struct net_device *netdev; ++ static int adapters_found; ++ char *queue_type_str; + u16 tx_sgl_size = 0; + u16 rx_sgl_size = 0; ++ int queue_size; + bool wd_state; + + dev_dbg(&pdev->dev, "%s\n", __func__); diff --git a/debian/patches/features/all/ena/net-ena-don-t-wake-up-tx-queue-when-down.patch b/debian/patches/features/all/ena/net-ena-don-t-wake-up-tx-queue-when-down.patch new file mode 100644 index 000000000..e1b214e80 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-don-t-wake-up-tx-queue-when-down.patch @@ -0,0 +1,52 @@ +From: Sameeh Jubran +Date: Sun, 15 Sep 2019 17:29:44 +0300 +Subject: [PATCH] net: ena: don't wake up tx queue when down +Origin: https://git.kernel.org/linus/a53651ec93a8d7ab5b26c5390e0c389048b4b4b6 +Bug-Debian: https://bugs.debian.org/941291 + +There is a race condition that can occur when calling ena_down(). +The ena_clean_tx_irq() - which is a part of the napi handler - +function might wake up the tx queue when the queue is supposed +to be down (during recovery or changing the size of the queues +for example) This causes the ena_start_xmit() function to trigger +and possibly try to access the destroyed queues. + +The race is illustrated below: + +Flow A: Flow B(napi handler) +ena_down() + netif_carrier_off() + netif_tx_disable() + ena_clean_tx_irq() + netif_tx_wake_queue() + ena_napi_disable_all() + ena_destroy_all_io_queues() + +After these flows the tx queue is active and ena_start_xmit() accesses +the destroyed queue which leads to a kernel panic. + +fixes: 1738cd3ed342 (net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)) + +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c +index 664e3ed97ea9..d118ed4c57ce 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -823,7 +823,8 @@ static int ena_clean_tx_irq(struct ena_ring *tx_ring, u32 budget) + above_thresh = + ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, + ENA_TX_WAKEUP_THRESH); +- if (netif_tx_queue_stopped(txq) && above_thresh) { ++ if (netif_tx_queue_stopped(txq) && above_thresh && ++ test_bit(ENA_FLAG_DEV_UP, &tx_ring->adapter->flags)) { + netif_tx_wake_queue(txq); + u64_stats_update_begin(&tx_ring->syncp); + tx_ring->tx_stats.queue_wakeup++; +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-enable-negotiating-larger-Rx-ring-size.patch b/debian/patches/features/all/ena/net-ena-enable-negotiating-larger-Rx-ring-size.patch new file mode 100644 index 000000000..43be08179 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-enable-negotiating-larger-Rx-ring-size.patch @@ -0,0 +1,270 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:06 +0300 +Subject: [PATCH] net: ena: enable negotiating larger Rx ring size +Origin: https://git.kernel.org/linus/31aa9857f1733403f2eb12d51c1cec20a22483d9 +Bug-Debian: https://bugs.debian.org/941291 + +Use MAX_QUEUES_EXT get feature capability to query the device. + +Signed-off-by: Netanel Belgazal +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 144 ++++++++++++------- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 15 ++ + 2 files changed, 110 insertions(+), 49 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -2455,13 +2455,6 @@ static int ena_device_validate_params(st + return -EINVAL; + } + +- if ((get_feat_ctx->max_queues.max_cq_num < adapter->num_queues) || +- (get_feat_ctx->max_queues.max_sq_num < adapter->num_queues)) { +- netif_err(adapter, drv, netdev, +- "Error, device doesn't support enough queues\n"); +- return -EINVAL; +- } +- + if (get_feat_ctx->dev_attr.max_mtu < netdev->mtu) { + netif_err(adapter, drv, netdev, + "Error, device max mtu is smaller than netdev MTU\n"); +@@ -3035,18 +3028,32 @@ static int ena_calc_io_queue_num(struct + struct ena_com_dev *ena_dev, + struct ena_com_dev_get_features_ctx *get_feat_ctx) + { +- int io_sq_num, io_queue_num; ++ int io_tx_sq_num, io_tx_cq_num, io_rx_num, io_queue_num; ++ ++ if (ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) { ++ struct ena_admin_queue_ext_feature_fields *max_queue_ext = ++ &get_feat_ctx->max_queue_ext.max_queue_ext; ++ io_rx_num = min_t(int, max_queue_ext->max_rx_sq_num, ++ max_queue_ext->max_rx_cq_num); + +- /* In case of LLQ use the llq number in the get feature cmd */ ++ io_tx_sq_num = max_queue_ext->max_tx_sq_num; ++ io_tx_cq_num = max_queue_ext->max_tx_cq_num; ++ } else { ++ struct ena_admin_queue_feature_desc *max_queues = ++ &get_feat_ctx->max_queues; ++ io_tx_sq_num = max_queues->max_sq_num; ++ io_tx_cq_num = max_queues->max_cq_num; ++ io_rx_num = min_t(int, io_tx_sq_num, io_tx_cq_num); ++ } ++ ++ /* In case of LLQ use the llq fields for the tx SQ/CQ */ + if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) +- io_sq_num = get_feat_ctx->llq.max_llq_num; +- else +- io_sq_num = get_feat_ctx->max_queues.max_sq_num; ++ io_tx_sq_num = get_feat_ctx->llq.max_llq_num; + + io_queue_num = min_t(int, num_online_cpus(), ENA_MAX_NUM_IO_QUEUES); +- io_queue_num = min_t(int, io_queue_num, io_sq_num); +- io_queue_num = min_t(int, io_queue_num, +- get_feat_ctx->max_queues.max_cq_num); ++ io_queue_num = min_t(int, io_queue_num, io_rx_num); ++ io_queue_num = min_t(int, io_queue_num, io_tx_sq_num); ++ io_queue_num = min_t(int, io_queue_num, io_tx_cq_num); + /* 1 IRQ for for mgmnt and 1 IRQs for each IO direction */ + io_queue_num = min_t(int, io_queue_num, pci_msix_vec_count(pdev) - 1); + if (unlikely(!io_queue_num)) { +@@ -3229,36 +3236,73 @@ static inline void set_default_llq_confi + llq_config->llq_ring_entry_size_value = 128; + } + +-static int ena_calc_queue_size(struct pci_dev *pdev, +- struct ena_com_dev *ena_dev, +- u16 *max_tx_sgl_size, +- u16 *max_rx_sgl_size, +- struct ena_com_dev_get_features_ctx *get_feat_ctx) +-{ +- u32 queue_size = ENA_DEFAULT_RING_SIZE; +- +- queue_size = min_t(u32, queue_size, +- get_feat_ctx->max_queues.max_cq_depth); +- queue_size = min_t(u32, queue_size, +- get_feat_ctx->max_queues.max_sq_depth); ++static int ena_calc_queue_size(struct ena_calc_queue_size_ctx *ctx) ++{ ++ struct ena_admin_feature_llq_desc *llq = &ctx->get_feat_ctx->llq; ++ struct ena_com_dev *ena_dev = ctx->ena_dev; ++ u32 tx_queue_size = ENA_DEFAULT_RING_SIZE; ++ u32 rx_queue_size = ENA_DEFAULT_RING_SIZE; ++ u32 max_tx_queue_size; ++ u32 max_rx_queue_size; ++ ++ if (ctx->ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) { ++ struct ena_admin_queue_ext_feature_fields *max_queue_ext = ++ &ctx->get_feat_ctx->max_queue_ext.max_queue_ext; ++ max_rx_queue_size = min_t(u32, max_queue_ext->max_rx_cq_depth, ++ max_queue_ext->max_rx_sq_depth); ++ max_tx_queue_size = max_queue_ext->max_tx_cq_depth; ++ ++ if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) ++ max_tx_queue_size = min_t(u32, max_tx_queue_size, ++ llq->max_llq_depth); ++ else ++ max_tx_queue_size = min_t(u32, max_tx_queue_size, ++ max_queue_ext->max_tx_sq_depth); ++ ++ ctx->max_tx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, ++ max_queue_ext->max_per_packet_tx_descs); ++ ctx->max_rx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, ++ max_queue_ext->max_per_packet_rx_descs); ++ } else { ++ struct ena_admin_queue_feature_desc *max_queues = ++ &ctx->get_feat_ctx->max_queues; ++ max_rx_queue_size = min_t(u32, max_queues->max_cq_depth, ++ max_queues->max_sq_depth); ++ max_tx_queue_size = max_queues->max_cq_depth; ++ ++ if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) ++ max_tx_queue_size = min_t(u32, max_tx_queue_size, ++ llq->max_llq_depth); ++ else ++ max_tx_queue_size = min_t(u32, max_tx_queue_size, ++ max_queues->max_sq_depth); + +- if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) +- queue_size = min_t(u32, queue_size, +- get_feat_ctx->llq.max_llq_depth); ++ ctx->max_tx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, ++ max_queues->max_packet_tx_descs); ++ ctx->max_rx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, ++ max_queues->max_packet_rx_descs); ++ } + +- queue_size = rounddown_pow_of_two(queue_size); ++ max_tx_queue_size = rounddown_pow_of_two(max_tx_queue_size); ++ max_rx_queue_size = rounddown_pow_of_two(max_rx_queue_size); + +- if (unlikely(!queue_size)) { +- dev_err(&pdev->dev, "Invalid queue size\n"); ++ tx_queue_size = min_t(u32, tx_queue_size, max_tx_queue_size); ++ rx_queue_size = min_t(u32, rx_queue_size, max_rx_queue_size); ++ ++ tx_queue_size = rounddown_pow_of_two(tx_queue_size); ++ rx_queue_size = rounddown_pow_of_two(rx_queue_size); ++ ++ if (unlikely(!rx_queue_size || !tx_queue_size)) { ++ dev_err(&ctx->pdev->dev, "Invalid queue size\n"); + return -EFAULT; + } + +- *max_tx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, +- get_feat_ctx->max_queues.max_packet_tx_descs); +- *max_rx_sgl_size = min_t(u16, ENA_PKT_MAX_BUFS, +- get_feat_ctx->max_queues.max_packet_rx_descs); ++ ctx->max_tx_queue_size = max_tx_queue_size; ++ ctx->max_rx_queue_size = max_rx_queue_size; ++ ctx->tx_queue_size = tx_queue_size; ++ ctx->rx_queue_size = rx_queue_size; + +- return queue_size; ++ return 0; + } + + /* ena_probe - Device Initialization Routine +@@ -3274,6 +3318,7 @@ static int ena_calc_queue_size(struct pc + static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct ena_com_dev_get_features_ctx get_feat_ctx; ++ struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 }; + struct ena_llq_configurations llq_config; + struct ena_com_dev *ena_dev = NULL; + struct ena_adapter *adapter; +@@ -3281,9 +3326,6 @@ static int ena_probe(struct pci_dev *pde + struct net_device *netdev; + static int adapters_found; + char *queue_type_str; +- u16 tx_sgl_size = 0; +- u16 rx_sgl_size = 0; +- int queue_size; + bool wd_state; + + dev_dbg(&pdev->dev, "%s\n", __func__); +@@ -3340,20 +3382,25 @@ static int ena_probe(struct pci_dev *pde + goto err_device_destroy; + } + ++ calc_queue_ctx.ena_dev = ena_dev; ++ calc_queue_ctx.get_feat_ctx = &get_feat_ctx; ++ calc_queue_ctx.pdev = pdev; ++ + /* initial Tx interrupt delay, Assumes 1 usec granularity. + * Updated during device initialization with the real granularity + */ + ena_dev->intr_moder_tx_interval = ENA_INTR_INITIAL_TX_INTERVAL_USECS; + io_queue_num = ena_calc_io_queue_num(pdev, ena_dev, &get_feat_ctx); +- queue_size = ena_calc_queue_size(pdev, ena_dev, &tx_sgl_size, +- &rx_sgl_size, &get_feat_ctx); +- if ((queue_size <= 0) || (io_queue_num <= 0)) { ++ rc = ena_calc_queue_size(&calc_queue_ctx); ++ if (rc || io_queue_num <= 0) { + rc = -EFAULT; + goto err_device_destroy; + } + +- dev_info(&pdev->dev, "creating %d io queues. queue size: %d. LLQ is %s\n", +- io_queue_num, queue_size, ++ dev_info(&pdev->dev, "creating %d io queues. rx queue size: %d tx queue size. %d LLQ is %s\n", ++ io_queue_num, ++ calc_queue_ctx.rx_queue_size, ++ calc_queue_ctx.tx_queue_size, + (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) ? + "ENABLED" : "DISABLED"); + +@@ -3379,11 +3426,10 @@ static int ena_probe(struct pci_dev *pde + adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); + adapter->reset_reason = ENA_REGS_RESET_NORMAL; + +- adapter->tx_ring_size = queue_size; +- adapter->rx_ring_size = queue_size; +- +- adapter->max_tx_sgl_size = tx_sgl_size; +- adapter->max_rx_sgl_size = rx_sgl_size; ++ adapter->tx_ring_size = calc_queue_ctx.tx_queue_size; ++ adapter->rx_ring_size = calc_queue_ctx.rx_queue_size; ++ adapter->max_tx_sgl_size = calc_queue_ctx.max_tx_sgl_size; ++ adapter->max_rx_sgl_size = calc_queue_ctx.max_rx_sgl_size; + + adapter->num_queues = io_queue_num; + adapter->last_monitored_tx_qid = 0; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -154,6 +154,18 @@ struct ena_napi { + u32 qid; + }; + ++struct ena_calc_queue_size_ctx { ++ struct ena_com_dev_get_features_ctx *get_feat_ctx; ++ struct ena_com_dev *ena_dev; ++ struct pci_dev *pdev; ++ u16 tx_queue_size; ++ u16 rx_queue_size; ++ u16 max_tx_queue_size; ++ u16 max_rx_queue_size; ++ u16 max_tx_sgl_size; ++ u16 max_rx_sgl_size; ++}; ++ + struct ena_tx_buffer { + struct sk_buff *skb; + /* num of ena desc for this specific skb +@@ -321,6 +333,9 @@ struct ena_adapter { + u32 tx_ring_size; + u32 rx_ring_size; + ++ u32 max_tx_ring_size; ++ u32 max_rx_ring_size; ++ + u32 msg_enable; + + u16 max_tx_sgl_size; diff --git a/debian/patches/features/all/ena/net-ena-enable-the-interrupt_moderation-in-driver_su.patch b/debian/patches/features/all/ena/net-ena-enable-the-interrupt_moderation-in-driver_su.patch new file mode 100644 index 000000000..3eb7e408c --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-enable-the-interrupt_moderation-in-driver_su.patch @@ -0,0 +1,63 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:29 +0300 +Subject: [PATCH] net: ena: enable the interrupt_moderation in + driver_supported_features +Origin: https://git.kernel.org/linus/bd21b0cc3a63d1c658b230db084b0f392b78cab2 +Bug-Debian: https://bugs.debian.org/941291 + +Add driver_supported_features to host_host info which is a new API used to +communicate to the device which features are supported by the driver. + +Add the interrupt_moderation bit to host_info->driver_supported_features +and enable it to signal the device that this driver supports interrupt +moderation properly. + +Reserved bits are for features implemented in the future + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 8 ++++++++ + drivers/net/ethernet/amazon/ena/ena_netdev.c | 3 +++ + 2 files changed, 11 insertions(+) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_admin_defs.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +@@ -808,6 +808,12 @@ struct ena_admin_host_info { + u16 num_cpus; + + u16 reserved; ++ ++ /* 1 :0 : reserved ++ * 2 : interrupt_moderation ++ * 31:3 : reserved ++ */ ++ u32 driver_supported_features; + }; + + struct ena_admin_rss_ind_table_entry { +@@ -1110,6 +1116,8 @@ struct ena_admin_ena_mmio_req_read_less_ + #define ENA_ADMIN_HOST_INFO_DEVICE_MASK GENMASK(7, 3) + #define ENA_ADMIN_HOST_INFO_BUS_SHIFT 8 + #define ENA_ADMIN_HOST_INFO_BUS_MASK GENMASK(15, 8) ++#define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT 2 ++#define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK BIT(2) + + /* aenq_common_desc */ + #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0) +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -2440,6 +2440,9 @@ static void ena_config_host_info(struct + ("K"[0] << ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT); + host_info->num_cpus = num_online_cpus(); + ++ host_info->driver_supported_features = ++ ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK; ++ + rc = ena_com_set_host_attributes(ena_dev); + if (rc) { + if (rc == -EOPNOTSUPP) diff --git a/debian/patches/features/all/ena/net-ena-fix-Free-napi-resources-when-ena_up-fails.patch b/debian/patches/features/all/ena/net-ena-fix-Free-napi-resources-when-ena_up-fails.patch new file mode 100644 index 000000000..f283f344a --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-Free-napi-resources-when-ena_up-fails.patch @@ -0,0 +1,34 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:05 +0300 +Subject: [PATCH] net: ena: fix: Free napi resources when ena_up() fails +Origin: https://git.kernel.org/linus/b287cdbd1cedfc9606682c6e02b58d00ff3a33ae +Bug-Debian: https://bugs.debian.org/941291 + +ena_up() calls ena_init_napi() but does not call ena_del_napi() in +case of failure. This causes a segmentation fault upon rmmod when +netif_napi_del() is called. Fix this bug by calling ena_del_napi() +before returning error from ena_up(). + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c +index dbcd58ebd0a9..03244155f74c 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -1825,6 +1825,7 @@ static int ena_up(struct ena_adapter *adapter) + err_setup_tx: + ena_free_io_irq(adapter); + err_req_irq: ++ ena_del_napi(adapter); + + return rc; + } +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-fix-ena_com_fill_hash_function-implementatio.patch b/debian/patches/features/all/ena/net-ena-fix-ena_com_fill_hash_function-implementatio.patch new file mode 100644 index 000000000..025cffc2c --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-ena_com_fill_hash_function-implementatio.patch @@ -0,0 +1,31 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:09 +0300 +Subject: [PATCH] net: ena: fix ena_com_fill_hash_function() implementation +Origin: https://git.kernel.org/linus/11bd7a00c0d8ffe33d1e926f8e789b4aea787186 +Bug-Debian: https://bugs.debian.org/941291 + +ena_com_fill_hash_function() didn't configure the rss->hash_func. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Netanel Belgazal +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index 677d31abf214..4cdd8459c37e 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2280,6 +2280,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, + return -EINVAL; + } + ++ rss->hash_func = func; + rc = ena_com_set_hash_function(ena_dev); + + /* Restore the old function */ +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-fix-incorrect-test-of-supported-hash-functio.patch b/debian/patches/features/all/ena/net-ena-fix-incorrect-test-of-supported-hash-functio.patch new file mode 100644 index 000000000..2872850f3 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-incorrect-test-of-supported-hash-functio.patch @@ -0,0 +1,36 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:06 +0300 +Subject: [PATCH] net: ena: fix incorrect test of supported hash function +Origin: https://git.kernel.org/linus/d3cfe7ddbc3dfbb9b201615b7fef8fd66d1b5fe8 +Bug-Debian: https://bugs.debian.org/941291 + +ena_com_set_hash_function() tests if a hash function is supported +by the device before setting it. +The test returns the opposite result than needed. +Reverse the condition to return the correct value. +Also use the BIT macro instead of inline shift. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index b17d435de09f..f9bc0b831a1a 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2195,7 +2195,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev) + if (unlikely(ret)) + return ret; + +- if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) { ++ if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) { + pr_err("Func hash %d isn't supported by device, abort\n", + rss->hash_func); + return -EOPNOTSUPP; +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-fix-incorrect-update-of-intr_delay_resolutio.patch b/debian/patches/features/all/ena/net-ena-fix-incorrect-update-of-intr_delay_resolutio.patch new file mode 100644 index 000000000..e194ecde9 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-incorrect-update-of-intr_delay_resolutio.patch @@ -0,0 +1,89 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:36 +0300 +Subject: [PATCH] net: ena: fix incorrect update of intr_delay_resolution +Origin: https://git.kernel.org/linus/79226cea4a5ebbd84a4eee1762526f664c7beb62 +Bug-Debian: https://bugs.debian.org/941291 + +ena_dev->intr_moder_rx/tx_interval save the intervals received from the +user after dividing them by ena_dev->intr_delay_resolution. Therefore +when intr_delay_resolution changes, the code needs to first mutiply +intr_moder_rx/tx_interval by the previous intr_delay_resolution to get +the value originally given by the user, and only then divide it by the +new intr_delay_resolution. + +Current code does not first multiply intr_moder_rx/tx_interval by the old +intr_delay_resolution. This commit fixes it. + +Also initialize ena_dev->intr_delay_resolution to be 1. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 21 ++++++++++++++++---- + drivers/net/ethernet/amazon/ena/ena_com.h | 1 + + drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + + 3 files changed, 19 insertions(+), 4 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -1281,17 +1281,30 @@ static int ena_com_ind_tbl_convert_from_ + static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev, + u16 intr_delay_resolution) + { ++ /* Initial value of intr_delay_resolution might be 0 */ ++ u16 prev_intr_delay_resolution = ++ ena_dev->intr_delay_resolution ? ++ ena_dev->intr_delay_resolution : ++ ENA_DEFAULT_INTR_DELAY_RESOLUTION; ++ + if (!intr_delay_resolution) { + pr_err("Illegal intr_delay_resolution provided. Going to use default 1 usec resolution\n"); +- intr_delay_resolution = 1; ++ intr_delay_resolution = ENA_DEFAULT_INTR_DELAY_RESOLUTION; + } +- ena_dev->intr_delay_resolution = intr_delay_resolution; + + /* update Rx */ +- ena_dev->intr_moder_rx_interval /= intr_delay_resolution; ++ ena_dev->intr_moder_rx_interval = ++ ena_dev->intr_moder_rx_interval * ++ prev_intr_delay_resolution / ++ intr_delay_resolution; + + /* update Tx */ +- ena_dev->intr_moder_tx_interval /= intr_delay_resolution; ++ ena_dev->intr_moder_tx_interval = ++ ena_dev->intr_moder_tx_interval * ++ prev_intr_delay_resolution / ++ intr_delay_resolution; ++ ++ ena_dev->intr_delay_resolution = intr_delay_resolution; + } + + /*****************************************************************************/ +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -74,6 +74,7 @@ + + #define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196 + #define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0 ++#define ENA_DEFAULT_INTR_DELAY_RESOLUTION 1 + + #define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3502,6 +3502,7 @@ static int ena_probe(struct pci_dev *pde + */ + ena_dev->intr_moder_tx_interval = ENA_INTR_INITIAL_TX_INTERVAL_USECS; + ena_dev->intr_moder_rx_interval = ENA_INTR_INITIAL_RX_INTERVAL_USECS; ++ ena_dev->intr_delay_resolution = ENA_DEFAULT_INTR_DELAY_RESOLUTION; + io_queue_num = ena_calc_io_queue_num(pdev, ena_dev, &get_feat_ctx); + rc = ena_calc_queue_size(&calc_queue_ctx); + if (rc || io_queue_num <= 0) { diff --git a/debian/patches/features/all/ena/net-ena-fix-retrieval-of-nonadaptive-interrupt-moder.patch b/debian/patches/features/all/ena/net-ena-fix-retrieval-of-nonadaptive-interrupt-moder.patch new file mode 100644 index 000000000..353f87dbf --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-retrieval-of-nonadaptive-interrupt-moder.patch @@ -0,0 +1,45 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:35 +0300 +Subject: [PATCH] net: ena: fix retrieval of nonadaptive interrupt moderation + intervals +Origin: https://git.kernel.org/linus/0eda847953d8dfb4b713ea62420f66157e230e13 +Bug-Debian: https://bugs.debian.org/941291 + +Nonadaptive interrupt moderation intervals are assigned the value set +by the user in ethtool -C divided by ena_dev->intr_delay_resolution. + +Therefore when the user tries to get the nonadaptive interrupt moderation +intervals with ethtool -c the code needs to multiply the saved value +by ena_dev->intr_delay_resolution. + +The current code erroneously divides instead of multiplying in ethtool -c. +This patch fixes this. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -310,14 +310,15 @@ static int ena_get_coalesce(struct net_d + /* the devie doesn't support interrupt moderation */ + return -EOPNOTSUPP; + } ++ + coalesce->tx_coalesce_usecs = +- ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) / ++ ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) * + ena_dev->intr_delay_resolution; + + if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) + coalesce->rx_coalesce_usecs = + ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) +- / ena_dev->intr_delay_resolution; ++ * ena_dev->intr_delay_resolution; + + coalesce->use_adaptive_rx_coalesce = + ena_com_get_adaptive_moderation_enabled(ena_dev); diff --git a/debian/patches/features/all/ena/net-ena-fix-return-value-of-ena_com_config_llq_info.patch b/debian/patches/features/all/ena/net-ena-fix-return-value-of-ena_com_config_llq_info.patch new file mode 100644 index 000000000..f757bf178 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-return-value-of-ena_com_config_llq_info.patch @@ -0,0 +1,34 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:07 +0300 +Subject: [PATCH] net: ena: fix return value of ena_com_config_llq_info() +Origin: https://git.kernel.org/linus/9a27de0c6ba10fe1af74d16d3524425e52c1ba3e +Bug-Debian: https://bugs.debian.org/941291 + +ena_com_config_llq_info() returns 0 even if ena_com_set_llq() fails. +Return the failure code of ena_com_set_llq() in case it fails. + +fixes: 689b2bdaaa14 ("net: ena: add functions for handling Low Latency Queues in ena_com") + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index f9bc0b831a1a..4fe437fe771b 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -731,7 +731,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev, + if (rc) + pr_err("Cannot set LLQ configuration: %d\n", rc); + +- return 0; ++ return rc; + } + + static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *comp_ctx, +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-fix-set-freed-objects-to-NULL-to-avoid-faili.patch b/debian/patches/features/all/ena/net-ena-fix-set-freed-objects-to-NULL-to-avoid-faili.patch new file mode 100644 index 000000000..bc30849de --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-set-freed-objects-to-NULL-to-avoid-faili.patch @@ -0,0 +1,91 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:04 +0300 +Subject: [PATCH] net: ena: fix: set freed objects to NULL to avoid failing + future allocations +Origin: https://git.kernel.org/linus/8ee8ee7fe87bf64738ab4e31be036a7165608b27 +Bug-Debian: https://bugs.debian.org/941291 + +In some cases when a queue related allocation fails, successful past +allocations are freed but the pointer that pointed to them is not +set to NULL. This is a problem for 2 reasons: +1. This is generally a bad practice since this pointer might be +accidentally accessed in the future. +2. Future allocations using the same pointer check if the pointer +is NULL and fail if it is not. + +Fixed this by setting such pointers to NULL in the allocation of +queue related objects. + +Also refactored the code of ena_setup_tx_resources() to goto-style +error handling to avoid code duplication of resource freeing. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 25 ++++++++++++-------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -224,28 +224,23 @@ static int ena_setup_tx_resources(struct + if (!tx_ring->tx_buffer_info) { + tx_ring->tx_buffer_info = vzalloc(size); + if (!tx_ring->tx_buffer_info) +- return -ENOMEM; ++ goto err_tx_buffer_info; + } + + size = sizeof(u16) * tx_ring->ring_size; + tx_ring->free_tx_ids = vzalloc_node(size, node); + if (!tx_ring->free_tx_ids) { + tx_ring->free_tx_ids = vzalloc(size); +- if (!tx_ring->free_tx_ids) { +- vfree(tx_ring->tx_buffer_info); +- return -ENOMEM; +- } ++ if (!tx_ring->free_tx_ids) ++ goto err_free_tx_ids; + } + + size = tx_ring->tx_max_header_size; + tx_ring->push_buf_intermediate_buf = vzalloc_node(size, node); + if (!tx_ring->push_buf_intermediate_buf) { + tx_ring->push_buf_intermediate_buf = vzalloc(size); +- if (!tx_ring->push_buf_intermediate_buf) { +- vfree(tx_ring->tx_buffer_info); +- vfree(tx_ring->free_tx_ids); +- return -ENOMEM; +- } ++ if (!tx_ring->push_buf_intermediate_buf) ++ goto err_push_buf_intermediate_buf; + } + + /* Req id ring for TX out of order completions */ +@@ -259,6 +254,15 @@ static int ena_setup_tx_resources(struct + tx_ring->next_to_clean = 0; + tx_ring->cpu = ena_irq->cpu; + return 0; ++ ++err_push_buf_intermediate_buf: ++ vfree(tx_ring->free_tx_ids); ++ tx_ring->free_tx_ids = NULL; ++err_free_tx_ids: ++ vfree(tx_ring->tx_buffer_info); ++ tx_ring->tx_buffer_info = NULL; ++err_tx_buffer_info: ++ return -ENOMEM; + } + + /* ena_free_tx_resources - Free I/O Tx Resources per Queue +@@ -378,6 +382,7 @@ static int ena_setup_rx_resources(struct + rx_ring->free_rx_ids = vzalloc(size); + if (!rx_ring->free_rx_ids) { + vfree(rx_ring->rx_buffer_info); ++ rx_ring->rx_buffer_info = NULL; + return -ENOMEM; + } + } diff --git a/debian/patches/features/all/ena/net-ena-fix-swapped-parameters-when-calling-ena_com_.patch b/debian/patches/features/all/ena/net-ena-fix-swapped-parameters-when-calling-ena_com_.patch new file mode 100644 index 000000000..9a4528664 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-swapped-parameters-when-calling-ena_com_.patch @@ -0,0 +1,32 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:03 +0300 +Subject: [PATCH] net: ena: fix swapped parameters when calling + ena_com_indirect_table_fill_entry +Origin: https://git.kernel.org/linus/3c6eeff295f01bdf1c6c3addcb0a04c0c6c029e9 +Bug-Debian: https://bugs.debian.org/941291 + +second parameter should be the index of the table rather than the value. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Saeed Bshara +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -717,8 +717,8 @@ static int ena_set_rxfh(struct net_devic + if (indir) { + for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) { + rc = ena_com_indirect_table_fill_entry(ena_dev, +- ENA_IO_RXQ_IDX(indir[i]), +- i); ++ i, ++ ENA_IO_RXQ_IDX(indir[i])); + if (unlikely(rc)) { + netif_err(adapter, drv, netdev, + "Cannot fill indirect table (index is too large)\n"); diff --git a/debian/patches/features/all/ena/net-ena-fix-update-of-interrupt-moderation-register.patch b/debian/patches/features/all/ena/net-ena-fix-update-of-interrupt-moderation-register.patch new file mode 100644 index 000000000..72137a523 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-fix-update-of-interrupt-moderation-register.patch @@ -0,0 +1,39 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:34 +0300 +Subject: [PATCH] net: ena: fix update of interrupt moderation register +Origin: https://git.kernel.org/linus/7b8a28787e2ba671eaeb073e3b62fb4786338a09 +Bug-Debian: https://bugs.debian.org/941291 + +Current implementation always updates the interrupt register with +the smoothed_interval of the rx_ring. However this should be +done only in case of adaptive interrupt moderation. If non-adaptive +interrupt moderation is used, the non-adaptive interrupt moderation +interval should be used. This commit fixes that. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -1188,12 +1188,15 @@ static void ena_unmask_interrupt(struct + struct ena_ring *rx_ring) + { + struct ena_eth_io_intr_reg intr_reg; ++ u32 rx_interval = ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev) ? ++ rx_ring->smoothed_interval : ++ ena_com_get_nonadaptive_moderation_interval_rx(rx_ring->ena_dev); + + /* Update intr register: rx intr delay, + * tx intr delay and interrupt unmask + */ + ena_com_update_intr_reg(&intr_reg, +- rx_ring->smoothed_interval, ++ rx_interval, + tx_ring->smoothed_interval, + true); + diff --git a/debian/patches/features/all/ena/net-ena-improve-latency-by-disabling-adaptive-interr.patch b/debian/patches/features/all/ena/net-ena-improve-latency-by-disabling-adaptive-interr.patch new file mode 100644 index 000000000..ec5dc707c --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-improve-latency-by-disabling-adaptive-interr.patch @@ -0,0 +1,41 @@ +From: Sameeh Jubran +Date: Wed, 1 May 2019 16:47:08 +0300 +Subject: [PATCH] net: ena: improve latency by disabling adaptive interrupt + moderation by default +Origin: https://git.kernel.org/linus/78cb421d185cfb4fcea94e7c3ff6e6ea77bb8c11 +Bug-Debian: https://bugs.debian.org/941291 + +Adaptive interrupt moderation was erroneously enabled by default +in the driver. + +In case the device supports adaptive interrupt moderation it will +be automatically used, which may potentially increase latency. + +The adaptive moderation can be enabled from ethtool command in +case the feature is supported by the device. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Guy Tzalik +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2801,7 +2801,11 @@ int ena_com_init_interrupt_moderation(st + /* if moderation is supported by device we set adaptive moderation */ + delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution; + ena_com_update_intr_delay_resolution(ena_dev, delay_resolution); +- ena_com_enable_adaptive_moderation(ena_dev); ++ ++ /* Disable adaptive moderation by default - can be enabled from ++ * ethtool ++ */ ++ ena_com_disable_adaptive_moderation(ena_dev); + + return 0; + err: diff --git a/debian/patches/features/all/ena/net-ena-make-ethtool-show-correct-current-and-max-qu.patch b/debian/patches/features/all/ena/net-ena-make-ethtool-show-correct-current-and-max-qu.patch new file mode 100644 index 000000000..3367bc9f9 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-make-ethtool-show-correct-current-and-max-qu.patch @@ -0,0 +1,53 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:07 +0300 +Subject: [PATCH] net: ena: make ethtool show correct current and max queue + sizes +Origin: https://git.kernel.org/linus/9f9ae3f98b8d8b8aa709831057759dbb52ba5083 +Bug-Debian: https://bugs.debian.org/941291 + +Currently ethtool -g shows the same size for current and max queue +sizes. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 10 ++++------ + drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 ++ + 2 files changed, 6 insertions(+), 6 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -447,13 +447,11 @@ static void ena_get_ringparam(struct net + struct ethtool_ringparam *ring) + { + struct ena_adapter *adapter = netdev_priv(netdev); +- struct ena_ring *tx_ring = &adapter->tx_ring[0]; +- struct ena_ring *rx_ring = &adapter->rx_ring[0]; + +- ring->rx_max_pending = rx_ring->ring_size; +- ring->tx_max_pending = tx_ring->ring_size; +- ring->rx_pending = rx_ring->ring_size; +- ring->tx_pending = tx_ring->ring_size; ++ ring->tx_max_pending = adapter->max_tx_ring_size; ++ ring->rx_max_pending = adapter->max_rx_ring_size; ++ ring->tx_pending = adapter->tx_ring_size; ++ ring->rx_pending = adapter->rx_ring_size; + } + + static u32 ena_flow_hash_to_flow_type(u16 hash_fields) +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3428,6 +3428,8 @@ static int ena_probe(struct pci_dev *pde + + adapter->tx_ring_size = calc_queue_ctx.tx_queue_size; + adapter->rx_ring_size = calc_queue_ctx.rx_queue_size; ++ adapter->max_tx_ring_size = calc_queue_ctx.max_tx_queue_size; ++ adapter->max_rx_ring_size = calc_queue_ctx.max_rx_queue_size; + adapter->max_tx_sgl_size = calc_queue_ctx.max_tx_sgl_size; + adapter->max_rx_sgl_size = calc_queue_ctx.max_rx_sgl_size; + diff --git a/debian/patches/features/all/ena/net-ena-optimise-calculations-for-CQ-doorbell.patch b/debian/patches/features/all/ena/net-ena-optimise-calculations-for-CQ-doorbell.patch new file mode 100644 index 000000000..c790eae13 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-optimise-calculations-for-CQ-doorbell.patch @@ -0,0 +1,50 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:27 +0300 +Subject: [PATCH] net: ena: optimise calculations for CQ doorbell +Origin: https://git.kernel.org/linus/d91860989dd4bce582ed6c3647a0d41d6fd895b3 +Bug-Debian: https://bugs.debian.org/941291 + +This patch initially checks if CQ doorbell +is needed before proceeding with the calculations. + +Signed-off-by: Igor Chauskin +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_eth_com.h | 20 ++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.h b/drivers/net/ethernet/amazon/ena/ena_eth_com.h +index 0a3d9180e40e..77986c0ea52c 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_eth_com.h ++++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.h +@@ -195,15 +195,17 @@ static inline int ena_com_update_dev_comp_head(struct ena_com_io_cq *io_cq) + u16 unreported_comp, head; + bool need_update; + +- head = io_cq->head; +- unreported_comp = head - io_cq->last_head_update; +- need_update = unreported_comp > (io_cq->q_depth / ENA_COMP_HEAD_THRESH); +- +- if (io_cq->cq_head_db_reg && need_update) { +- pr_debug("Write completion queue doorbell for queue %d: head: %d\n", +- io_cq->qid, head); +- writel(head, io_cq->cq_head_db_reg); +- io_cq->last_head_update = head; ++ if (unlikely(io_cq->cq_head_db_reg)) { ++ head = io_cq->head; ++ unreported_comp = head - io_cq->last_head_update; ++ need_update = unreported_comp > (io_cq->q_depth / ENA_COMP_HEAD_THRESH); ++ ++ if (unlikely(need_update)) { ++ pr_debug("Write completion queue doorbell for queue %d: head: %d\n", ++ io_cq->qid, head); ++ writel(head, io_cq->cq_head_db_reg); ++ io_cq->last_head_update = head; ++ } + } + + return 0; +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-reimplement-set-get_coalesce.patch b/debian/patches/features/all/ena/net-ena-reimplement-set-get_coalesce.patch new file mode 100644 index 000000000..c88ebef3a --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-reimplement-set-get_coalesce.patch @@ -0,0 +1,158 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:28 +0300 +Subject: [PATCH] net: ena: reimplement set/get_coalesce() +Origin: https://git.kernel.org/linus/b3db86dc4b82ffc63e33c78dafc09d5c78ac4fe4 +Bug-Debian: https://bugs.debian.org/941291 + +1. Remove old adaptive interrupt moderation code from set/get_coalesce() +2. Add ena_update_rx_rings_intr_moderation() function for updating + nonadaptive interrupt moderation intervals similarly to + ena_update_tx_rings_intr_moderation(). +3. Remove checks of multiple unsupported received interrupt coalescing + parameters. This makes code cleaner and cancels the need to update + it every time a new coalescing parameter is invented. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 84 ++++++------------- + 1 file changed, 26 insertions(+), 58 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -305,7 +305,6 @@ static int ena_get_coalesce(struct net_d + { + struct ena_adapter *adapter = netdev_priv(net_dev); + struct ena_com_dev *ena_dev = adapter->ena_dev; +- struct ena_intr_moder_entry intr_moder_entry; + + if (!ena_com_interrupt_moderation_supported(ena_dev)) { + /* the devie doesn't support interrupt moderation */ +@@ -314,23 +313,12 @@ static int ena_get_coalesce(struct net_d + coalesce->tx_coalesce_usecs = + ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) / + ena_dev->intr_delay_resolution; +- if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) { ++ ++ if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) + coalesce->rx_coalesce_usecs = + ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) + / ena_dev->intr_delay_resolution; +- } else { +- ena_com_get_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_LOWEST, &intr_moder_entry); +- coalesce->rx_coalesce_usecs_low = intr_moder_entry.intr_moder_interval; +- coalesce->rx_max_coalesced_frames_low = intr_moder_entry.pkts_per_interval; +- +- ena_com_get_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_MID, &intr_moder_entry); +- coalesce->rx_coalesce_usecs = intr_moder_entry.intr_moder_interval; +- coalesce->rx_max_coalesced_frames = intr_moder_entry.pkts_per_interval; +- +- ena_com_get_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_HIGHEST, &intr_moder_entry); +- coalesce->rx_coalesce_usecs_high = intr_moder_entry.intr_moder_interval; +- coalesce->rx_max_coalesced_frames_high = intr_moder_entry.pkts_per_interval; +- } ++ + coalesce->use_adaptive_rx_coalesce = + ena_com_get_adaptive_moderation_enabled(ena_dev); + +@@ -348,12 +336,22 @@ static void ena_update_tx_rings_intr_mod + adapter->tx_ring[i].smoothed_interval = val; + } + ++static void ena_update_rx_rings_intr_moderation(struct ena_adapter *adapter) ++{ ++ unsigned int val; ++ int i; ++ ++ val = ena_com_get_nonadaptive_moderation_interval_rx(adapter->ena_dev); ++ ++ for (i = 0; i < adapter->num_queues; i++) ++ adapter->rx_ring[i].smoothed_interval = val; ++} ++ + static int ena_set_coalesce(struct net_device *net_dev, + struct ethtool_coalesce *coalesce) + { + struct ena_adapter *adapter = netdev_priv(net_dev); + struct ena_com_dev *ena_dev = adapter->ena_dev; +- struct ena_intr_moder_entry intr_moder_entry; + int rc; + + if (!ena_com_interrupt_moderation_supported(ena_dev)) { +@@ -361,22 +359,6 @@ static int ena_set_coalesce(struct net_d + return -EOPNOTSUPP; + } + +- if (coalesce->rx_coalesce_usecs_irq || +- coalesce->rx_max_coalesced_frames_irq || +- coalesce->tx_coalesce_usecs_irq || +- coalesce->tx_max_coalesced_frames || +- coalesce->tx_max_coalesced_frames_irq || +- coalesce->stats_block_coalesce_usecs || +- coalesce->use_adaptive_tx_coalesce || +- coalesce->pkt_rate_low || +- coalesce->tx_coalesce_usecs_low || +- coalesce->tx_max_coalesced_frames_low || +- coalesce->pkt_rate_high || +- coalesce->tx_coalesce_usecs_high || +- coalesce->tx_max_coalesced_frames_high || +- coalesce->rate_sample_interval) +- return -EINVAL; +- + rc = ena_com_update_nonadaptive_moderation_interval_tx(ena_dev, + coalesce->tx_coalesce_usecs); + if (rc) +@@ -384,37 +366,23 @@ static int ena_set_coalesce(struct net_d + + ena_update_tx_rings_intr_moderation(adapter); + +- if (ena_com_get_adaptive_moderation_enabled(ena_dev)) { +- if (!coalesce->use_adaptive_rx_coalesce) { +- ena_com_disable_adaptive_moderation(ena_dev); +- rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, +- coalesce->rx_coalesce_usecs); +- return rc; +- } +- } else { /* was in non-adaptive mode */ +- if (coalesce->use_adaptive_rx_coalesce) { ++ if (coalesce->use_adaptive_rx_coalesce) { ++ if (!ena_com_get_adaptive_moderation_enabled(ena_dev)) + ena_com_enable_adaptive_moderation(ena_dev); +- } else { +- rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, +- coalesce->rx_coalesce_usecs); +- return rc; +- } ++ return 0; + } + +- intr_moder_entry.intr_moder_interval = coalesce->rx_coalesce_usecs_low; +- intr_moder_entry.pkts_per_interval = coalesce->rx_max_coalesced_frames_low; +- intr_moder_entry.bytes_per_interval = ENA_INTR_BYTE_COUNT_NOT_SUPPORTED; +- ena_com_init_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_LOWEST, &intr_moder_entry); +- +- intr_moder_entry.intr_moder_interval = coalesce->rx_coalesce_usecs; +- intr_moder_entry.pkts_per_interval = coalesce->rx_max_coalesced_frames; +- intr_moder_entry.bytes_per_interval = ENA_INTR_BYTE_COUNT_NOT_SUPPORTED; +- ena_com_init_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_MID, &intr_moder_entry); +- +- intr_moder_entry.intr_moder_interval = coalesce->rx_coalesce_usecs_high; +- intr_moder_entry.pkts_per_interval = coalesce->rx_max_coalesced_frames_high; +- intr_moder_entry.bytes_per_interval = ENA_INTR_BYTE_COUNT_NOT_SUPPORTED; +- ena_com_init_intr_moderation_entry(adapter->ena_dev, ENA_INTR_MODER_HIGHEST, &intr_moder_entry); ++ rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, ++ coalesce->rx_coalesce_usecs); ++ if (rc) ++ return rc; ++ ++ ena_update_rx_rings_intr_moderation(adapter); ++ ++ if (!coalesce->use_adaptive_rx_coalesce) { ++ if (ena_com_get_adaptive_moderation_enabled(ena_dev)) ++ ena_com_disable_adaptive_moderation(ena_dev); ++ } + + return 0; + } diff --git a/debian/patches/features/all/ena/net-ena-remove-all-old-adaptive-rx-interrupt-moderat.patch b/debian/patches/features/all/ena/net-ena-remove-all-old-adaptive-rx-interrupt-moderat.patch new file mode 100644 index 000000000..2f3c2839d --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-remove-all-old-adaptive-rx-interrupt-moderat.patch @@ -0,0 +1,361 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:33 +0300 +Subject: [PATCH] net: ena: remove all old adaptive rx interrupt moderation + code from ena_com +Origin: https://git.kernel.org/linus/3ced8cbdf7ddb3160ffa714a91040dd18f39a12c +Bug-Debian: https://bugs.debian.org/941291 + +Remove previous implementation of adaptive rx interrupt moderation +from ena_com files. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 110 ----------------- + drivers/net/ethernet/amazon/ena/ena_com.h | 142 ---------------------- + 2 files changed, 252 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -1278,22 +1278,6 @@ static int ena_com_ind_tbl_convert_from_ + return 0; + } + +-static int ena_com_init_interrupt_moderation_table(struct ena_com_dev *ena_dev) +-{ +- size_t size; +- +- size = sizeof(struct ena_intr_moder_entry) * ENA_INTR_MAX_NUM_OF_LEVELS; +- +- ena_dev->intr_moder_tbl = +- devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); +- if (!ena_dev->intr_moder_tbl) +- return -ENOMEM; +- +- ena_com_config_default_interrupt_moderation_table(ena_dev); +- +- return 0; +-} +- + static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev, + u16 intr_delay_resolution) + { +@@ -2802,13 +2786,6 @@ int ena_com_update_nonadaptive_moderatio + &ena_dev->intr_moder_rx_interval); + } + +-void ena_com_destroy_interrupt_moderation(struct ena_com_dev *ena_dev) +-{ +- if (ena_dev->intr_moder_tbl) +- devm_kfree(ena_dev->dmadev, ena_dev->intr_moder_tbl); +- ena_dev->intr_moder_tbl = NULL; +-} +- + int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev) + { + struct ena_admin_get_feat_resp get_resp; +@@ -2833,10 +2810,6 @@ int ena_com_init_interrupt_moderation(st + return rc; + } + +- rc = ena_com_init_interrupt_moderation_table(ena_dev); +- if (rc) +- goto err; +- + /* if moderation is supported by device we set adaptive moderation */ + delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution; + ena_com_update_intr_delay_resolution(ena_dev, delay_resolution); +@@ -2845,52 +2818,6 @@ int ena_com_init_interrupt_moderation(st + ena_com_disable_adaptive_moderation(ena_dev); + + return 0; +-err: +- ena_com_destroy_interrupt_moderation(ena_dev); +- return rc; +-} +- +-void ena_com_config_default_interrupt_moderation_table(struct ena_com_dev *ena_dev) +-{ +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- +- if (!intr_moder_tbl) +- return; +- +- intr_moder_tbl[ENA_INTR_MODER_LOWEST].intr_moder_interval = +- ENA_INTR_LOWEST_USECS; +- intr_moder_tbl[ENA_INTR_MODER_LOWEST].pkts_per_interval = +- ENA_INTR_LOWEST_PKTS; +- intr_moder_tbl[ENA_INTR_MODER_LOWEST].bytes_per_interval = +- ENA_INTR_LOWEST_BYTES; +- +- intr_moder_tbl[ENA_INTR_MODER_LOW].intr_moder_interval = +- ENA_INTR_LOW_USECS; +- intr_moder_tbl[ENA_INTR_MODER_LOW].pkts_per_interval = +- ENA_INTR_LOW_PKTS; +- intr_moder_tbl[ENA_INTR_MODER_LOW].bytes_per_interval = +- ENA_INTR_LOW_BYTES; +- +- intr_moder_tbl[ENA_INTR_MODER_MID].intr_moder_interval = +- ENA_INTR_MID_USECS; +- intr_moder_tbl[ENA_INTR_MODER_MID].pkts_per_interval = +- ENA_INTR_MID_PKTS; +- intr_moder_tbl[ENA_INTR_MODER_MID].bytes_per_interval = +- ENA_INTR_MID_BYTES; +- +- intr_moder_tbl[ENA_INTR_MODER_HIGH].intr_moder_interval = +- ENA_INTR_HIGH_USECS; +- intr_moder_tbl[ENA_INTR_MODER_HIGH].pkts_per_interval = +- ENA_INTR_HIGH_PKTS; +- intr_moder_tbl[ENA_INTR_MODER_HIGH].bytes_per_interval = +- ENA_INTR_HIGH_BYTES; +- +- intr_moder_tbl[ENA_INTR_MODER_HIGHEST].intr_moder_interval = +- ENA_INTR_HIGHEST_USECS; +- intr_moder_tbl[ENA_INTR_MODER_HIGHEST].pkts_per_interval = +- ENA_INTR_HIGHEST_PKTS; +- intr_moder_tbl[ENA_INTR_MODER_HIGHEST].bytes_per_interval = +- ENA_INTR_HIGHEST_BYTES; + } + + unsigned int ena_com_get_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev) +@@ -2903,43 +2830,6 @@ unsigned int ena_com_get_nonadaptive_mod + return ena_dev->intr_moder_rx_interval; + } + +-void ena_com_init_intr_moderation_entry(struct ena_com_dev *ena_dev, +- enum ena_intr_moder_level level, +- struct ena_intr_moder_entry *entry) +-{ +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- +- if (level >= ENA_INTR_MAX_NUM_OF_LEVELS) +- return; +- +- intr_moder_tbl[level].intr_moder_interval = entry->intr_moder_interval; +- if (ena_dev->intr_delay_resolution) +- intr_moder_tbl[level].intr_moder_interval /= +- ena_dev->intr_delay_resolution; +- intr_moder_tbl[level].pkts_per_interval = entry->pkts_per_interval; +- +- /* use hardcoded value until ethtool supports bytecount parameter */ +- if (entry->bytes_per_interval != ENA_INTR_BYTE_COUNT_NOT_SUPPORTED) +- intr_moder_tbl[level].bytes_per_interval = entry->bytes_per_interval; +-} +- +-void ena_com_get_intr_moderation_entry(struct ena_com_dev *ena_dev, +- enum ena_intr_moder_level level, +- struct ena_intr_moder_entry *entry) +-{ +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- +- if (level >= ENA_INTR_MAX_NUM_OF_LEVELS) +- return; +- +- entry->intr_moder_interval = intr_moder_tbl[level].intr_moder_interval; +- if (ena_dev->intr_delay_resolution) +- entry->intr_moder_interval *= ena_dev->intr_delay_resolution; +- entry->pkts_per_interval = +- intr_moder_tbl[level].pkts_per_interval; +- entry->bytes_per_interval = intr_moder_tbl[level].bytes_per_interval; +-} +- + int ena_com_config_dev_mode(struct ena_com_dev *ena_dev, + struct ena_admin_feature_llq_desc *llq_features, + struct ena_llq_configurations *llq_default_cfg) +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -72,46 +72,13 @@ + /*****************************************************************************/ + /* ENA adaptive interrupt moderation settings */ + +-#define ENA_INTR_LOWEST_USECS (0) +-#define ENA_INTR_LOWEST_PKTS (3) +-#define ENA_INTR_LOWEST_BYTES (2 * 1524) +- +-#define ENA_INTR_LOW_USECS (32) +-#define ENA_INTR_LOW_PKTS (12) +-#define ENA_INTR_LOW_BYTES (16 * 1024) +- +-#define ENA_INTR_MID_USECS (80) +-#define ENA_INTR_MID_PKTS (48) +-#define ENA_INTR_MID_BYTES (64 * 1024) +- +-#define ENA_INTR_HIGH_USECS (128) +-#define ENA_INTR_HIGH_PKTS (96) +-#define ENA_INTR_HIGH_BYTES (128 * 1024) +- +-#define ENA_INTR_HIGHEST_USECS (192) +-#define ENA_INTR_HIGHEST_PKTS (128) +-#define ENA_INTR_HIGHEST_BYTES (192 * 1024) +- + #define ENA_INTR_INITIAL_TX_INTERVAL_USECS 196 + #define ENA_INTR_INITIAL_RX_INTERVAL_USECS 0 +-#define ENA_INTR_DELAY_OLD_VALUE_WEIGHT 6 +-#define ENA_INTR_DELAY_NEW_VALUE_WEIGHT 4 +-#define ENA_INTR_MODER_LEVEL_STRIDE 2 +-#define ENA_INTR_BYTE_COUNT_NOT_SUPPORTED 0xFFFFFF + + #define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF + + #define ENA_FEATURE_MAX_QUEUE_EXT_VER 1 + +-enum ena_intr_moder_level { +- ENA_INTR_MODER_LOWEST = 0, +- ENA_INTR_MODER_LOW, +- ENA_INTR_MODER_MID, +- ENA_INTR_MODER_HIGH, +- ENA_INTR_MODER_HIGHEST, +- ENA_INTR_MAX_NUM_OF_LEVELS, +-}; +- + struct ena_llq_configurations { + enum ena_admin_llq_header_location llq_header_location; + enum ena_admin_llq_ring_entry_size llq_ring_entry_size; +@@ -120,12 +87,6 @@ struct ena_llq_configurations { + u16 llq_ring_entry_size_value; + }; + +-struct ena_intr_moder_entry { +- unsigned int intr_moder_interval; +- unsigned int pkts_per_interval; +- unsigned int bytes_per_interval; +-}; +- + enum queue_direction { + ENA_COM_IO_QUEUE_DIRECTION_TX, + ENA_COM_IO_QUEUE_DIRECTION_RX +@@ -920,11 +881,6 @@ int ena_com_execute_admin_command(struct + */ + int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev); + +-/* ena_com_destroy_interrupt_moderation - Destroy interrupt moderation resources +- * @ena_dev: ENA communication layer struct +- */ +-void ena_com_destroy_interrupt_moderation(struct ena_com_dev *ena_dev); +- + /* ena_com_interrupt_moderation_supported - Return if interrupt moderation + * capability is supported by the device. + * +@@ -932,12 +888,6 @@ void ena_com_destroy_interrupt_moderatio + */ + bool ena_com_interrupt_moderation_supported(struct ena_com_dev *ena_dev); + +-/* ena_com_config_default_interrupt_moderation_table - Restore the interrupt +- * moderation table back to the default parameters. +- * @ena_dev: ENA communication layer struct +- */ +-void ena_com_config_default_interrupt_moderation_table(struct ena_com_dev *ena_dev); +- + /* ena_com_update_nonadaptive_moderation_interval_tx - Update the + * non-adaptive interval in Tx direction. + * @ena_dev: ENA communication layer struct +@@ -974,29 +924,6 @@ unsigned int ena_com_get_nonadaptive_mod + */ + unsigned int ena_com_get_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev); + +-/* ena_com_init_intr_moderation_entry - Update a single entry in the interrupt +- * moderation table. +- * @ena_dev: ENA communication layer struct +- * @level: Interrupt moderation table level +- * @entry: Entry value +- * +- * Update a single entry in the interrupt moderation table. +- */ +-void ena_com_init_intr_moderation_entry(struct ena_com_dev *ena_dev, +- enum ena_intr_moder_level level, +- struct ena_intr_moder_entry *entry); +- +-/* ena_com_get_intr_moderation_entry - Init ena_intr_moder_entry. +- * @ena_dev: ENA communication layer struct +- * @level: Interrupt moderation table level +- * @entry: Entry to fill. +- * +- * Initialize the entry according to the adaptive interrupt moderation table. +- */ +-void ena_com_get_intr_moderation_entry(struct ena_com_dev *ena_dev, +- enum ena_intr_moder_level level, +- struct ena_intr_moder_entry *entry); +- + /* ena_com_config_dev_mode - Configure the placement policy of the device. + * @ena_dev: ENA communication layer struct + * @llq_features: LLQ feature descriptor, retrieve via +@@ -1022,75 +949,6 @@ static inline void ena_com_disable_adapt + ena_dev->adaptive_coalescing = false; + } + +-/* ena_com_calculate_interrupt_delay - Calculate new interrupt delay +- * @ena_dev: ENA communication layer struct +- * @pkts: Number of packets since the last update +- * @bytes: Number of bytes received since the last update. +- * @smoothed_interval: Returned interval +- * @moder_tbl_idx: Current table level as input update new level as return +- * value. +- */ +-static inline void ena_com_calculate_interrupt_delay(struct ena_com_dev *ena_dev, +- unsigned int pkts, +- unsigned int bytes, +- unsigned int *smoothed_interval, +- unsigned int *moder_tbl_idx) +-{ +- enum ena_intr_moder_level curr_moder_idx, new_moder_idx; +- struct ena_intr_moder_entry *curr_moder_entry; +- struct ena_intr_moder_entry *pred_moder_entry; +- struct ena_intr_moder_entry *new_moder_entry; +- struct ena_intr_moder_entry *intr_moder_tbl = ena_dev->intr_moder_tbl; +- unsigned int interval; +- +- /* We apply adaptive moderation on Rx path only. +- * Tx uses static interrupt moderation. +- */ +- if (!pkts || !bytes) +- /* Tx interrupt, or spurious interrupt, +- * in both cases we just use same delay values +- */ +- return; +- +- curr_moder_idx = (enum ena_intr_moder_level)(*moder_tbl_idx); +- if (unlikely(curr_moder_idx >= ENA_INTR_MAX_NUM_OF_LEVELS)) { +- pr_err("Wrong moderation index %u\n", curr_moder_idx); +- return; +- } +- +- curr_moder_entry = &intr_moder_tbl[curr_moder_idx]; +- new_moder_idx = curr_moder_idx; +- +- if (curr_moder_idx == ENA_INTR_MODER_LOWEST) { +- if ((pkts > curr_moder_entry->pkts_per_interval) || +- (bytes > curr_moder_entry->bytes_per_interval)) +- new_moder_idx = +- (enum ena_intr_moder_level)(curr_moder_idx + ENA_INTR_MODER_LEVEL_STRIDE); +- } else { +- pred_moder_entry = &intr_moder_tbl[curr_moder_idx - ENA_INTR_MODER_LEVEL_STRIDE]; +- +- if ((pkts <= pred_moder_entry->pkts_per_interval) || +- (bytes <= pred_moder_entry->bytes_per_interval)) +- new_moder_idx = +- (enum ena_intr_moder_level)(curr_moder_idx - ENA_INTR_MODER_LEVEL_STRIDE); +- else if ((pkts > curr_moder_entry->pkts_per_interval) || +- (bytes > curr_moder_entry->bytes_per_interval)) { +- if (curr_moder_idx != ENA_INTR_MODER_HIGHEST) +- new_moder_idx = +- (enum ena_intr_moder_level)(curr_moder_idx + ENA_INTR_MODER_LEVEL_STRIDE); +- } +- } +- new_moder_entry = &intr_moder_tbl[new_moder_idx]; +- +- interval = new_moder_entry->intr_moder_interval; +- *smoothed_interval = ( +- (interval * ENA_INTR_DELAY_NEW_VALUE_WEIGHT + +- ENA_INTR_DELAY_OLD_VALUE_WEIGHT * (*smoothed_interval)) + 5) / +- 10; +- +- *moder_tbl_idx = new_moder_idx; +-} +- + /* ena_com_update_intr_reg - Prepare interrupt register + * @intr_reg: interrupt register to update. + * @rx_delay_interval: Rx interval in usecs diff --git a/debian/patches/features/all/ena/net-ena-remove-code-duplication-in-ena_com_update_no.patch b/debian/patches/features/all/ena/net-ena-remove-code-duplication-in-ena_com_update_no.patch new file mode 100644 index 000000000..3dcad5609 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-remove-code-duplication-in-ena_com_update_no.patch @@ -0,0 +1,71 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:30 +0300 +Subject: [PATCH] net: ena: remove code duplication in + ena_com_update_nonadaptive_moderation_interval _*() +Origin: https://git.kernel.org/linus/57e3a5f24bb5bf265988e973a911845abcbf6a00 +Bug-Debian: https://bugs.debian.org/941291 + +Remove code duplication in: +ena_com_update_nonadaptive_moderation_interval_tx() +ena_com_update_nonadaptive_moderation_interval_rx() +functions. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 30 ++++++++++++----------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2772,32 +2772,34 @@ bool ena_com_interrupt_moderation_suppor + ENA_ADMIN_INTERRUPT_MODERATION); + } + +-int ena_com_update_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev, +- u32 tx_coalesce_usecs) ++static int ena_com_update_nonadaptive_moderation_interval(u32 coalesce_usecs, ++ u32 intr_delay_resolution, ++ u32 *intr_moder_interval) + { +- if (!ena_dev->intr_delay_resolution) { ++ if (!intr_delay_resolution) { + pr_err("Illegal interrupt delay granularity value\n"); + return -EFAULT; + } + +- ena_dev->intr_moder_tx_interval = tx_coalesce_usecs / +- ena_dev->intr_delay_resolution; ++ *intr_moder_interval = coalesce_usecs / intr_delay_resolution; + + return 0; + } + ++int ena_com_update_nonadaptive_moderation_interval_tx(struct ena_com_dev *ena_dev, ++ u32 tx_coalesce_usecs) ++{ ++ return ena_com_update_nonadaptive_moderation_interval(tx_coalesce_usecs, ++ ena_dev->intr_delay_resolution, ++ &ena_dev->intr_moder_tx_interval); ++} ++ + int ena_com_update_nonadaptive_moderation_interval_rx(struct ena_com_dev *ena_dev, + u32 rx_coalesce_usecs) + { +- if (!ena_dev->intr_delay_resolution) { +- pr_err("Illegal interrupt delay granularity value\n"); +- return -EFAULT; +- } +- +- ena_dev->intr_moder_rx_interval = rx_coalesce_usecs / +- ena_dev->intr_delay_resolution; +- +- return 0; ++ return ena_com_update_nonadaptive_moderation_interval(rx_coalesce_usecs, ++ ena_dev->intr_delay_resolution, ++ &ena_dev->intr_moder_rx_interval); + } + + void ena_com_destroy_interrupt_moderation(struct ena_com_dev *ena_dev) diff --git a/debian/patches/features/all/ena/net-ena-remove-ena_restore_ethtool_params-and-releva.patch b/debian/patches/features/all/ena/net-ena-remove-ena_restore_ethtool_params-and-releva.patch new file mode 100644 index 000000000..1dad10a1a --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-remove-ena_restore_ethtool_params-and-releva.patch @@ -0,0 +1,59 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:32 +0300 +Subject: [PATCH] net: ena: remove ena_restore_ethtool_params() and relevant + fields +Origin: https://git.kernel.org/linus/64d1fb9dfc6c5d8589312fa847fee14ec14ee12b +Bug-Debian: https://bugs.debian.org/941291 + +Deleted unused 4 fields from struct ena_adapter and their only user +ena_restore_ethtool_params(). + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 10 ---------- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 3 --- + 2 files changed, 13 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -1564,14 +1564,6 @@ static void ena_napi_enable_all(struct e + napi_enable(&adapter->ena_napi[i].napi); + } + +-static void ena_restore_ethtool_params(struct ena_adapter *adapter) +-{ +- adapter->tx_usecs = 0; +- adapter->rx_usecs = 0; +- adapter->tx_frames = 1; +- adapter->rx_frames = 1; +-} +- + /* Configure the Rx forwarding */ + static int ena_rss_configure(struct ena_adapter *adapter) + { +@@ -1621,8 +1613,6 @@ static int ena_up_complete(struct ena_ad + /* enable transmits */ + netif_tx_start_all_queues(adapter->netdev); + +- ena_restore_ethtool_params(adapter); +- + ena_napi_enable_all(adapter); + + return 0; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -330,9 +330,6 @@ struct ena_adapter { + + u32 missing_tx_completion_threshold; + +- u32 tx_usecs, rx_usecs; /* interrupt moderation */ +- u32 tx_frames, rx_frames; /* interrupt moderation */ +- + u32 requested_tx_ring_size; + u32 requested_rx_ring_size; + diff --git a/debian/patches/features/all/ena/net-ena-remove-inline-keyword-from-functions-in-.c.patch b/debian/patches/features/all/ena/net-ena-remove-inline-keyword-from-functions-in-.c.patch new file mode 100644 index 000000000..8d4a2b349 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-remove-inline-keyword-from-functions-in-.c.patch @@ -0,0 +1,244 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:10 +0300 +Subject: [PATCH] net: ena: remove inline keyword from functions in *.c +Origin: https://git.kernel.org/linus/c2b542044761965db0e4cc400ab6abf670fc25b7 +Bug-Debian: https://bugs.debian.org/941291 + +Let the compiler decide if the function should be inline in *.c files + +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 6 ++--- + drivers/net/ethernet/amazon/ena/ena_eth_com.c | 26 +++++++++---------- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 16 ++++++------ + 3 files changed, 24 insertions(+), 24 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -91,7 +91,7 @@ struct ena_com_stats_ctx { + struct ena_admin_acq_get_stats_resp get_resp; + }; + +-static inline int ena_com_mem_addr_set(struct ena_com_dev *ena_dev, ++static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev, + struct ena_common_mem_addr *ena_addr, + dma_addr_t addr) + { +@@ -190,7 +190,7 @@ static int ena_com_admin_init_aenq(struc + return 0; + } + +-static inline void comp_ctxt_release(struct ena_com_admin_queue *queue, ++static void comp_ctxt_release(struct ena_com_admin_queue *queue, + struct ena_comp_ctx *comp_ctx) + { + comp_ctx->occupied = false; +@@ -277,7 +277,7 @@ static struct ena_comp_ctx *__ena_com_su + return comp_ctx; + } + +-static inline int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue) ++static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue) + { + size_t size = queue->q_depth * sizeof(struct ena_comp_ctx); + struct ena_comp_ctx *comp_ctx; +Index: linux/drivers/net/ethernet/amazon/ena/ena_eth_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_eth_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_eth_com.c +@@ -32,7 +32,7 @@ + + #include "ena_eth_com.h" + +-static inline struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc( ++static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc( + struct ena_com_io_cq *io_cq) + { + struct ena_eth_io_rx_cdesc_base *cdesc; +@@ -59,7 +59,7 @@ static inline struct ena_eth_io_rx_cdesc + return cdesc; + } + +-static inline void *get_sq_desc_regular_queue(struct ena_com_io_sq *io_sq) ++static void *get_sq_desc_regular_queue(struct ena_com_io_sq *io_sq) + { + u16 tail_masked; + u32 offset; +@@ -71,7 +71,7 @@ static inline void *get_sq_desc_regular_ + return (void *)((uintptr_t)io_sq->desc_addr.virt_addr + offset); + } + +-static inline int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq, ++static int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq, + u8 *bounce_buffer) + { + struct ena_com_llq_info *llq_info = &io_sq->llq_info; +@@ -111,7 +111,7 @@ static inline int ena_com_write_bounce_b + return 0; + } + +-static inline int ena_com_write_header_to_bounce(struct ena_com_io_sq *io_sq, ++static int ena_com_write_header_to_bounce(struct ena_com_io_sq *io_sq, + u8 *header_src, + u16 header_len) + { +@@ -142,7 +142,7 @@ static inline int ena_com_write_header_t + return 0; + } + +-static inline void *get_sq_desc_llq(struct ena_com_io_sq *io_sq) ++static void *get_sq_desc_llq(struct ena_com_io_sq *io_sq) + { + struct ena_com_llq_pkt_ctrl *pkt_ctrl = &io_sq->llq_buf_ctrl; + u8 *bounce_buffer; +@@ -162,7 +162,7 @@ static inline void *get_sq_desc_llq(stru + return sq_desc; + } + +-static inline int ena_com_close_bounce_buffer(struct ena_com_io_sq *io_sq) ++static int ena_com_close_bounce_buffer(struct ena_com_io_sq *io_sq) + { + struct ena_com_llq_pkt_ctrl *pkt_ctrl = &io_sq->llq_buf_ctrl; + struct ena_com_llq_info *llq_info = &io_sq->llq_info; +@@ -189,7 +189,7 @@ static inline int ena_com_close_bounce_b + return 0; + } + +-static inline void *get_sq_desc(struct ena_com_io_sq *io_sq) ++static void *get_sq_desc(struct ena_com_io_sq *io_sq) + { + if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) + return get_sq_desc_llq(io_sq); +@@ -197,7 +197,7 @@ static inline void *get_sq_desc(struct e + return get_sq_desc_regular_queue(io_sq); + } + +-static inline int ena_com_sq_update_llq_tail(struct ena_com_io_sq *io_sq) ++static int ena_com_sq_update_llq_tail(struct ena_com_io_sq *io_sq) + { + struct ena_com_llq_pkt_ctrl *pkt_ctrl = &io_sq->llq_buf_ctrl; + struct ena_com_llq_info *llq_info = &io_sq->llq_info; +@@ -225,7 +225,7 @@ static inline int ena_com_sq_update_llq_ + return 0; + } + +-static inline int ena_com_sq_update_tail(struct ena_com_io_sq *io_sq) ++static int ena_com_sq_update_tail(struct ena_com_io_sq *io_sq) + { + if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) + return ena_com_sq_update_llq_tail(io_sq); +@@ -239,7 +239,7 @@ static inline int ena_com_sq_update_tail + return 0; + } + +-static inline struct ena_eth_io_rx_cdesc_base * ++static struct ena_eth_io_rx_cdesc_base * + ena_com_rx_cdesc_idx_to_ptr(struct ena_com_io_cq *io_cq, u16 idx) + { + idx &= (io_cq->q_depth - 1); +@@ -248,7 +248,7 @@ static inline struct ena_eth_io_rx_cdesc + idx * io_cq->cdesc_entry_size_in_bytes); + } + +-static inline u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq, ++static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq, + u16 *first_cdesc_idx) + { + struct ena_eth_io_rx_cdesc_base *cdesc; +@@ -285,7 +285,7 @@ static inline u16 ena_com_cdesc_rx_pkt_g + return count; + } + +-static inline int ena_com_create_and_store_tx_meta_desc(struct ena_com_io_sq *io_sq, ++static int ena_com_create_and_store_tx_meta_desc(struct ena_com_io_sq *io_sq, + struct ena_com_tx_ctx *ena_tx_ctx) + { + struct ena_eth_io_tx_meta_desc *meta_desc = NULL; +@@ -334,7 +334,7 @@ static inline int ena_com_create_and_sto + return ena_com_sq_update_tail(io_sq); + } + +-static inline void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx, ++static void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx, + struct ena_eth_io_rx_cdesc_base *cdesc) + { + ena_rx_ctx->l3_proto = cdesc->status & +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -326,7 +326,7 @@ static void ena_free_all_io_tx_resources + ena_free_tx_resources(adapter, i); + } + +-static inline int validate_rx_req_id(struct ena_ring *rx_ring, u16 req_id) ++static int validate_rx_req_id(struct ena_ring *rx_ring, u16 req_id) + { + if (likely(req_id < rx_ring->ring_size)) + return 0; +@@ -460,7 +460,7 @@ static void ena_free_all_io_rx_resources + ena_free_rx_resources(adapter, i); + } + +-static inline int ena_alloc_rx_page(struct ena_ring *rx_ring, ++static int ena_alloc_rx_page(struct ena_ring *rx_ring, + struct ena_rx_buffer *rx_info, gfp_t gfp) + { + struct ena_com_buf *ena_buf; +@@ -620,7 +620,7 @@ static void ena_free_all_rx_bufs(struct + ena_free_rx_bufs(adapter, i); + } + +-static inline void ena_unmap_tx_skb(struct ena_ring *tx_ring, ++static void ena_unmap_tx_skb(struct ena_ring *tx_ring, + struct ena_tx_buffer *tx_info) + { + struct ena_com_buf *ena_buf; +@@ -956,7 +956,7 @@ static struct sk_buff *ena_rx_skb(struct + * @ena_rx_ctx: received packet context/metadata + * @skb: skb currently being received and modified + */ +-static inline void ena_rx_checksum(struct ena_ring *rx_ring, ++static void ena_rx_checksum(struct ena_ring *rx_ring, + struct ena_com_rx_ctx *ena_rx_ctx, + struct sk_buff *skb) + { +@@ -1156,7 +1156,7 @@ error: + return 0; + } + +-inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, ++void ena_adjust_intr_moderation(struct ena_ring *rx_ring, + struct ena_ring *tx_ring) + { + /* We apply adaptive moderation on Rx path only. +@@ -1175,7 +1175,7 @@ inline void ena_adjust_intr_moderation(s + rx_ring->per_napi_bytes = 0; + } + +-static inline void ena_unmask_interrupt(struct ena_ring *tx_ring, ++static void ena_unmask_interrupt(struct ena_ring *tx_ring, + struct ena_ring *rx_ring) + { + struct ena_eth_io_intr_reg intr_reg; +@@ -1195,7 +1195,7 @@ static inline void ena_unmask_interrupt( + ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg); + } + +-static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring, ++static void ena_update_ring_numa_node(struct ena_ring *tx_ring, + struct ena_ring *rx_ring) + { + int cpu = get_cpu(); +@@ -3331,7 +3331,7 @@ static void ena_release_bars(struct ena_ + pci_release_selected_regions(pdev, release_bars); + } + +-static inline void set_default_llq_configurations(struct ena_llq_configurations *llq_config) ++static void set_default_llq_configurations(struct ena_llq_configurations *llq_config) + { + llq_config->llq_header_location = ENA_ADMIN_INLINE_HEADER; + llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_128B; diff --git a/debian/patches/features/all/ena/net-ena-remove-old-adaptive-interrupt-moderation-cod.patch b/debian/patches/features/all/ena/net-ena-remove-old-adaptive-interrupt-moderation-cod.patch new file mode 100644 index 000000000..17cb06e09 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-remove-old-adaptive-interrupt-moderation-cod.patch @@ -0,0 +1,83 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:31 +0300 +Subject: [PATCH] net: ena: remove old adaptive interrupt moderation code from + ena_netdev +Origin: https://git.kernel.org/linus/242d81fd3dd9f301b0c20564aafec8efdb2bbe5b +Bug-Debian: https://bugs.debian.org/941291 + +1. Out of the fields {per_napi_bytes, per_napi_packets} in struct ena_ring, + only rx_ring->per_napi_packets are used to determine if napi did work + for dim. + This commit removes all other uses of these fields. +2. Remove ena_ring->moder_tbl_idx, which is not used by dim. +3. Remove all calls to ena_com_destroy_interrupt_moderation(), since all it + did was to destroy the interrupt moderation table, which is removed as + part of removing old interrupt moderation code. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 -------- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 2 -- + 2 files changed, 10 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -158,7 +158,6 @@ static void ena_init_io_rings_common(str + ring->adapter = adapter; + ring->ena_dev = adapter->ena_dev; + ring->per_napi_packets = 0; +- ring->per_napi_bytes = 0; + ring->cpu = 0; + ring->first_interrupt = false; + ring->no_interrupt_event_cnt = 0; +@@ -835,9 +834,6 @@ static int ena_clean_tx_irq(struct ena_r + __netif_tx_unlock(txq); + } + +- tx_ring->per_napi_bytes += tx_bytes; +- tx_ring->per_napi_packets += tx_pkts; +- + return tx_pkts; + } + +@@ -1121,7 +1117,6 @@ static int ena_clean_rx_irq(struct ena_r + } while (likely(res_budget)); + + work_done = budget - res_budget; +- rx_ring->per_napi_bytes += total_len; + rx_ring->per_napi_packets += work_done; + u64_stats_update_begin(&rx_ring->syncp); + rx_ring->rx_stats.bytes += total_len; +@@ -3643,7 +3638,6 @@ err_free_msix: + ena_free_mgmnt_irq(adapter); + ena_disable_msix(adapter); + err_worker_destroy: +- ena_com_destroy_interrupt_moderation(ena_dev); + del_timer(&adapter->timer_service); + err_netdev_destroy: + free_netdev(netdev); +@@ -3704,8 +3698,6 @@ static void ena_remove(struct pci_dev *p + + pci_disable_device(pdev); + +- ena_com_destroy_interrupt_moderation(ena_dev); +- + vfree(ena_dev); + } + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -280,8 +280,6 @@ struct ena_ring { + struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS]; + u32 smoothed_interval; + u32 per_napi_packets; +- u32 per_napi_bytes; +- enum ena_intr_moder_level moder_tbl_idx; + u16 non_empty_napi_events; + struct u64_stats_sync syncp; + union { diff --git a/debian/patches/features/all/ena/net-ena-replace-free_tx-rx_ids-union-with-single-fre.patch b/debian/patches/features/all/ena/net-ena-replace-free_tx-rx_ids-union-with-single-fre.patch new file mode 100644 index 000000000..c63ce87c6 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-replace-free_tx-rx_ids-union-with-single-fre.patch @@ -0,0 +1,198 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:21 +0300 +Subject: [PATCH] net: ena: replace free_tx/rx_ids union with single free_ids + field in ena_ring +Origin: https://git.kernel.org/linus/f917249833c7a00ea8be39b1bcb3ec8ef3aea45f +Bug-Debian: https://bugs.debian.org/941291 + +struct ena_ring holds a union of free_rx_ids and free_tx_ids. +Both of the above fields mean the exact same thing and are used +exactly the same way. +Furthermore, these fields are always used with a prefix of the +type of ring. So for tx it will be tx_ring->free_tx_ids, and for +rx it will be rx_ring->free_rx_ids, which shows how redundant the +"_tx" and "_rx" parts are. +Furthermore still, this may lead to confusing code like where +tx_ring->free_rx_ids which works correctly but looks like a mess. + +This commit removes the aforementioned redundancy by replacing the +free_rx/tx_ids union with a single free_ids field. +It also changes a single goto label name from err_free_tx_ids: to +err_tx_free_ids: for consistency with the above new notation. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 48 ++++++++++---------- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 11 ++--- + 2 files changed, 28 insertions(+), 31 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c +index 33fab4f41d7c..b80b5eddca91 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -228,11 +228,11 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) + } + + size = sizeof(u16) * tx_ring->ring_size; +- tx_ring->free_tx_ids = vzalloc_node(size, node); +- if (!tx_ring->free_tx_ids) { +- tx_ring->free_tx_ids = vzalloc(size); +- if (!tx_ring->free_tx_ids) +- goto err_free_tx_ids; ++ tx_ring->free_ids = vzalloc_node(size, node); ++ if (!tx_ring->free_ids) { ++ tx_ring->free_ids = vzalloc(size); ++ if (!tx_ring->free_ids) ++ goto err_tx_free_ids; + } + + size = tx_ring->tx_max_header_size; +@@ -245,7 +245,7 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) + + /* Req id ring for TX out of order completions */ + for (i = 0; i < tx_ring->ring_size; i++) +- tx_ring->free_tx_ids[i] = i; ++ tx_ring->free_ids[i] = i; + + /* Reset tx statistics */ + memset(&tx_ring->tx_stats, 0x0, sizeof(tx_ring->tx_stats)); +@@ -256,9 +256,9 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) + return 0; + + err_push_buf_intermediate_buf: +- vfree(tx_ring->free_tx_ids); +- tx_ring->free_tx_ids = NULL; +-err_free_tx_ids: ++ vfree(tx_ring->free_ids); ++ tx_ring->free_ids = NULL; ++err_tx_free_ids: + vfree(tx_ring->tx_buffer_info); + tx_ring->tx_buffer_info = NULL; + err_tx_buffer_info: +@@ -278,8 +278,8 @@ static void ena_free_tx_resources(struct ena_adapter *adapter, int qid) + vfree(tx_ring->tx_buffer_info); + tx_ring->tx_buffer_info = NULL; + +- vfree(tx_ring->free_tx_ids); +- tx_ring->free_tx_ids = NULL; ++ vfree(tx_ring->free_ids); ++ tx_ring->free_ids = NULL; + + vfree(tx_ring->push_buf_intermediate_buf); + tx_ring->push_buf_intermediate_buf = NULL; +@@ -377,10 +377,10 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter, + } + + size = sizeof(u16) * rx_ring->ring_size; +- rx_ring->free_rx_ids = vzalloc_node(size, node); +- if (!rx_ring->free_rx_ids) { +- rx_ring->free_rx_ids = vzalloc(size); +- if (!rx_ring->free_rx_ids) { ++ rx_ring->free_ids = vzalloc_node(size, node); ++ if (!rx_ring->free_ids) { ++ rx_ring->free_ids = vzalloc(size); ++ if (!rx_ring->free_ids) { + vfree(rx_ring->rx_buffer_info); + rx_ring->rx_buffer_info = NULL; + return -ENOMEM; +@@ -389,7 +389,7 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter, + + /* Req id ring for receiving RX pkts out of order */ + for (i = 0; i < rx_ring->ring_size; i++) +- rx_ring->free_rx_ids[i] = i; ++ rx_ring->free_ids[i] = i; + + /* Reset rx statistics */ + memset(&rx_ring->rx_stats, 0x0, sizeof(rx_ring->rx_stats)); +@@ -415,8 +415,8 @@ static void ena_free_rx_resources(struct ena_adapter *adapter, + vfree(rx_ring->rx_buffer_info); + rx_ring->rx_buffer_info = NULL; + +- vfree(rx_ring->free_rx_ids); +- rx_ring->free_rx_ids = NULL; ++ vfree(rx_ring->free_ids); ++ rx_ring->free_ids = NULL; + } + + /* ena_setup_all_rx_resources - allocate I/O Rx queues resources for all queues +@@ -531,7 +531,7 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num) + for (i = 0; i < num; i++) { + struct ena_rx_buffer *rx_info; + +- req_id = rx_ring->free_rx_ids[next_to_use]; ++ req_id = rx_ring->free_ids[next_to_use]; + rc = validate_rx_req_id(rx_ring, req_id); + if (unlikely(rc < 0)) + break; +@@ -797,7 +797,7 @@ static int ena_clean_tx_irq(struct ena_ring *tx_ring, u32 budget) + tx_pkts++; + total_done += tx_info->tx_descs; + +- tx_ring->free_tx_ids[next_to_clean] = req_id; ++ tx_ring->free_ids[next_to_clean] = req_id; + next_to_clean = ENA_TX_RING_IDX_NEXT(next_to_clean, + tx_ring->ring_size); + } +@@ -911,7 +911,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring, + + skb_put(skb, len); + skb->protocol = eth_type_trans(skb, rx_ring->netdev); +- rx_ring->free_rx_ids[*next_to_clean] = req_id; ++ rx_ring->free_ids[*next_to_clean] = req_id; + *next_to_clean = ENA_RX_RING_IDX_ADD(*next_to_clean, descs, + rx_ring->ring_size); + return skb; +@@ -935,7 +935,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring, + + rx_info->page = NULL; + +- rx_ring->free_rx_ids[*next_to_clean] = req_id; ++ rx_ring->free_ids[*next_to_clean] = req_id; + *next_to_clean = + ENA_RX_RING_IDX_NEXT(*next_to_clean, + rx_ring->ring_size); +@@ -1088,7 +1088,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi, + /* exit if we failed to retrieve a buffer */ + if (unlikely(!skb)) { + for (i = 0; i < ena_rx_ctx.descs; i++) { +- rx_ring->free_tx_ids[next_to_clean] = ++ rx_ring->free_ids[next_to_clean] = + rx_ring->ena_bufs[i].req_id; + next_to_clean = + ENA_RX_RING_IDX_NEXT(next_to_clean, +@@ -2152,7 +2152,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) + skb_tx_timestamp(skb); + + next_to_use = tx_ring->next_to_use; +- req_id = tx_ring->free_tx_ids[next_to_use]; ++ req_id = tx_ring->free_ids[next_to_use]; + tx_info = &tx_ring->tx_buffer_info[req_id]; + tx_info->num_of_bufs = 0; + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h +index 0681e18b0019..74c316081499 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -221,13 +221,10 @@ struct ena_stats_rx { + }; + + struct ena_ring { +- union { +- /* Holds the empty requests for TX/RX +- * out of order completions +- */ +- u16 *free_tx_ids; +- u16 *free_rx_ids; +- }; ++ /* Holds the empty requests for TX/RX ++ * out of order completions ++ */ ++ u16 *free_ids; + + union { + struct ena_tx_buffer *tx_buffer_info; +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-switch-to-dim-algorithm-for-rx-adaptive-inte.patch b/debian/patches/features/all/ena/net-ena-switch-to-dim-algorithm-for-rx-adaptive-inte.patch new file mode 100644 index 000000000..eb5269408 --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-switch-to-dim-algorithm-for-rx-adaptive-inte.patch @@ -0,0 +1,163 @@ +From: Arthur Kiyanovski +Date: Mon, 16 Sep 2019 14:31:27 +0300 +Subject: [PATCH] net: ena: switch to dim algorithm for rx adaptive interrupt + moderation +Origin: https://git.kernel.org/linus/282faf61a053be43910fcc42d86ecf16c0d30123 +Bug-Debian: https://bugs.debian.org/941291 + +Use the dim library for the rx adaptive interrupt moderation implementation + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 4 +- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 55 +++++++++++++------- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 3 ++ + 3 files changed, 41 insertions(+), 21 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_com.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_com.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2839,9 +2839,7 @@ int ena_com_init_interrupt_moderation(st + delay_resolution = get_resp.u.intr_moderation.intr_delay_resolution; + ena_com_update_intr_delay_resolution(ena_dev, delay_resolution); + +- /* Disable adaptive moderation by default - can be enabled from +- * ethtool +- */ ++ /* Disable adaptive moderation by default - can be enabled later */ + ena_com_disable_adaptive_moderation(ena_dev); + + return 0; +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -196,6 +196,7 @@ static void ena_init_io_rings(struct ena + rxr->smoothed_interval = + ena_com_get_nonadaptive_moderation_interval_rx(ena_dev); + rxr->empty_rx_queue = 0; ++ adapter->ena_napi[i].dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE; + } + } + +@@ -712,6 +713,7 @@ static void ena_destroy_all_rx_queues(st + + for (i = 0; i < adapter->num_queues; i++) { + ena_qid = ENA_IO_RXQ_IDX(i); ++ cancel_work_sync(&adapter->ena_napi[i].dim.work); + ena_com_destroy_io_queue(adapter->ena_dev, ena_qid); + } + } +@@ -1156,23 +1158,35 @@ error: + return 0; + } + +-void ena_adjust_intr_moderation(struct ena_ring *rx_ring, +- struct ena_ring *tx_ring) ++static void ena_dim_work(struct work_struct *w) + { +- /* We apply adaptive moderation on Rx path only. +- * Tx uses static interrupt moderation. +- */ +- ena_com_calculate_interrupt_delay(rx_ring->ena_dev, +- rx_ring->per_napi_packets, +- rx_ring->per_napi_bytes, +- &rx_ring->smoothed_interval, +- &rx_ring->moder_tbl_idx); +- +- /* Reset per napi packets/bytes */ +- tx_ring->per_napi_packets = 0; +- tx_ring->per_napi_bytes = 0; ++ struct net_dim *dim = container_of(w, struct net_dim, work); ++ struct net_dim_cq_moder cur_moder = ++ net_dim_get_rx_moderation(dim->mode, dim->profile_ix); ++ struct ena_napi *ena_napi = container_of(dim, struct ena_napi, dim); ++ ++ ena_napi->rx_ring->smoothed_interval = cur_moder.usec; ++ dim->state = NET_DIM_START_MEASURE; ++} ++ ++static void ena_adjust_adaptive_rx_intr_moderation(struct ena_napi *ena_napi) ++{ ++ struct net_dim_sample dim_sample; ++ struct ena_ring *rx_ring = ena_napi->rx_ring; ++ ++ if (!rx_ring->per_napi_packets) ++ return; ++ ++ rx_ring->non_empty_napi_events++; ++ ++ net_dim_sample(rx_ring->non_empty_napi_events, ++ rx_ring->rx_stats.cnt, ++ rx_ring->rx_stats.bytes, ++ &dim_sample); ++ ++ net_dim(&ena_napi->dim, dim_sample); ++ + rx_ring->per_napi_packets = 0; +- rx_ring->per_napi_bytes = 0; + } + + static void ena_unmask_interrupt(struct ena_ring *tx_ring, +@@ -1261,9 +1275,11 @@ static int ena_io_poll(struct napi_struc + * from the interrupt context (vs from sk_busy_loop) + */ + if (napi_complete_done(napi, rx_work_done)) { +- /* Tx and Rx share the same interrupt vector */ ++ /* We apply adaptive moderation on Rx path only. ++ * Tx uses static interrupt moderation. ++ */ + if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev)) +- ena_adjust_intr_moderation(rx_ring, tx_ring); ++ ena_adjust_adaptive_rx_intr_moderation(ena_napi); + + ena_unmask_interrupt(tx_ring, rx_ring); + } +@@ -1741,13 +1757,16 @@ static int ena_create_all_io_rx_queues(s + rc = ena_create_io_rx_queue(adapter, i); + if (rc) + goto create_err; ++ INIT_WORK(&adapter->ena_napi[i].dim.work, ena_dim_work); + } + + return 0; + + create_err: +- while (i--) ++ while (i--) { ++ cancel_work_sync(&adapter->ena_napi[i].dim.work); + ena_com_destroy_io_queue(ena_dev, ENA_IO_RXQ_IDX(i)); ++ } + + return rc; + } +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -34,6 +34,7 @@ + #define ENA_H + + #include ++#include + #include + #include + #include +@@ -153,6 +154,7 @@ struct ena_napi { + struct ena_ring *tx_ring; + struct ena_ring *rx_ring; + u32 qid; ++ struct net_dim dim; + }; + + struct ena_calc_queue_size_ctx { +@@ -280,6 +282,7 @@ struct ena_ring { + u32 per_napi_packets; + u32 per_napi_bytes; + enum ena_intr_moder_level moder_tbl_idx; ++ u16 non_empty_napi_events; + struct u64_stats_sync syncp; + union { + struct ena_stats_tx tx_stats; diff --git a/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.2-to-2.0.3.patch b/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.2-to-2.0.3.patch new file mode 100644 index 000000000..7b3fd73ce --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.2-to-2.0.3.patch @@ -0,0 +1,27 @@ +From: Arthur Kiyanovski +Date: Mon, 11 Feb 2019 19:17:44 +0200 +Subject: [PATCH] net: ena: update driver version from 2.0.2 to 2.0.3 +Origin: https://git.kernel.org/linus/d9b8656da92223eb004b4f4db74fe48e7433f7b2 +Bug-Debian: https://bugs.debian.org/941291 + +Update driver version due to bug fix. + +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -45,7 +45,7 @@ + + #define DRV_MODULE_VER_MAJOR 2 + #define DRV_MODULE_VER_MINOR 0 +-#define DRV_MODULE_VER_SUBMINOR 2 ++#define DRV_MODULE_VER_SUBMINOR 3 + + #define DRV_MODULE_NAME "ena" + #ifndef DRV_MODULE_VERSION diff --git a/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.3-to-2.1.0.patch b/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.3-to-2.1.0.patch new file mode 100644 index 000000000..9a62b79ac --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-update-driver-version-from-2.0.3-to-2.1.0.patch @@ -0,0 +1,32 @@ +From: Sameeh Jubran +Date: Tue, 11 Jun 2019 14:58:11 +0300 +Subject: [PATCH] net: ena: update driver version from 2.0.3 to 2.1.0 +Origin: https://git.kernel.org/linus/dbbc6e6877768a03092751edf89d012d561b4553 +Bug-Debian: https://bugs.debian.org/941291 + +Update driver version to match device specification. + +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h +index b9d590879815..f2b6e2e0504d 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -44,8 +44,8 @@ + #include "ena_eth_com.h" + + #define DRV_MODULE_VER_MAJOR 2 +-#define DRV_MODULE_VER_MINOR 0 +-#define DRV_MODULE_VER_SUBMINOR 3 ++#define DRV_MODULE_VER_MINOR 1 ++#define DRV_MODULE_VER_SUBMINOR 0 + + #define DRV_MODULE_NAME "ena" + #ifndef DRV_MODULE_VERSION +-- +2.17.1 + diff --git a/debian/patches/features/all/ena/net-ena-use-dev_info_once-instead-of-static-variable.patch b/debian/patches/features/all/ena/net-ena-use-dev_info_once-instead-of-static-variable.patch new file mode 100644 index 000000000..8b3a55e8d --- /dev/null +++ b/debian/patches/features/all/ena/net-ena-use-dev_info_once-instead-of-static-variable.patch @@ -0,0 +1,34 @@ +From: Sameeh Jubran +Date: Mon, 3 Jun 2019 17:43:29 +0300 +Subject: [PATCH] net: ena: use dev_info_once instead of static variable +Origin: https://git.kernel.org/linus/1e9c3fbad83a70e0b00806df3f4dd2db0bc04cc4 +Bug-Debian: https://bugs.debian.org/941291 + +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +Index: linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +=================================================================== +--- linux.orig/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ linux/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3277,7 +3277,6 @@ static int ena_probe(struct pci_dev *pde + struct ena_llq_configurations llq_config; + struct ena_com_dev *ena_dev = NULL; + struct ena_adapter *adapter; +- static int version_printed; + int io_queue_num, bars, rc; + struct net_device *netdev; + static int adapters_found; +@@ -3289,8 +3288,7 @@ static int ena_probe(struct pci_dev *pde + + dev_dbg(&pdev->dev, "%s\n", __func__); + +- if (version_printed++ == 0) +- dev_info(&pdev->dev, "%s", version); ++ dev_info_once(&pdev->dev, "%s", version); + + rc = pci_enable_device_mem(pdev); + if (rc) { diff --git a/debian/patches/series b/debian/patches/series index e6dd1c3ae..27b16c88b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -220,6 +220,44 @@ features/all/ena/0016-net-ena-fix-compilation-error-in-xtensa-architecture.patch features/all/ena/0017-net-ena-fix-crash-during-ena_remove.patch features/all/ena/0018-net-ena-update-driver-version-from-2.0.1-to-2.0.2.patch +features/all/ena/net-ena-update-driver-version-from-2.0.2-to-2.0.3.patch +features/all/ena/net-ena-fix-set-freed-objects-to-NULL-to-avoid-faili.patch +features/all/ena/net-ena-fix-Free-napi-resources-when-ena_up-fails.patch +features/all/ena/net-ena-fix-incorrect-test-of-supported-hash-functio.patch +features/all/ena/net-ena-fix-return-value-of-ena_com_config_llq_info.patch +features/all/ena/net-ena-improve-latency-by-disabling-adaptive-interr.patch +features/all/ena/net-ena-fix-ena_com_fill_hash_function-implementatio.patch +features/all/ena/net-ena-add-handling-of-llq-max-tx-burst-size.patch +features/all/ena/net-ena-replace-free_tx-rx_ids-union-with-single-fre.patch +features/all/ena/net-ena-arrange-ena_probe-function-variables-in-reve.patch +features/all/ena/net-ena-add-newline-at-the-end-of-pr_err-prints.patch +features/all/ena/net-ena-allow-automatic-fallback-to-polling-mode.patch +features/all/ena/net-ena-add-support-for-changing-max_header_size-in-.patch +features/all/ena/net-ena-optimise-calculations-for-CQ-doorbell.patch +features/all/ena/net-ena-use-dev_info_once-instead-of-static-variable.patch +features/all/ena/net-ena-add-MAX_QUEUES_EXT-get-feature-admin-command.patch +features/all/ena/net-ena-enable-negotiating-larger-Rx-ring-size.patch +features/all/ena/net-ena-make-ethtool-show-correct-current-and-max-qu.patch +features/all/ena/net-ena-allow-queue-allocation-backoff-when-low-on-m.patch +features/all/ena/net-ena-add-ethtool-function-for-changing-io-queue-s.patch +features/all/ena/net-ena-update-driver-version-from-2.0.3-to-2.1.0.patch +features/all/ena/net-ena-Fix-bug-where-ring-allocation-backoff-stoppe.patch +features/all/ena/net-ena-don-t-wake-up-tx-queue-when-down.patch +features/all/ena/net-ena-add-good-checksum-counter.patch +features/all/ena/net-ena-fix-swapped-parameters-when-calling-ena_com_.patch +features/all/ena/net-ena-add-intr_moder_rx_interval-to-struct-ena_com.patch +features/all/ena/net-ena-remove-inline-keyword-from-functions-in-.c.patch +features/all/ena/net-ena-switch-to-dim-algorithm-for-rx-adaptive-inte.patch +features/all/ena/net-ena-reimplement-set-get_coalesce.patch +features/all/ena/net-ena-enable-the-interrupt_moderation-in-driver_su.patch +features/all/ena/net-ena-remove-code-duplication-in-ena_com_update_no.patch +features/all/ena/net-ena-remove-old-adaptive-interrupt-moderation-cod.patch +features/all/ena/net-ena-remove-ena_restore_ethtool_params-and-releva.patch +features/all/ena/net-ena-remove-all-old-adaptive-rx-interrupt-moderat.patch +features/all/ena/net-ena-fix-update-of-interrupt-moderation-register.patch +features/all/ena/net-ena-fix-retrieval-of-nonadaptive-interrupt-moder.patch +features/all/ena/net-ena-fix-incorrect-update-of-intr_delay_resolutio.patch + # Backported bugfixes from 4.20/4.21 for the Huawei TaiShan server platform (aka D06) bugfix/arm64/huawei-taishan/0001-scsi-hisi_sas-Feed-back-linkrate-max-min-when-re-att.patch bugfix/arm64/huawei-taishan/0002-scsi-hisi_sas-Move-evaluation-of-hisi_hba-in-hisi_sa.patch