diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h index 1126d082eb..469246f0f8 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h @@ -737,6 +737,7 @@ struct rtl838x_l2_entry { bool is_local_forward:1; bool is_remote_forward:1; bool is_l2_tunnel:1; + bool hash_msb:1; int l2_tunnel_id; int l2_tunnel_list_id; }; diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c index 27dd999840..28602151c0 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c @@ -558,6 +558,7 @@ static void rtl931x_fill_l2_row(u32 r[], struct rtl838x_l2_entry *e) r[0] |= e->is_open_flow ? BIT(30) : 0; r[0] |= e->is_pe_forward ? BIT(29) : 0; + r[0] |= e->hash_msb ? BIT(28): 0; r[2] = e->next_hop ? BIT(30) : 0; r[0] |= (e->rvid & 0xfff) << 16; @@ -675,11 +676,22 @@ static void rtl931x_write_l2_entry_using_hash(u32 hash, u32 pos, struct rtl838x_ u32 r[4]; struct table_reg *q = rtl_table_get(RTL9310_TBL_0, 0); u32 idx = (0 << 14) | (hash << 2) | pos; /* Access SRAM, with hash and at pos in bucket */ + int hash_algo_id; pr_debug("%s: hash %d, pos %d\n", __func__, hash, pos); pr_debug("%s: index %d -> mac %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, idx, e->mac[0], e->mac[1], e->mac[2], e->mac[3],e->mac[4],e->mac[5]); + if (idx < 0x4000) + hash_algo_id = sw_r32(RTL931X_L2_CTRL) & BIT(0); + else + hash_algo_id = (sw_r32(RTL931X_L2_CTRL) & BIT(1)) >> 1; + + if (hash_algo_id == 0) + e->hash_msb = (e->rvid >> 2) & 0x1; + else + e->hash_msb = (e->rvid >> 11) & 0x1; + rtl931x_fill_l2_row(r, e); pr_debug("%s: %d: %08x %08x %08x\n", __func__, idx, r[0], r[1], r[2]);