Skip to content

Commit

Permalink
linux/ena update ENA linux driver to version 2.1.4
Browse files Browse the repository at this point in the history
**New Features**
* Add support for the RX offset feature - where the device writes data
  with an offset from the beginning of an RX buffer.

Signed-off-by: Sameeh Jubran <[email protected]>
Signed-off-by: Arthur Kiyanovski <[email protected]>
  • Loading branch information
akiyano committed Dec 16, 2019
1 parent a67b46c commit 6e89da2
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 18 deletions.
5 changes: 4 additions & 1 deletion kernel/linux/common/ena_com/ena_admin_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,8 @@ struct ena_admin_host_info {

u16 reserved;

/* 1:0 : reserved
/* 0 : reserved
* 1 : rx_offset
* 2 : interrupt_moderation
* 31:3 : reserved
*/
Expand Down Expand Up @@ -1137,6 +1138,8 @@ struct ena_admin_ena_mmio_req_read_less_resp {
#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_RX_OFFSET_SHIFT 1
#define ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK BIT(1)
#define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT 2
#define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK BIT(2)

Expand Down
9 changes: 5 additions & 4 deletions kernel/linux/common/ena_com/ena_eth_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
struct ena_eth_io_rx_cdesc_base *cdesc = NULL;
u16 cdesc_idx = 0;
u16 nb_hw_desc;
u16 i;
u16 i = 0;

WARN(io_cq->direction != ENA_COM_IO_QUEUE_DIRECTION_RX, "wrong Q type");

Expand All @@ -540,13 +540,14 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
return -ENOSPC;
}

for (i = 0; i < nb_hw_desc; i++) {
cdesc = ena_com_rx_cdesc_idx_to_ptr(io_cq, cdesc_idx + i);
cdesc = ena_com_rx_cdesc_idx_to_ptr(io_cq, cdesc_idx);
ena_rx_ctx->pkt_offset = cdesc->offset;

do {
ena_buf->len = cdesc->length;
ena_buf->req_id = cdesc->req_id;
ena_buf++;
}
} while ((++i < nb_hw_desc) && (cdesc = ena_com_rx_cdesc_idx_to_ptr(io_cq, cdesc_idx + i)));

/* Update SQ head ptr */
io_sq->next_to_comp += nb_hw_desc;
Expand Down
1 change: 1 addition & 0 deletions kernel/linux/common/ena_com/ena_eth_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct ena_com_rx_ctx {
u32 hash;
u16 descs;
int max_bufs;
u8 pkt_offset;
};

int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
Expand Down
4 changes: 3 additions & 1 deletion kernel/linux/common/ena_com/ena_eth_io_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ struct ena_eth_io_rx_cdesc_base {

u16 sub_qid;

u16 reserved;
u8 offset;

u8 reserved;
};

/* 8-word format */
Expand Down
5 changes: 5 additions & 0 deletions kernel/linux/ena/RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ The driver was verified on the following distributions:
SUSE Linux Enterprise Server 12 SP2
SUSE Linux Enterprise Server 12 SP3

## r2.1.4 release notes
**New Features**
* Add support for the RX offset feature - where the device writes data
with an offset from the beginning of an RX buffer.

## r2.1.3 release notes
**New Features**
* Replace old adaptive interrupt moderation algorithm with the DIM
Expand Down
10 changes: 8 additions & 2 deletions kernel/linux/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ static struct sk_buff *ena_alloc_skb(struct ena_ring *rx_ring, bool frags)
static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
struct ena_com_rx_buf_info *ena_bufs,
u32 descs,
u16 *next_to_clean)
u16 *next_to_clean,
u8 offset)
{
struct sk_buff *skb;
struct ena_rx_buffer *rx_info;
Expand All @@ -911,6 +912,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
}

rx_info = &rx_ring->rx_buffer_info[req_id];
rx_info->page_offset = offset;

