From d219f2aec116bef15ff00df9df1bee82a5db3a93 Mon Sep 17 00:00:00 2001
From: Li Zhou
Date: Thu, 23 Sep 2021 06:29:47 -0400
Subject: [PATCH] intel-ice: add initial version for debian
Add ice 1.6.7 driver of debian packaging.
The source code package is from:
https://sourceforge.net/projects/e1000/files/ice%20stable/1.6.7/ice-1.6.7.tar.gz
Verification:
As we are only getting the Debian work bootstrapped there is quite a few
restrictions as far as what can be tested.
- source code/patch/config are aligned with stx centos 20211108;
- output packages' contents are aligned with stx centos 20211108;
- build image ok with the module;
- qemu boot up ok with the module.
Story: 2009221
Task: 43409
Signed-off-by: Li Zhou
Change-Id: Ie432e1d2d4c6907702cb98f8336e5b2516c8e62a
---
.../intel-ice/debian/deb_folder/changelog | 5 ++
.../intel-ice/debian/deb_folder/control | 15 +++++
.../intel-ice/debian/deb_folder/copyright | 26 +++++++
.../debian/deb_folder/extra/ice.conf | 1 +
...pendency-on-napi_busy_loop-with-PREE.patch | 47 +++++++++++++
.../debian/deb_folder/patches/series | 1 +
.../intel-ice/debian/deb_folder/rules | 67 +++++++++++++++++++
.../intel-ice/debian/deb_folder/source/format | 1 +
.../intel-ice/debian/meta_data.yaml | 11 +++
9 files changed, 174 insertions(+)
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/changelog
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/control
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/copyright
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/extra/ice.conf
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/patches/0001-ice_xsk-Avoid-dependency-on-napi_busy_loop-with-PREE.patch
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/patches/series
create mode 100755 kernel-modules/intel-ice/debian/deb_folder/rules
create mode 100644 kernel-modules/intel-ice/debian/deb_folder/source/format
create mode 100644 kernel-modules/intel-ice/debian/meta_data.yaml
diff --git a/kernel-modules/intel-ice/debian/deb_folder/changelog b/kernel-modules/intel-ice/debian/deb_folder/changelog
new file mode 100644
index 00000000..34edd4e5
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/changelog
@@ -0,0 +1,5 @@
+ice (1.6.7-1) unstable; urgency=medium
+
+ * Initial release
+
+ -- Li Zhou Thu, 01 Jul 2021 11:05:16 +0800
diff --git a/kernel-modules/intel-ice/debian/deb_folder/control b/kernel-modules/intel-ice/debian/deb_folder/control
new file mode 100644
index 00000000..482aefb9
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/control
@@ -0,0 +1,15 @@
+Source: ice
+Section: net
+Priority: optional
+Maintainer: StarlingX Developers
+Build-Depends: debhelper-compat (= 13), linux-headers-5.10.0-6-amd64, linux-kbuild-5.10
+Standards-Version: 4.5.1
+Rules-Requires-Root: no
+
+Package: ice
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: This package provides the ice kernel module(s).
+ This package provides the ice kernel module(s) built
+ for the Linux kernel using the amd64 processors.
+ This package contains the Intel(R) Ethernet Connection E800 Series Linux Driver.
diff --git a/kernel-modules/intel-ice/debian/deb_folder/copyright b/kernel-modules/intel-ice/debian/deb_folder/copyright
new file mode 100644
index 00000000..1258453e
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/copyright
@@ -0,0 +1,26 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Upstream-Name: ice
+Upstream-Contact: Intel Corporation
+Source: https://sourceforge.net/projects/e1000/files/ice%20stable/1.6.7/ice-1.6.7.tar.gz/download
+Files: *
+Copyright: (c) 2017 - 2021 Intel Corporation.
+License: GPL-2
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms and conditions of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+ The full GNU General Public License is included in this distribution in the
+ file called "COPYING".
+
+ On Debian-based systems the full text of the GNU General Public License
+ version 2 license can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/kernel-modules/intel-ice/debian/deb_folder/extra/ice.conf b/kernel-modules/intel-ice/debian/deb_folder/extra/ice.conf
new file mode 100644
index 00000000..690ff753
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/extra/ice.conf
@@ -0,0 +1 @@
+ice
diff --git a/kernel-modules/intel-ice/debian/deb_folder/patches/0001-ice_xsk-Avoid-dependency-on-napi_busy_loop-with-PREE.patch b/kernel-modules/intel-ice/debian/deb_folder/patches/0001-ice_xsk-Avoid-dependency-on-napi_busy_loop-with-PREE.patch
new file mode 100644
index 00000000..8ff34eca
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/patches/0001-ice_xsk-Avoid-dependency-on-napi_busy_loop-with-PREE.patch
@@ -0,0 +1,47 @@
+From a25ae52b1381527b89a61e0ed0c34d5fac6ffca4 Mon Sep 17 00:00:00 2001
+From: Jiping Ma
+Date: Tue, 24 Aug 2021 00:30:02 -0700
+Subject: [PATCH] ice_xsk: Avoid dependency on napi_busy_loop with PREEMPT_RT
+
+This commit fixes the following error encountered when compiling the ice
+device driver against PREEMPT_RT-enabled kernels:
+
+ error: implicit declaration of function 'napi_busy_loop'
+
+This error is encountered, because, with recent kernels, defining
+CONFIG_PREEMPT_RT unsets the CONFIG_NET_RX_BUSY_POLL kernel
+configuration option, which in turn causes the napi_busy_loop function
+to not be defined.
+
+The fix implemented in this patch was confirmed to be correct by
+consulting colleagues at Intel.
+
+Signed-off-by: Jiping Ma
+[mvb: Update commit message.]
+Signed-off-by: M. Vefa Bicakci
+---
+ src/ice_xsk.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/ice_xsk.c b/src/ice_xsk.c
+index 43012bb9b115..795cdba3d5c1 100644
+--- a/src/ice_xsk.c
++++ b/src/ice_xsk.c
+@@ -1302,12 +1302,14 @@ int ice_xsk_async_xmit(struct net_device *netdev, u32 queue_id)
+ */
+ q_vector = ring->q_vector;
+ if (!napi_if_scheduled_mark_missed(&q_vector->napi)) {
++#ifdef CONFIG_NET_RX_BUSY_POLL
+ if (ice_ring_ch_enabled(vsi->rx_rings[queue_id]) &&
+ !ice_vsi_pkt_inspect_opt_ena(vsi))
+ #define ICE_BUSY_POLL_BUDGET 8
+ napi_busy_loop(q_vector->napi.napi_id, NULL, NULL,
+ false, ICE_BUSY_POLL_BUDGET);
+ else
++#endif
+ ice_trigger_sw_intr(&vsi->back->hw, q_vector);
+ }
+
+--
+2.29.2
+
diff --git a/kernel-modules/intel-ice/debian/deb_folder/patches/series b/kernel-modules/intel-ice/debian/deb_folder/patches/series
new file mode 100644
index 00000000..35c6329c
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/patches/series
@@ -0,0 +1 @@
+0001-ice_xsk-Avoid-dependency-on-napi_busy_loop-with-PREE.patch
diff --git a/kernel-modules/intel-ice/debian/deb_folder/rules b/kernel-modules/intel-ice/debian/deb_folder/rules
new file mode 100755
index 00000000..9db34954
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/rules
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+#
+# Copyright (c) 2021 Wind River Systems, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+%:
+ dh $@
+
+WITH_MOD_SIGN ?= 0
+
+kheaders_name=$(shell ls /usr/src | grep linux-headers | grep amd64)
+export KSRC=/usr/src/$(kheaders_name)
+kversion=$(shell echo $(kheaders_name) | sed 's/linux-headers-//g')
+kmod_name=ice
+version=$(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p')
+
+_sysconfdir=/etc
+_defaultdocdir=/usr/share/doc
+_mandir=/usr/share/man
+
+ifeq ($(WITH_MOD_SIGN),1)
+_keydir ?= /usr/src/kernels/$(kversion)/
+privkey ?= $(_keydir)/signing_key.priv
+pubkey ?= $(_keydir)/signing_key.x509
+endif
+
+override_dh_auto_install:
+ dh_install src/$(kmod_name).ko /lib/modules/$(kversion)/extra/$(kmod_name)/
+ dh_install pci.updates $(_defaultdocdir)/kmod-$(kmod_name)-$(version)/
+ dh_install README $(_defaultdocdir)/kmod-$(kmod_name)-$(version)/
+ dh_install $(kmod_name).7 $(_mandir)/man7/
+ dh_install debian/extra/ice.conf $(_sysconfdir)/modules-load.d/
+ dh_install ddp/README /lib/firmware/updates/intel/ice/ddp/
+ dh_install ddp/LICENSE /lib/firmware/updates/intel/ice/ddp/
+ dh_install ddp/ice-*.pkg /lib/firmware/updates/intel/ice/ddp/
+ mkdir -p debian/$(kmod_name)/lib/firmware/intel/ice/ddp/
+ ln -frs debian/$(kmod_name)/lib/firmware/updates/intel/ice/ddp/ice-*.pkg debian/$(kmod_name)/lib/firmware/intel/ice/ddp/ice.pkg
+
+override_dh_strip:
+ dh_strip
+ find debian -name '*.ko' | xargs strip -g
+ifeq ($(WITH_MOD_SIGN),1)
+ @echo "Sign the modules!"
+ /usr/lib/linux-kbuild-*/scripts/sign-file sha256 $(privkey) $(pubkey) \
+ ./debian/$(kmod_name)/lib/modules/$(kversion)/extra/$(kmod_name)/*.ko
+endif
+
+override_dh_auto_build:
+ dh_auto_build -D ./src
diff --git a/kernel-modules/intel-ice/debian/deb_folder/source/format b/kernel-modules/intel-ice/debian/deb_folder/source/format
new file mode 100644
index 00000000..163aaf8d
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/deb_folder/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/kernel-modules/intel-ice/debian/meta_data.yaml b/kernel-modules/intel-ice/debian/meta_data.yaml
new file mode 100644
index 00000000..cc8771b3
--- /dev/null
+++ b/kernel-modules/intel-ice/debian/meta_data.yaml
@@ -0,0 +1,11 @@
+---
+debver: 1.6.7
+debname: ice
+dl_path:
+ name: ice-1.6.7.tar.gz
+ url: "https://sourceforge.net/projects/e1000/files/ice%20stable/\
+ 1.6.7/ice-1.6.7.tar.gz"
+ md5sum: 37d46b3cc4c9bef7bd80f2fc36879905
+revision:
+ dist: $STX_DIST
+ PKG_GITREVCOUNT: true