From 8db5e2cc0213757fb643a9f810c61212d8d9a1cb Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Mon, 15 Apr 2019 22:15:19 +0800 Subject: [PATCH] ramips: update upsteam patch --- .../net/ethernet/mediatek/mtk_offload.c | 39 ++++++++++--------- target/linux/ramips/modules.mk | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c index 6e814ad72..6c23bbc03 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c @@ -119,11 +119,11 @@ mtk_foe_set_mac(struct mtk_foe_entry *entry, u8 *smac, u8 *dmac) } static int -mtk_check_hashcollision(struct mtk_eth *eth, u32 hash) +mtk_check_entry_available(struct mtk_eth *eth, u32 hash) { struct mtk_foe_entry entry = ((struct mtk_foe_entry *)eth->foe_table)[hash]; - return (entry.bfib1.state != BIND)? 0:1; + return (entry.bfib1.state == BIND)? 0:1; } static void @@ -156,6 +156,12 @@ int mtk_flow_offload(struct mtk_eth *eth, if (otuple->l4proto != IPPROTO_TCP && otuple->l4proto != IPPROTO_UDP) return -EINVAL; + + if (type == FLOW_OFFLOAD_DEL) { + flow = NULL; + synchronize_rcu(); + return 0; + } switch (otuple->l3proto) { case AF_INET: @@ -174,30 +180,25 @@ int mtk_flow_offload(struct mtk_eth *eth, return -EINVAL; } - if (type == FLOW_OFFLOAD_DEL) { - orig.bfib1.state = INVALID; - reply.bfib1.state = INVALID; - flow = NULL; - goto write; + /* Two-way hash: when hash collision occurs, the hash value will be shifted to the next position. */ + if (!mtk_check_entry_available(eth, ohash)){ + if (!mtk_check_entry_available(eth, ohash + 1)) + return -EINVAL; + ohash += 1; + } + if (!mtk_check_entry_available(eth, rhash)){ + if (!mtk_check_entry_available(eth, rhash + 1)) + return -EINVAL; + rhash += 1; } - /* Two-way hash: when hash collision occurs, the hash value will be shifted to the next position. */ - if(mtk_check_hashcollision(eth, ohash)) - ohash += 1; - if(mtk_check_hashcollision(eth, rhash)) - rhash += 1; mtk_foe_set_mac(&orig, dest->eth_src, dest->eth_dest); mtk_foe_set_mac(&reply, src->eth_src, src->eth_dest); - -write: mtk_foe_write(eth, ohash, &orig); mtk_foe_write(eth, rhash, &reply); rcu_assign_pointer(eth->foe_flow_table[ohash], flow); rcu_assign_pointer(eth->foe_flow_table[rhash], flow); - if (type == FLOW_OFFLOAD_DEL) - synchronize_rcu(); - return 0; } @@ -383,8 +384,8 @@ static int mtk_ppe_start(struct mtk_eth *eth) mtk_w32(eth, 0x55555555, MTK_REG_PPE_DFT_CPORT); #endif - /* drop packets with TTL=0 */ - mtk_m32(eth, 0, MTK_PPE_GLO_CFG_TTL0_DROP, MTK_REG_PPE_GLO_CFG); + /* allow packets with TTL=0 */ + mtk_m32(eth, MTK_PPE_GLO_CFG_TTL0_DROP, 0, MTK_REG_PPE_GLO_CFG); /* send all traffic from gmac to the ppe */ mtk_m32(eth, 0xffff, 0x4444, MTK_GDMA_FWD_CFG(0)); diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index 88e83a487..b604110b1 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -116,7 +116,7 @@ $(eval $(call KernelPackage,hsdma-mtk)) define KernelPackage/sound-mt7620 TITLE:=MT7620 PCM/I2S Alsa Driver - DEPENDS:=@TARGET_ramips +kmod-sound-soc-core +kmod-regmap +kmod-dma-ralink @!TARGET_ramips_rt288x + DEPENDS:=@TARGET_ramips +kmod-sound-soc-core +kmod-regmap-i2c +kmod-dma-ralink @!TARGET_ramips_rt288x KCONFIG:= \ CONFIG_SND_RALINK_SOC_I2S \ CONFIG_SND_SIMPLE_CARD \