ramips: update upsteam patch

This commit is contained in:
coolsnowwolf 2019-04-15 22:15:19 +08:00
parent 1933bc8bfa
commit 8db5e2cc02
2 changed files with 21 additions and 20 deletions

View File

@ -119,11 +119,11 @@ mtk_foe_set_mac(struct mtk_foe_entry *entry, u8 *smac, u8 *dmac)
} }
static int 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]; 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 static void
@ -157,6 +157,12 @@ int mtk_flow_offload(struct mtk_eth *eth,
if (otuple->l4proto != IPPROTO_TCP && otuple->l4proto != IPPROTO_UDP) if (otuple->l4proto != IPPROTO_TCP && otuple->l4proto != IPPROTO_UDP)
return -EINVAL; return -EINVAL;
if (type == FLOW_OFFLOAD_DEL) {
flow = NULL;
synchronize_rcu();
return 0;
}
switch (otuple->l3proto) { switch (otuple->l3proto) {
case AF_INET: case AF_INET:
if (mtk_foe_prepare_v4(&orig, otuple, rtuple, src, dest) || if (mtk_foe_prepare_v4(&orig, otuple, rtuple, src, dest) ||
@ -174,30 +180,25 @@ int mtk_flow_offload(struct mtk_eth *eth,
return -EINVAL; return -EINVAL;
} }
if (type == FLOW_OFFLOAD_DEL) { /* Two-way hash: when hash collision occurs, the hash value will be shifted to the next position. */
orig.bfib1.state = INVALID; if (!mtk_check_entry_available(eth, ohash)){
reply.bfib1.state = INVALID; if (!mtk_check_entry_available(eth, ohash + 1))
flow = NULL; return -EINVAL;
goto write; 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(&orig, dest->eth_src, dest->eth_dest);
mtk_foe_set_mac(&reply, src->eth_src, src->eth_dest); mtk_foe_set_mac(&reply, src->eth_src, src->eth_dest);
write:
mtk_foe_write(eth, ohash, &orig); mtk_foe_write(eth, ohash, &orig);
mtk_foe_write(eth, rhash, &reply); mtk_foe_write(eth, rhash, &reply);
rcu_assign_pointer(eth->foe_flow_table[ohash], flow); rcu_assign_pointer(eth->foe_flow_table[ohash], flow);
rcu_assign_pointer(eth->foe_flow_table[rhash], flow); rcu_assign_pointer(eth->foe_flow_table[rhash], flow);
if (type == FLOW_OFFLOAD_DEL)
synchronize_rcu();
return 0; return 0;
} }
@ -383,8 +384,8 @@ static int mtk_ppe_start(struct mtk_eth *eth)
mtk_w32(eth, 0x55555555, MTK_REG_PPE_DFT_CPORT); mtk_w32(eth, 0x55555555, MTK_REG_PPE_DFT_CPORT);
#endif #endif
/* drop packets with TTL=0 */ /* allow packets with TTL=0 */
mtk_m32(eth, 0, MTK_PPE_GLO_CFG_TTL0_DROP, MTK_REG_PPE_GLO_CFG); mtk_m32(eth, MTK_PPE_GLO_CFG_TTL0_DROP, 0, MTK_REG_PPE_GLO_CFG);
/* send all traffic from gmac to the ppe */ /* send all traffic from gmac to the ppe */
mtk_m32(eth, 0xffff, 0x4444, MTK_GDMA_FWD_CFG(0)); mtk_m32(eth, 0xffff, 0x4444, MTK_GDMA_FWD_CFG(0));

View File

@ -116,7 +116,7 @@ $(eval $(call KernelPackage,hsdma-mtk))
define KernelPackage/sound-mt7620 define KernelPackage/sound-mt7620
TITLE:=MT7620 PCM/I2S Alsa Driver 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:= \ KCONFIG:= \
CONFIG_SND_RALINK_SOC_I2S \ CONFIG_SND_RALINK_SOC_I2S \
CONFIG_SND_SIMPLE_CARD \ CONFIG_SND_SIMPLE_CARD \