~kamalmostafa/ubuntu/+source/linux/+git/bionic:ena-update-dim

Last commit made on 2019-11-19
Get this branch:
git clone -b ena-update-dim https://git.launchpad.net/~kamalmostafa/ubuntu/+source/linux/+git/bionic
Only Kamal Mostafa can upload to this branch. If you are Kamal Mostafa please log in for upload directions.

Branch merges

Branch information

Name:
ena-update-dim
Repository:
lp:~kamalmostafa/ubuntu/+source/linux/+git/bionic

Recent commits

d3e7bed... by Arthur Kiyanovski

UBUNTU: SAUCE: net: ena: fix too long default tx interrupt moderation interval

BugLink: https://bugs.launchpad.net/bugs/1853180

Current default non-adaptive tx interrupt moderation interval is 196 us.
This commit sets it to 0, which is much more sensible as a default value.
It can be modified using ethtool -C.

Signed-off-by: Arthur Kiyanovski <email address hidden>
Reference: https://<email address hidden>/
Signed-off-by: Kamal Mostafa <email address hidden>

ebf548a... by Arthur Kiyanovski

UBUNTU: SAUCE: net: ena: fix issues in setting interrupt moderation params in ethtool

BugLink: https://bugs.launchpad.net/bugs/1853180

Issue 1:
--------
Reproduction steps:
1. sudo ethtool -C eth0 rx-usecs 128
2. sudo ethtool -C eth0 adaptive-rx on
3. sudo ethtool -C eth0 adaptive-rx off
4. ethtool -c eth0

expected output: rx-usecs 128
actual output: rx-usecs 0

Reason for issue:
In stage 3, ethtool userspace calls first the ena_get_coalesce() handler
to get the current value of all properties, and then the ena_set_coalesce()
handler. When ena_get_coalesce() is called the adaptive interrupt
moderation is still on. There is an if in the code that returns the
rx_coalesce_usecs only if the adaptive interrupt moderation is off.
And since it is still on, rx_coalesce_usecs is not set, meaning it
stays 0.

Solution to issue:
Remove this if static interrupt moderation intervals have nothing to do with
dynamic ones.

Issue 2:
--------
Reproduction steps:
1. sudo ethtool -C eth0 rx-usecs 128
2. sudo ethtool -C eth0 adaptive-rx on
3. sudo ethtool -C eth0 rx-usecs 128
4. ethtool -c eth0

expected output: rx-usecs 128
actual output: rx-usecs 0

Reason for issue:
In stage 3, when ena_set_coalesce() is called, the handler tests if
rx adaptive interrupt moderation is on, and if it is, it returns before
getting to the part in the function that sets the rx non-adaptive
interrupt moderation interval.

Solution to issue:
Remove the return from the function when rx adaptive interrupt moderation
is on.

Additional small fixes in this commit:
--------------------------------------
1. Remove 2 unnecessary comments.
2. Remove 4 unnecesary "{}" in single row if statements.
3. Reorder ena_set_coalesce() to make sense.
4. Change the names of ena_update_tx/rx_rings_intr_moderation()
   functions to ena_update_tx/rx_rings_nonadaptive_intr_moderation() for
   clarity.

Signed-off-by: Arthur Kiyanovski <email address hidden>
Reference: https://<email address hidden>/
Signed-off-by: Kamal Mostafa <email address hidden>

a30663e... by Mao Wenan <email address hidden>

net: ena: Select DIMLIB for ENA_ETHERNET

BugLink: https://bugs.launchpad.net/bugs/1853180

