forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made non-upstream patch design order aware (sonic-net#14434)
- Why I did it Currently, non upstream patches are applied only after upstream patches. Depends on sonic-net/sonic-linux-kernel#313. Can be merged in any order, preferably together - What I did it Non upstream Patches that reside in the sonic repo will not be saved in a tar file bur rather in a folder pointed out by EXTERNAL_KERNEL_PATCH_LOC. This is to make changes to the non upstream patches easily traceable. The build variable name is also updated to INCLUDE_EXTERNAL_PATCHES Files/folders expected under EXTERNAL_KERNEL_PATCH_LOC EXTERNAL_KERNEL_PATCH_LOC/ ├──── patches/ ├── 0001-xxxxx.patch ├── 0001-yyyyyyyy.patch ├── ............. ├──── series.patch series.patch should contain a diff that is applied on the sonic-linux-kernel/patch/series file. The diff should include all the non-upstream patches. How to verify it Build the Kernel and verified if all the patches are applied properly Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
- Loading branch information
1 parent
5dbf512
commit 3ea516d
Showing
67 changed files
with
12,879 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
## Mellanox non-upstream linux kernel patches ## | ||
|
||
To include non-upstream patches into the sonic-linux image during build time, this folder must contain a patch archive. | ||
|
||
### Structure of the patch archive | ||
|
||
1. It should contain a file named series. series should provide an order in which the patches have to be applied | ||
``` | ||
admin@build-server:/sonic-buildimage/src/sonic-linux-kernel$ cat linux-5.10.103/non_upstream_patches/series | ||
mlx5-Refactor-module-EEPROM-query.patch | ||
mlx5-Implement-get_module_eeprom_by_page.patch | ||
mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch | ||
``` | ||
2. All the patches should be present in the same folder where series resides. | ||
3. Developers should make sure patches apply cleanly over the existing patches present in the src/sonic-linux-kernel . | ||
4. Name of the tarball should match with the one specified under EXTERNAL_KERNEL_PATCH_TAR | ||
To include non-upstream patches into the sonic-linux image during build time, the `INCLUDE_EXTERNAL_PATCHES=y` flag has to be provided. By default, the directory pointed by EXTERNAL_KERNEL_PATCH_LOC will be used and it must follow the following structure. To use a publicly accessible tar of the non-upstream patches, also provide the `EXTERNAL_KERNEL_PATCH_URL` variable | ||
|
||
### Directory Structure | ||
|
||
#### Example | ||
``` | ||
admin@build-server:/sonic-buildimage/platform/mellanox/non-upstream-patches$ tar -tf patches.tar.gz | ||
./ | ||
./mlx5-Implement-get_module_eeprom_by_page.patch | ||
./mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch | ||
./series | ||
./mlx5-Refactor-module-EEPROM-query.patch | ||
EXTERNAL_KERNEL_PATCH_LOC/ | ||
├──── patches/ | ||
├── 0001-mlx5-Refactor-module-EEPROM-query.patch.patch | ||
├── 0002-mlx5-Implement-get_module_eeprom_by_page.patch.patch | ||
├── 0005-mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch | ||
├── ............. | ||
├──── series.patch | ||
``` | ||
|
||
### Include the archive while building sonic linux kernel | ||
1. It should contain a file named series.patch. This should contain a diff that is applied on the sonic-linux-kernel/patch/series file. The diff should include all the non-upstream patches. | ||
2. All the patches should be present in the patches folder | ||
3. Developers should make sure patches apply cleanly over the existing patches present in the src/sonic-linux-kernel . | ||
|
||
|
||
### Include the non upstream patches while building sonic linux kernel | ||
|
||
Set `INCLUDE_EXTERNAL_PATCHES=y` using `SONIC_OVERRIDE_BUILD_VARS` to include these changes before building the kernel. | ||
- Eg: `NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 make SONIC_OVERRIDE_BUILD_VARS=' INCLUDE_EXTERNAL_PATCHES=y ' target/debs/bullseye/linux-headers-5.10.0-12-2-common_5.10.103-1_all.deb` | ||
|
||
Set `INCLUDE_EXTERNAL_PATCH_TAR=y` using `SONIC_OVERRIDE_BUILD_VARS` to include these changes before building the kernel. | ||
- Eg: `NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 make SONIC_OVERRIDE_BUILD_VARS=' INCLUDE_EXTERNAL_PATCH_TAR=y ' target/debs/bullseye/linux-headers-5.10.0-12-2-common_5.10.103-1_all.deb` |
Binary file not shown.
255 changes: 255 additions & 0 deletions
255
...-upstream-patches/patches/0099-mlxsw-core_hwmon-Fix-variable-names-for-hwmon-attrib.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
From 45dc72bca025600611d6d08e00758618ddb5d7d0 Mon Sep 17 00:00:00 2001 | ||
From: Vadim Pasternak <vadimp@nvidia.com> | ||
Date: Fri, 3 Dec 2021 11:48:41 +0200 | ||
Subject: [PATCH] mlxsw: core_hwmon: Fix variable names for hwmon attributes | ||
|
||
Replace all local variables 'mlwsw_hwmon_attr' by 'mlxsw_hwmon_attr'. | ||
All variable prefixes should start with 'mlxsw' according to the naming | ||
convention, so 'mlwsw' is changed to 'mlxsw'. | ||
|
||
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> | ||
Reviewed-by: Jiri Pirko <jiri@nvidia.com> | ||
Signed-off-by: Ido Schimmel <idosch@nvidia.com> | ||
--- | ||
.../net/ethernet/mellanox/mlxsw/core_hwmon.c | 76 +++++++++---------- | ||
1 file changed, 38 insertions(+), 38 deletions(-) | ||
|
||
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | ||
index d41afdfbd..3788d02b5 100644 | ||
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | ||
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | ||
@@ -57,14 +57,14 @@ static ssize_t mlxsw_hwmon_temp_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mtmp_pl[MLXSW_REG_MTMP_LEN]; | ||
int temp, index; | ||
int err; | ||
|
||
- index = mlxsw_hwmon_get_attr_index(mlwsw_hwmon_attr->type_index, | ||
+ index = mlxsw_hwmon_get_attr_index(mlxsw_hwmon_attr->type_index, | ||
mlxsw_hwmon->module_sensor_max); | ||
mlxsw_reg_mtmp_pack(mtmp_pl, index, false, false); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtmp), mtmp_pl); | ||
@@ -80,14 +80,14 @@ static ssize_t mlxsw_hwmon_temp_max_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mtmp_pl[MLXSW_REG_MTMP_LEN]; | ||
int temp_max, index; | ||
int err; | ||
|
||
- index = mlxsw_hwmon_get_attr_index(mlwsw_hwmon_attr->type_index, | ||
+ index = mlxsw_hwmon_get_attr_index(mlxsw_hwmon_attr->type_index, | ||
mlxsw_hwmon->module_sensor_max); | ||
mlxsw_reg_mtmp_pack(mtmp_pl, index, false, false); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtmp), mtmp_pl); | ||
@@ -103,9 +103,9 @@ static ssize_t mlxsw_hwmon_temp_rst_store(struct device *dev, | ||
struct device_attribute *attr, | ||
const char *buf, size_t len) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mtmp_pl[MLXSW_REG_MTMP_LEN] = {0}; | ||
unsigned long val; | ||
int index; | ||
@@ -117,7 +117,7 @@ static ssize_t mlxsw_hwmon_temp_rst_store(struct device *dev, | ||
if (val != 1) | ||
return -EINVAL; | ||
|
||
- index = mlxsw_hwmon_get_attr_index(mlwsw_hwmon_attr->type_index, | ||
+ index = mlxsw_hwmon_get_attr_index(mlxsw_hwmon_attr->type_index, | ||
mlxsw_hwmon->module_sensor_max); | ||
|
||
mlxsw_reg_mtmp_sensor_index_set(mtmp_pl, index); | ||
@@ -138,13 +138,13 @@ static ssize_t mlxsw_hwmon_fan_rpm_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mfsm_pl[MLXSW_REG_MFSM_LEN]; | ||
int err; | ||
|
||
- mlxsw_reg_mfsm_pack(mfsm_pl, mlwsw_hwmon_attr->type_index); | ||
+ mlxsw_reg_mfsm_pack(mfsm_pl, mlxsw_hwmon_attr->type_index); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mfsm), mfsm_pl); | ||
if (err) { | ||
dev_err(mlxsw_hwmon->bus_info->dev, "Failed to query fan\n"); | ||
@@ -157,9 +157,9 @@ static ssize_t mlxsw_hwmon_fan_fault_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char fore_pl[MLXSW_REG_FORE_LEN]; | ||
bool fault; | ||
int err; | ||
@@ -169,7 +169,7 @@ static ssize_t mlxsw_hwmon_fan_fault_show(struct device *dev, | ||
dev_err(mlxsw_hwmon->bus_info->dev, "Failed to query fan\n"); | ||
return err; | ||
} | ||
- mlxsw_reg_fore_unpack(fore_pl, mlwsw_hwmon_attr->type_index, &fault); | ||
+ mlxsw_reg_fore_unpack(fore_pl, mlxsw_hwmon_attr->type_index, &fault); | ||
|
||
return sprintf(buf, "%u\n", fault); | ||
} | ||
@@ -178,13 +178,13 @@ static ssize_t mlxsw_hwmon_pwm_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mfsc_pl[MLXSW_REG_MFSC_LEN]; | ||
int err; | ||
|
||
- mlxsw_reg_mfsc_pack(mfsc_pl, mlwsw_hwmon_attr->type_index, 0); | ||
+ mlxsw_reg_mfsc_pack(mfsc_pl, mlxsw_hwmon_attr->type_index, 0); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mfsc), mfsc_pl); | ||
if (err) { | ||
dev_err(mlxsw_hwmon->bus_info->dev, "Failed to query PWM\n"); | ||
@@ -198,9 +198,9 @@ static ssize_t mlxsw_hwmon_pwm_store(struct device *dev, | ||
struct device_attribute *attr, | ||
const char *buf, size_t len) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mfsc_pl[MLXSW_REG_MFSC_LEN]; | ||
unsigned long val; | ||
int err; | ||
@@ -211,7 +211,7 @@ static ssize_t mlxsw_hwmon_pwm_store(struct device *dev, | ||
if (val > 255) | ||
return -EINVAL; | ||
|
||
- mlxsw_reg_mfsc_pack(mfsc_pl, mlwsw_hwmon_attr->type_index, val); | ||
+ mlxsw_reg_mfsc_pack(mfsc_pl, mlxsw_hwmon_attr->type_index, val); | ||
err = mlxsw_reg_write(mlxsw_hwmon->core, MLXSW_REG(mfsc), mfsc_pl); | ||
if (err) { | ||
dev_err(mlxsw_hwmon->bus_info->dev, "Failed to write PWM\n"); | ||
@@ -224,14 +224,14 @@ static int mlxsw_hwmon_module_temp_get(struct device *dev, | ||
struct device_attribute *attr, | ||
int *p_temp) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mtmp_pl[MLXSW_REG_MTMP_LEN]; | ||
u8 module; | ||
int err; | ||
|
||
- module = mlwsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
+ module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
mlxsw_reg_mtmp_pack(mtmp_pl, MLXSW_REG_MTMP_MODULE_INDEX_MIN + module, | ||
false, false); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtmp), mtmp_pl); | ||
@@ -261,15 +261,15 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
char mtbr_pl[MLXSW_REG_MTBR_LEN] = {0}; | ||
u8 module, fault; | ||
u16 temp; | ||
int err; | ||
|
||
- module = mlwsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
+ module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
mlxsw_reg_mtbr_pack(mtbr_pl, MLXSW_REG_MTBR_BASE_MODULE_INDEX + module, | ||
1); | ||
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtbr), mtbr_pl); | ||
@@ -303,13 +303,13 @@ static int mlxsw_hwmon_module_temp_critical_get(struct device *dev, | ||
struct device_attribute *attr, | ||
int *p_temp) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
u8 module; | ||
int err; | ||
|
||
- module = mlwsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
+ module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
err = mlxsw_env_module_temp_thresholds_get(mlxsw_hwmon->core, module, | ||
SFP_TEMP_HIGH_WARN, p_temp); | ||
if (err) { | ||
@@ -337,13 +337,13 @@ static int mlxsw_hwmon_module_temp_emergency_get(struct device *dev, | ||
struct device_attribute *attr, | ||
int *p_temp) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
u8 module; | ||
int err; | ||
|
||
- module = mlwsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
+ module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; | ||
err = mlxsw_env_module_temp_thresholds_get(mlxsw_hwmon->core, module, | ||
SFP_TEMP_HIGH_ALARM, p_temp); | ||
if (err) { | ||
@@ -373,11 +373,11 @@ mlxsw_hwmon_module_temp_label_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
|
||
return sprintf(buf, "front panel %03u\n", | ||
- mlwsw_hwmon_attr->type_index); | ||
+ mlxsw_hwmon_attr->type_index); | ||
} | ||
|
||
static ssize_t | ||
@@ -385,10 +385,10 @@ mlxsw_hwmon_gbox_temp_label_show(struct device *dev, | ||
struct device_attribute *attr, | ||
char *buf) | ||
{ | ||
- struct mlxsw_hwmon_attr *mlwsw_hwmon_attr = | ||
+ struct mlxsw_hwmon_attr *mlxsw_hwmon_attr = | ||
container_of(attr, struct mlxsw_hwmon_attr, dev_attr); | ||
- struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon; | ||
- int index = mlwsw_hwmon_attr->type_index - | ||
+ struct mlxsw_hwmon *mlxsw_hwmon = mlxsw_hwmon_attr->hwmon; | ||
+ int index = mlxsw_hwmon_attr->type_index - | ||
mlxsw_hwmon->module_sensor_max + 1; | ||
|
||
return sprintf(buf, "gearbox %03u\n", index); | ||
-- | ||
2.30.2 | ||
|
Oops, something went wrong.