1
0
mirror of https://github.com/tonusoo/koduinternet-cpe synced 2025-12-17 15:45:11 +02:00

Initial commit

This commit is contained in:
Martin Tonusoo
2023-06-15 17:55:10 +03:00
commit bf4aa50b38
69 changed files with 3095 additions and 0 deletions

114
patches/bnx2x_link.patch Normal file
View File

@@ -0,0 +1,114 @@
--- bnx2x_link.c.orig 2023-01-08 22:05:36.052119774 +0200
+++ bnx2x_link.c 2023-01-22 15:28:31.938666110 +0200
@@ -151,6 +151,7 @@ typedef int (*read_sfp_module_eeprom_fun
#define SFP_EEPROM_CON_TYPE_ADDR 0x2
#define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0
+ #define SFP_EEPROM_CON_TYPE_VAL_SC 0x1
#define SFP_EEPROM_CON_TYPE_VAL_LC 0x7
#define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21
#define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22
@@ -196,6 +197,8 @@ typedef int (*read_sfp_module_eeprom_fun
#define DEFAULT_TX_DRV_POST2 3
#define DEFAULT_TX_DRV_IPRE_DRIVER 6
+int sfp_tx_fault_ignore = 0;
+
/**********************************************************/
/* INTERFACE */
/**********************************************************/
@@ -4210,6 +4213,15 @@ static void bnx2x_warpcore_set_sgmii_spe
0x1000);
DP(NETIF_MSG_LINK, "set SGMII AUTONEG\n");
} else {
+ /* Note that 2.5G works only when used with 1G advertisment */
+ if (fiber_mode &&
+ (phy->req_line_speed == SPEED_2500) &&
+ (phy->speed_cap_mask & (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
+
+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC1, 0x6010);
+
+ }
+
bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
MDIO_WC_REG_COMBO_IEEE0_MIICTRL, &val16);
val16 &= 0xcebf;
@@ -4220,6 +4232,7 @@ static void bnx2x_warpcore_set_sgmii_spe
val16 |= 0x2000;
break;
case SPEED_1000:
+ case SPEED_2500:
val16 |= 0x0040;
break;
default:
@@ -8173,6 +8186,7 @@ static int bnx2x_get_edc_mode(struct bnx
break;
}
case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN:
+ case SFP_EEPROM_CON_TYPE_VAL_SC:
case SFP_EEPROM_CON_TYPE_VAL_LC:
case SFP_EEPROM_CON_TYPE_VAL_RJ45:
check_limiting_mode = 1;
@@ -8183,7 +8197,8 @@ static int bnx2x_get_edc_mode(struct bnx
(val[SFP_EEPROM_1G_COMP_CODE_ADDR] != 0)) {
DP(NETIF_MSG_LINK, "1G SFP module detected\n");
phy->media_type = ETH_PHY_SFP_1G_FIBER;
- if (phy->req_line_speed != SPEED_1000) {
+ if ((phy->req_line_speed != SPEED_1000) &&
+ (phy->req_line_speed != SPEED_2500)) {
u8 gport = params->port;
phy->req_line_speed = SPEED_1000;
if (!CHIP_IS_E1x(bp)) {
@@ -8325,6 +8340,25 @@ static int bnx2x_verify_sfp_module(struc
netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected,"
" Port %d from %s part number %s\n",
params->port, vendor_name, vendor_pn);
+
+ /* While it is convenient, safe, avoids multiple
+ * EEPROM reads and works in case of HUAWEI
+ * MA5671A ONT as it's not an approved module,
+ * then this check should probably not be
+ * coupled with bnx2x_verify_sfp_module()
+ * function.
+ */
+ if (!memcmp(vendor_name, "HUAWEI ", 16) &&
+ !memcmp(vendor_pn, "MA5671A ", 16)) {
+
+ sfp_tx_fault_ignore = 1;
+
+ netdev_err(bp->dev, "Warning: Ignoring TX fault for transceiver "
+ " in port %d. Vendor: %s, part number: %s\n",
+ params->port, vendor_name, vendor_pn);
+
+ }
+
if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) !=
PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG)
phy->flags |= FLAGS_SFP_NOT_APPROVED;
@@ -11734,6 +11768,7 @@ static const struct bnx2x_phy phy_warpco
SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full |
SUPPORTED_1000baseKX_Full |
+ SUPPORTED_2500baseX_Full |
SUPPORTED_10000baseT_Full |
SUPPORTED_10000baseKR_Full |
SUPPORTED_20000baseKR2_Full |
@@ -12267,6 +12302,7 @@ static int bnx2x_populate_int_phy(struct
break;
case PORT_HW_CFG_NET_SERDES_IF_SFI:
phy->supported &= (SUPPORTED_1000baseT_Full |
+ SUPPORTED_2500baseX_Full |
SUPPORTED_10000baseT_Full |
SUPPORTED_FIBRE |
SUPPORTED_Pause |
@@ -13801,6 +13837,10 @@ static void bnx2x_sfp_tx_fault_detection
u32 cfg_pin, value = 0;
u8 led_change, port = params->port;
+ if (sfp_tx_fault_ignore) {
+ return;
+ }
+
/* Get The SFP+ TX_Fault controlling pin ([eg]pio) */
cfg_pin = (REG_RD(bp, params->shmem_base + offsetof(struct shmem_region,
dev_info.port_hw_config[port].e3_cmn_pin_cfg)) &

26
patches/igmpproxy.patch Normal file
View File

@@ -0,0 +1,26 @@
--- src/igmpproxy.c~ 2023-05-15 23:19:03.446584147 +0300
+++ src/igmpproxy.c 2023-05-15 23:20:55.125401534 +0300
@@ -263,7 +263,7 @@
int MaxFD, Rt, secs;
fd_set ReadFDS;
socklen_t dummy = 0;
- struct timespec curtime, lasttime, difftime, tv;
+ struct timespec curtime, lasttime, difftime, tv, pselect_timeout;
// The timeout is a pointer in order to set it to NULL if nessecary.
struct timespec *timeout = &tv;
@@ -306,8 +306,13 @@
FD_ZERO( &ReadFDS );
FD_SET( MRouterFD, &ReadFDS );
+ // https://github.com/pali/igmpproxy/issues/95
+ memcpy(&pselect_timeout, timeout, sizeof(struct timespec));
+ pselect_timeout.tv_sec *= 2;
+ my_log(LOG_DEBUG, 0, "Calling pselect() with %ld.%09ld seconds timeout", pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+
// wait for input
- Rt = pselect( MaxFD +1, &ReadFDS, NULL, NULL, timeout, NULL );
+ Rt = pselect( MaxFD +1, &ReadFDS, NULL, NULL, &pselect_timeout, NULL );
// log and ignore failures
if( Rt < 0 ) {