If CONFIG_ENA_ETHERNET=y and CONFIG_DIMLIB=n,
below erros can be found:
drivers/net/ethernet/amazon/ena/ena_netdev.o: In function `ena_dim_work':
ena_netdev.c:(.text+0x21cc): undefined reference to `net_dim_get_rx_moderation'
ena_netdev.c:(.text+0x21cc): relocation truncated to
fit: R_AARCH64_CALL26 against undefined symbol `net_dim_get_rx_moderation'
drivers/net/ethernet/amazon/ena/ena_netdev.o: In function `ena_io_poll':
ena_netdev.c:(.text+0x7bd4): undefined reference to `net_dim'
ena_netdev.c:(.text+0x7bd4): relocation truncated to fit:
R_AARCH64_CALL26 against undefined symbol `net_dim'

After commit 282faf61a053 ("net: ena: switch to dim algorithm for rx adaptive
interrupt moderation"), it introduces dim algorithm, which configured by CONFIG_DIMLIB.
So, this patch is to select DIMLIB for ENA_ETHERNET.

Fixes: 282faf61a053 ("net: ena: switch to dim algorithm for rx adaptive interrupt moderation")
Signed-off-by: Mao Wenan <email address hidden>
Signed-off-by: Jakub Kicinski <email address hidden>
(cherry picked from commit ff04cfbaa23644562f369eeca0b44ef66e185c9e)
Signed-off-by: Kamal Mostafa <email address hidden>

7835795... by Arthur Kiyanovski

net: ena: fix incorrect update of intr_delay_resolution

BugLink: https://bugs.launchpad.net/bugs/1853180

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 <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 79226cea4a5ebbd84a4eee1762526f664c7beb62)
Signed-off-by: Kamal Mostafa <email address hidden>

d5a3745... by Arthur Kiyanovski

net: ena: fix retrieval of nonadaptive interrupt moderation intervals

BugLink: https://bugs.launchpad.net/bugs/1853180

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 <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 0eda847953d8dfb4b713ea62420f66157e230e13)
Signed-off-by: Kamal Mostafa <email address hidden>

fe97fe5... by Arthur Kiyanovski

net: ena: fix update of interrupt moderation register

BugLink: https://bugs.launchpad.net/bugs/1853180

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 <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 7b8a28787e2ba671eaeb073e3b62fb4786338a09)
Signed-off-by: Kamal Mostafa <email address hidden>

b4a2bee... by Arthur Kiyanovski

net: ena: remove all old adaptive rx interrupt moderation code from ena_com

BugLink: https://bugs.launchpad.net/bugs/1853180

Remove previous implementation of adaptive rx interrupt moderation
from ena_com files.

Signed-off-by: Arthur Kiyanovski <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 3ced8cbdf7ddb3160ffa714a91040dd18f39a12c)
Signed-off-by: Kamal Mostafa <email address hidden>

60378d0... by Arthur Kiyanovski

net: ena: remove ena_restore_ethtool_params() and relevant fields

BugLink: https://bugs.launchpad.net/bugs/1853180

Deleted unused 4 fields from struct ena_adapter and their only user
ena_restore_ethtool_params().

Signed-off-by: Arthur Kiyanovski <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 64d1fb9dfc6c5d8589312fa847fee14ec14ee12b)
Signed-off-by: Kamal Mostafa <email address hidden>

8631e40... by Arthur Kiyanovski

net: ena: remove old adaptive interrupt moderation code from ena_netdev

BugLink: https://bugs.launchpad.net/bugs/1853180

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 <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 242d81fd3dd9f301b0c20564aafec8efdb2bbe5b)
Signed-off-by: Kamal Mostafa <email address hidden>

735282d... by Arthur Kiyanovski

net: ena: remove code duplication in ena_com_update_nonadaptive_moderation_interval _*()

BugLink: https://bugs.launchpad.net/bugs/1853180

Remove code duplication in:
ena_com_update_nonadaptive_moderation_interval_tx()
ena_com_update_nonadaptive_moderation_interval_rx()
functions.

Signed-off-by: Arthur Kiyanovski <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 57e3a5f24bb5bf265988e973a911845abcbf6a00)
Signed-off-by: Kamal Mostafa <email address hidden>