From 434463b30e1ea6f39e7a0456e7bfb6adbdf75784 Mon Sep 17 00:00:00 2001 From: Yue Tao Date: Fri, 17 Sep 2021 11:19:05 +0800 Subject: [PATCH] Add debian package for pf-bb-config Porting three patches from CentOS Customize-fpga_5gnr-config-for-1-VF.patch Reject-device-configuration-if-not-enabled.patch Fix-check-return-of-configure_device.patch Story: 2009221 Task: 43356 Signed-off-by: Yue Tao Change-Id: Ifeaf13b4b47b8633137b89679535f923187a3740 --- base/pf-bb-config/debian/deb_folder/changelog | 5 ++ base/pf-bb-config/debian/deb_folder/control | 33 ++++++++++ base/pf-bb-config/debian/deb_folder/copyright | 60 +++++++++++++++++++ .../Customize-fpga_5gnr-config-for-1-VF.patch | 31 ++++++++++ ...Fix-check-return-of-configure_device.patch | 49 +++++++++++++++ ...-device-configuration-if-not-enabled.patch | 48 +++++++++++++++ .../debian/deb_folder/patches/series | 3 + base/pf-bb-config/debian/deb_folder/rules | 24 ++++++++ .../debian/deb_folder/source/format | 1 + base/pf-bb-config/debian/meta_data.yaml | 9 +++ 10 files changed, 263 insertions(+) create mode 100644 base/pf-bb-config/debian/deb_folder/changelog create mode 100644 base/pf-bb-config/debian/deb_folder/control create mode 100644 base/pf-bb-config/debian/deb_folder/copyright create mode 100644 base/pf-bb-config/debian/deb_folder/patches/Customize-fpga_5gnr-config-for-1-VF.patch create mode 100644 base/pf-bb-config/debian/deb_folder/patches/Fix-check-return-of-configure_device.patch create mode 100644 base/pf-bb-config/debian/deb_folder/patches/Reject-device-configuration-if-not-enabled.patch create mode 100644 base/pf-bb-config/debian/deb_folder/patches/series create mode 100755 base/pf-bb-config/debian/deb_folder/rules create mode 100644 base/pf-bb-config/debian/deb_folder/source/format create mode 100644 base/pf-bb-config/debian/meta_data.yaml diff --git a/base/pf-bb-config/debian/deb_folder/changelog b/base/pf-bb-config/debian/deb_folder/changelog new file mode 100644 index 000000000..40c46c557 --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +pf-bb-config (21.6) UNRELEASED; urgency=low + + * Initial release + + -- <> Wed, 21 Apr 2021 05:41:49 +0000 diff --git a/base/pf-bb-config/debian/deb_folder/control b/base/pf-bb-config/debian/deb_folder/control new file mode 100644 index 000000000..f76a7b59d --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/control @@ -0,0 +1,33 @@ +# 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. + +Source: pf-bb-config +Section: admin +Priority: optional +Maintainer: Starlingx Developers +Build-Depends: debhelper-compat (= 13), libinih-dev +Standards-Version: 4.5.0 +Homepage: https://www.starlingx.io + +Package: pf-bb-config +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: The PF BBDEV (baseband device) Configuration Application "pf_bb_config" + provides a means to configure the baseband device at the host-level. The program + accesses the configuration space and sets the various parameters through memory-mapped + IO read/writes. diff --git a/base/pf-bb-config/debian/deb_folder/copyright b/base/pf-bb-config/debian/deb_folder/copyright new file mode 100644 index 000000000..28c527443 --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/copyright @@ -0,0 +1,60 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pf-bb +Upstream-Contact: https://github.com/intel +Source: https://github.com/intel/pf-bb-config + +Files: acc100/acc100_cfg_app.c + acc100/acc100_cfg_app.h + acc100/acc100_cfg_parser.c + acc100/acc100_pf_enum.h + config_app.c + fpga_5gnr/fpga_5gnr_cfg_app.c + fpga_5gnr/fpga_5gnr_cfg_app.h + fpga_5gnr/fpga_5gnr_cfg_parser.c + fpga_lte/fpga_lte_cfg_app.c + fpga_lte/fpga_lte_cfg_app.h + fpga_lte/fpga_lte_cfg_parser.c + README.md + acc100/acc100_config_4g.cfg + acc100/acc100_config_5g.cfg + acc100/acc100_config_pf.cfg + acc100/acc100_config_vf.cfg + acc100/acc100_config_vf_4g.cfg + acc100/acc100_config_vf_5g.cfg + fpga_5gnr/fpga_5gnr_config.cfg + fpga_5gnr/fpga_5gnr_config_vf.cfg + fpga_lte/fpga_lte_config.cfg + fpga_lte/fpga_lte_config_vf.cfg + Makefile +Copyright: 2020 Intel. +License: Apache-2.0 + Licensed 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. + . + On Debian systems, the complete text of the Apache License Version 2.0 + can be found in `/usr/share/common-licenses/Apache-2.0'. + +Files: bsd-3-clause.txt +Copyright: __NO_COPYRIGHT__ in: bsd-3-clause.txt +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + . + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + . + On Debian systems, the complete text of the BSD 3-clause "New" or "Revised" + License can be found in `/usr/share/common-licenses/BSD'. diff --git a/base/pf-bb-config/debian/deb_folder/patches/Customize-fpga_5gnr-config-for-1-VF.patch b/base/pf-bb-config/debian/deb_folder/patches/Customize-fpga_5gnr-config-for-1-VF.patch new file mode 100644 index 000000000..a0fdca8b1 --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/patches/Customize-fpga_5gnr-config-for-1-VF.patch @@ -0,0 +1,31 @@ +From a362668ac7ca891974c3b5b50c983471e1dfab02 Mon Sep 17 00:00:00 2001 +From: Douglas Henrique Koerich +Date: Wed, 18 Aug 2021 12:19:16 -0400 +Subject: [PATCH] Customize fpga_5gnr config for 1 VF + +Change distribution of UL/DL queues to be used by one VF only. + +Signed-off-by: Douglas Henrique Koerich +--- + fpga_5gnr/fpga_5gnr_config_vf.cfg | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fpga_5gnr/fpga_5gnr_config_vf.cfg b/fpga_5gnr/fpga_5gnr_config_vf.cfg +index 0a82f52..81aa3bb 100644 +--- a/fpga_5gnr/fpga_5gnr_config_vf.cfg ++++ b/fpga_5gnr/fpga_5gnr_config_vf.cfg +@@ -7,9 +7,9 @@ pf_mode_en = 0 + [UL] + bandwidth = 3 + load_balance = 128 +-vfqmap = 16,16,0,0,0,0,0,0 ++vfqmap = 32,0,0,0,0,0,0,0 + + [DL] + bandwidth = 3 + load_balance = 128 +-vfqmap = 16,16,0,0,0,0,0,0 ++vfqmap = 32,0,0,0,0,0,0,0 +-- +2.29.2 + diff --git a/base/pf-bb-config/debian/deb_folder/patches/Fix-check-return-of-configure_device.patch b/base/pf-bb-config/debian/deb_folder/patches/Fix-check-return-of-configure_device.patch new file mode 100644 index 000000000..598e4a66a --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/patches/Fix-check-return-of-configure_device.patch @@ -0,0 +1,49 @@ +From 9d2809308feb10bc74130cea0b677be0bbe3f2dd Mon Sep 17 00:00:00 2001 +From: Douglas Henrique Koerich +Date: Tue, 27 Jul 2021 12:31:45 -0400 +Subject: [PATCH] Fix: check return of configure_device() + +Takes the result of configure_device() as the return code of the +application, allowing any script running pf-bb-config to stop on +bad device configuration. + +Signed-off-by: Douglas Henrique Koerich +--- + config_app.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/config_app.c b/config_app.c +index f1aa52b..f6dab5e 100644 +--- a/config_app.c ++++ b/config_app.c +@@ -390,20 +390,24 @@ main(int argc, char *argv[]) + return -1; + } + ++ ret = 0; + if (device.config_all) { + for (i = 0; i < num_devices; i++) { + strncpy(device.pci_address, found_devices[i], + sizeof(device.pci_address) - NULL_PAD); +- configure_device(&device); ++ ret = configure_device(&device); ++ if (ret != 0) { ++ break; ++ } + } + } else { + select_device(&device, found_devices, num_devices); +- configure_device(&device); ++ ret = configure_device(&device); + } + + /* Free memory for stored PCI slots */ + for (i = 0; i < num_devices; i++) + free(found_devices[i]); + +- return 0; ++ return ret; + } +-- +2.29.2 + diff --git a/base/pf-bb-config/debian/deb_folder/patches/Reject-device-configuration-if-not-enabled.patch b/base/pf-bb-config/debian/deb_folder/patches/Reject-device-configuration-if-not-enabled.patch new file mode 100644 index 000000000..a9a1813ea --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/patches/Reject-device-configuration-if-not-enabled.patch @@ -0,0 +1,48 @@ +From 8ac364315c153e546fbae9dd63c562b9a1e42d82 Mon Sep 17 00:00:00 2001 +From: Babak Sarashki +Date: Sun, 24 Jan 2021 13:46:20 -0500 +Subject: [PATCH] Reject device configuration if not enabled + +Signed-off-by: Babak Sarashki +--- + config_app.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/config_app.c b/config_app.c +index fdad259..f1aa52b 100644 +--- a/config_app.c ++++ b/config_app.c +@@ -114,6 +114,7 @@ static bool + get_device_id(hw_device *device, const char *location) + { + unsigned long vendor_id = -1, device_id = -1; ++ unsigned int device_enabled = 0; + struct dirent *dirent; + DIR *dir; + char pci_path[PATH_MAX]; +@@ -139,6 +140,12 @@ get_device_id(hw_device *device, const char *location) + snprintf(file_path, sizeof(file_path), "%s/%s", + pci_path, dirent->d_name); + ++ /* Is device enabled? */ ++ if (strncmp(dirent->d_name, "enable", ++ strlen(dirent->d_name)) == 0 && ++ dirent->d_type == DT_REG) ++ device_enabled = get_file_val(file_path); ++ + /* Get Device ID */ + if (strncmp(dirent->d_name, DEVICE_FILE, + strlen(dirent->d_name)) == 0 && +@@ -154,7 +161,8 @@ get_device_id(hw_device *device, const char *location) + + closedir(dir); + /* Check if device is found */ +- return (vendor_id == device->vendor_id && ++ return (device_enabled && ++ vendor_id == device->vendor_id && + device_id == device->device_id); + } + +-- +2.29.2 + diff --git a/base/pf-bb-config/debian/deb_folder/patches/series b/base/pf-bb-config/debian/deb_folder/patches/series new file mode 100644 index 000000000..62568c9eb --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/patches/series @@ -0,0 +1,3 @@ +Reject-device-configuration-if-not-enabled.patch +Fix-check-return-of-configure_device.patch +Customize-fpga_5gnr-config-for-1-VF.patch diff --git a/base/pf-bb-config/debian/deb_folder/rules b/base/pf-bb-config/debian/deb_folder/rules new file mode 100755 index 000000000..2761129ee --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/rules @@ -0,0 +1,24 @@ +#!/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. +# + +#export DH_VERBOSE = 1 + +%: + dh $@ diff --git a/base/pf-bb-config/debian/deb_folder/source/format b/base/pf-bb-config/debian/deb_folder/source/format new file mode 100644 index 000000000..89ae9db8f --- /dev/null +++ b/base/pf-bb-config/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/base/pf-bb-config/debian/meta_data.yaml b/base/pf-bb-config/debian/meta_data.yaml new file mode 100644 index 000000000..262067cc4 --- /dev/null +++ b/base/pf-bb-config/debian/meta_data.yaml @@ -0,0 +1,9 @@ +--- +debver: 21.6 +dl_path: + name: pf-bb-config-21.6.tar.gz + url: https://github.com/intel/pf-bb-config/archive/refs/tags/v21.6.tar.gz + md5sum: c2269025d0060565147971cf86cdbb3c +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true