[rdkb][common][bsp][Refactor and sync kernel from openwrt]
[Description]
7dbf952c [kernel][mt7988][eth][Refactor error detection rule for the WDMA_RX monitor]
179939e0 [kernel][mt7988][eth][Add individual polarity control to the USXGMII]
cd3e2dc3 [kernel][common][eth][Refactor the link polling mechanism to improve CPU usage in the USXGMII/SGMII]
e59df428 [Openwrt][Common][Change to valid lftp oss package download source]
bcded043 [openwrt][mt7988][crypto][Refactor CAPWAP DTLS code for establish tunnel]
9196c168 [kernel][common][hnat][Refactor entry fp and special tag assignment for handling DSA device]
a531c030 [openwrt][common][Kernel from 5.4.271 to 5.4.281]
849a7206 [openwrt][mt7988][crypto][Add CAPWAP-DTLS IPv6 Support]
65407907 [kernel][common][hnat][Add wdma rx port as match condition to delete entry by bssid, wcid API]
f5aa96c2 [Critical][kernel][common][spinand][Add CASN support for SPI-NAND]
1f7b6c3c [kernel][common][eth][Correct LROv1 invalidate flow]
da101027 [kernel][common][hnat][Add API to delete PPE entry by bssid and wcid]
7d2def2e [HIGH][kernel][mt7988][eth][ fix wdma module set to zero when warm reset fail and switch to cold reset ]
d6d7e24d [openwrt][mt7988][crypto][Add checking xfrm state info to avoid null pointer]
830eba8d [[Kernel][common][hnat]Fix WAN->LAN UNBIND in MAPE/DS_Lite scenario]
70e84050 [openwrt][switch][ARHT][update DSA and GSW driver for AN8855H]
5b59fbfa [openwrt][switch][ARHT][update switch app to v1.0.7]
db21a3af [openwrt][common][app][Fix Coverity defects in the switch utility]
2ad1c4af [mt7988][crypto][Add spin_lock for hnat_bind_crypto_entry()]
be77272d [openwrt][mt7988][pce][add notification chain in PCE]
a1bdbde8 [openwrt][mt7988][pce][Fix PCE freeing wrong cdrt idx bug]
be89679b [[Kernel][common][hnat][Fix 6RD HW PATH fail and ipv4 identification 0]
b199e1fa [[Coverity][REBB]Uninitialized pointer read: 5301002]
5441a4fb [MAC80211][misc][Add Setup SMP Affinity script for kernel6.6 build]
e55494d6 [[Kernel][common][hnat][Add delete entry by IP command]
35e68194 [HIGH][kernel][common][eth][Fix the GDM RX FC packet statistics error issue]
13d31aef [[kernel][common][eth][ fix reset flag coding error and add debug CR dump info ]]
15cf5b55 [openwrt][common][bsp][Add ignore item of checkpatch]
ca1fb699 [kernel][common][eth][Remove redundant break in the pse_info_get() function]
074b842b [kernel][common][eth][Refactor phylink pcs_enable and pcs_disable methods]
696aa6fe [openwrt-24][common][bsp][Fix fit related patches]
cfb45e3a [kernel][common][eth][Fix ETH compilation warnings]
6cbba7f6 [kernel][common][eth][ Reduce timeout value for waiting for WiFi SER 1st-part completion ]
6ff258fa [HIGH][kernel][common][eth][Fix ETH watchdog timeout false alarm during NETSYS SER]
c59c00f9 [HIGH][kernel][common][eth][Fix GDM monitor null pointer issue]
79d7b569 [kernel][common][hnat][Add delete entry by mac command]
b448600a [kernel][mt7988][eth][Correct XGMAC preparation function when using an external 1G/2.5G PHY]
cc241b51 [kernel][common][hnat][Add PSE PPE port link down based on configured PPE number]
111414fc [HIGH][kernel][common][eth][Change the network device TX queue reset flow]
62d9ddd8 [kernel][common][eth][Refactor PSE port link down function]
8de3854d [openwrt][common][bsp][Add ignore item of checkpatch]
a76c2442 [kernel][common][eth][fix wdma tx condition coding error]
bef28556 [MAC80211][misc][Change autobuild folder name to distinguish kernel5.4 and upcoming kernel6.6]
f82f591b [openwrt-24][common][bsp][Remove unnecessary patch due to has been upsteam]
d51fe770 [openwrt][mt7988][crytpo][add debugfs for crypto module]
64a21e7e [openwrt][mt7988][crypto][Add support for L2GREoIPsec]
ced208f6 [[kernel][common][eth][fix eth coverity]]
7b251009 [kernel][common][hnat][Revert the method for writing PPE info1]
e262a913 [HIGH][kernel][mt7988][eth][Add PPE2 case to the SER pending work]
[Release-log]
Change-Id: Ie2733597213f7e17960f79c2d4d69b7d09a7c269
diff --git a/recipes-devtools/switch/files/src/switch_753x.c b/recipes-devtools/switch/files/src/switch_753x.c
index 6936f6a..03e9778 100644
--- a/recipes-devtools/switch/files/src/switch_753x.c
+++ b/recipes-devtools/switch/files/src/switch_753x.c
@@ -8,17 +8,19 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/if.h>
+#include <errno.h>
#include "switch_netlink.h"
#include "switch_ioctl.h"
#include "switch_fun.h"
#include "switch_fun_an8855.h"
-#define SWITCH_APP_VERSION "1.0.1"
+#define SWITCH_APP_VERSION "1.0.7"
struct mt753x_attr *attres;
int chip_name;
bool nl_init_flag;
+bool air_skip_check_flag;
struct switch_func_s *p_switch_func;
static void usage(char *cmd)
@@ -427,27 +429,39 @@
{
unsigned int val;
unsigned int off;
+ char *endptr;
int i, j;
if (!strncmp(argv[len - 3], "reg", 4)) {
if (argv[len - 2][0] == 'r') {
- off = strtoul(argv[len - 1], NULL, 16);
+ errno = 0;
+ off = strtoul(argv[len - 1], &endptr, 16);
+ if (errno != 0 || *endptr != '\0')
+ goto error;
reg_read(off, &val);
printf(" Read reg=%x, value=%x\n", off, val);
} else if (argv[len - 2][0] == 'w') {
- off = strtoul(argv[len - 1], NULL, 16);
+ errno = 0;
+ off = strtoul(argv[len - 1], &endptr, 16);
+ if (errno != 0 || *endptr != '\0')
+ goto error;
if (argc != len + 1)
usage(argv[0]);
- val = strtoul(argv[len], NULL, 16);
+ errno = 0;
+ val = strtoul(argv[len], &endptr, 16);
+ if (errno != 0 || *endptr != '\0')
+ goto error;
reg_write(off, val);
printf(" Write reg=%x, value=%x\n", off, val);
} else if (argv[len - 2][0] == 'd') {
- off = strtoul(argv[len - 1], NULL, 16);
+ errno = 0;
+ off = strtoul(argv[len - 1], &endptr, 16);
+ if (errno != 0 || *endptr != '\0')
+ goto error;
for (i = 0; i < 16; i++) {
printf("0x%08x: ", off + 0x10 * i);
for (j = 0; j < 4; j++) {
- reg_read(off + i * 0x10 + j * 0x4,
- &val);
+ reg_read(off + i * 0x10 + j * 0x4, &val);
printf(" 0x%08x", val);
}
printf("\n");
@@ -456,6 +470,9 @@
usage(argv[0]);
} else
usage(argv[0]);
+ return;
+error:
+ printf("Error: string converting\n");
}
static int get_chip_name()
@@ -464,6 +481,12 @@
FILE *fp = NULL;
char buff[255];
+ /*judge an8855, must be placed before reg_read*/
+ if (air_skip_check_flag) {
+ temp = 0x8855;
+ return temp;
+ }
+
/*judge jaguar embedded switch */
fp = fopen("/proc/device-tree/compatible", "r");
if (fp != NULL) {
@@ -488,11 +511,6 @@
if (temp == 0x7531)
return temp;
- /*judge an8855 */
- reg_read(0x10005000, &temp);
- if (temp == 0x8855)
- return temp;
-
return -1;
}
@@ -622,7 +640,9 @@
int main(int argc, char *argv[])
{
- int err;
+ int err = -EINVAL;
+ FILE *fp = NULL;
+ char buff[255];
attres = (struct mt753x_attr *)malloc(sizeof(struct mt753x_attr));
if (attres == NULL) {
@@ -633,28 +653,35 @@
attres->port_num = -1;
attres->phy_dev = -1;
nl_init_flag = true;
+ air_skip_check_flag = false;
- /* dsa netlink family might not be enabled. Try gsw netlink family. */
- err = mt753x_netlink_init(MT753X_DSA_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
+ fp = fopen("/proc/air_sw/device", "r");
+ if (fp != NULL) {
+ if (fgets(buff, 255, (FILE *) fp) && strstr(buff, "an8855"))
+ air_skip_check_flag = true;
- if (err < 0) {
- err = mt753x_netlink_init(MT753X_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
- }
+ if ((fclose(fp) == 0) && air_skip_check_flag) {
+ err = mt753x_netlink_init(AN8855_DSA_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
- if (err < 0) {
- err = mt753x_netlink_init(AN8855_DSA_GENL_NAME);
+ if (err < 0) {
+ err = mt753x_netlink_init(AN8855_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
+ }
+ }
+ } else {
+ /* dsa netlink family might not be enabled. Try gsw netlink family. */
+ err = mt753x_netlink_init(MT753X_DSA_GENL_NAME);
if (!err)
chip_name = get_chip_name();
- }
- if (err < 0) {
- err = mt753x_netlink_init(AN8855_GENL_NAME);
- if (!err)
- chip_name = get_chip_name();
+ if (err < 0) {
+ err = mt753x_netlink_init(MT753X_GENL_NAME);
+ if (!err)
+ chip_name = get_chip_name();
+ }
}
if (err < 0) {