if (unlikely(!rx_info->page)) {
netif_err(rx_ring->adapter, rx_err, rx_ring->netdev,
Expand Down Expand Up @@ -974,6 +976,8 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,

skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_info->page,
rx_info->page_offset, len, ENA_PAGE_SIZE);
/* The offset is non zero only for the first buffer */
rx_info->page_offset = 0;

netif_dbg(rx_ring->adapter, rx_status, rx_ring->netdev,
"rx skb updated. len %d. data_len %d\n",
Expand Down Expand Up @@ -1141,6 +1145,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
ena_rx_ctx.ena_bufs = rx_ring->ena_bufs;
ena_rx_ctx.max_bufs = rx_ring->sgl_size;
ena_rx_ctx.descs = 0;
ena_rx_ctx.pkt_offset = 0;
rc = ena_com_rx_pkt(rx_ring->ena_com_io_cq,
rx_ring->ena_com_io_sq,
&ena_rx_ctx);
Expand All @@ -1157,7 +1162,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,

/* allocate skb and fill it */
skb = ena_rx_skb(rx_ring, rx_ring->ena_bufs, ena_rx_ctx.descs,
&next_to_clean);
&next_to_clean, ena_rx_ctx.pkt_offset);

/* exit if we failed to retrieve a buffer */
if (unlikely(!skb)) {
Expand Down Expand Up @@ -2664,6 +2669,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, struct pci_dev *pd
host_info->num_cpus = num_online_cpus();

host_info->driver_supported_features =
ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK |
ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK;

rc = ena_com_set_host_attributes(ena_dev);
Expand Down
2 changes: 1 addition & 1 deletion kernel/linux/ena/ena_netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

#define DRV_MODULE_VER_MAJOR 2
#define DRV_MODULE_VER_MINOR 1
#define DRV_MODULE_VER_SUBMINOR 3
#define DRV_MODULE_VER_SUBMINOR 4

#define DRV_MODULE_NAME "ena"
#ifndef DRV_MODULE_VERSION
Expand Down
2 changes: 1 addition & 1 deletion kernel/linux/rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author: Cristian Gafton <[email protected]>

NAME = ena
VERSION = 2.1.3
VERSION = 2.1.4

TOPDIR := $(shell git rev-parse --show-toplevel)

Expand Down
12 changes: 6 additions & 6 deletions kernel/linux/rpm/README-rpm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Once the pre-requisites have been installed, you can simply issue a
"make" in this directory to build the kmod src.rpm package:

bash$ make
cd .. && git archive --format=tar --prefix=ena-2.1.3/ -o rpm/ena-2.1.3.tar ena_linux_2.1.3
cd .. && git archive --format=tar --prefix=ena-2.1.4/ -o rpm/ena-2.1.4.tar ena_linux_2.1.4
rpmbuild -bs \
--define '_topdir %(pwd)' --define '_ntopdir %(pwd)' \
--define '_builddir %{_ntopdir}' \
Expand All @@ -41,7 +41,7 @@ rpmbuild -bs \
--define '_rpmdir %{_ntopdir}' \
--define '_srcrpmdir %{_ntopdir}' \
ena.spec
Wrote: /home/ec2-user/amzn-drivers/rpm/ena-2.1.3-1.el7.3.src.rpm
Wrote: /home/ec2-user/amzn-drivers/rpm/ena-2.1.4-1.el7.3.src.rpm
bash$ _


Expand All @@ -50,16 +50,16 @@ COMPILING AND INSTALLING
Once the src.rpm has been created, you can build binary packages for
the installed kernel-devel and kernel-headers environments:

bash$ rpmbuild --rebuild ena-2.1.3-1.el7.3.src.rpm
bash$ rpmbuild --rebuild ena-2.1.4-1.el7.3.src.rpm
[....]
Wrote: /home/ec2-user/rpmbuild/RPMS/x86_64/kmod-ena-2.1.3-1.el7.3.x86_64.rpm
Wrote: /home/ec2-user/rpmbuild/RPMS/x86_64/ena-debuginfo-2.1.3-1.el7.3.x86_64.rpm
Wrote: /home/ec2-user/rpmbuild/RPMS/x86_64/kmod-ena-2.1.4-1.el7.3.x86_64.rpm
Wrote: /home/ec2-user/rpmbuild/RPMS/x86_64/ena-debuginfo-2.1.4-1.el7.3.x86_64.rpm
[...]
bash$ _

Now you should be able to install/deploy the resulting binary rpm
packages using your preferred rpm install too. For example, using yum:

bash$ sudo yum -y localinstall
/home/ec2-user/rpmbuild/RPMS/x86_64/kmod-ena-2.1.3-1.el7.3.x86_64.rpm
/home/ec2-user/rpmbuild/RPMS/x86_64/kmod-ena-2.1.4-1.el7.3.x86_64.rpm

7 changes: 5 additions & 2 deletions kernel/linux/rpm/ena.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%define kmod_name ena
%define kmod_driver_version 2.1.3
%define kmod_driver_version 2.1.4
%define kmod_rpm_release 1
%define kmod_git_hash 3ac3e0bf079b2c0468f759f2213541e214a6dd77
%define kmod_kbuild_dir kernel/linux/ena
Expand All @@ -22,7 +22,7 @@ Source7: preamble

Name: %{kmod_name}
Version: %{kmod_driver_version}
Release: %{kmod_rpm_release}%{?dist}.14
Release: %{kmod_rpm_release}%{?dist}.15
Summary: %{kmod_name} kernel module

Group: System/Kernel
Expand Down Expand Up @@ -99,6 +99,9 @@ install -m 644 -D source/%{kmod_kbuild_dir}/RELEASENOTES.md $RPM_BUILD_ROOT/usr/
rm -rf $RPM_BUILD_ROOT

%changelog
* Thu Dec 12 2019 Arthur Kiyanovski [email protected] - 2.1.4-1.15
- Update ENA driver to version 2.1.4

* Wed Oct 23 2019 Arthur Kiyanovski [email protected] - 2.1.3-1.14
- Update ENA driver to version 2.1.3

Expand Down

0 comments on commit 6e89da2

Please sign in to comment.