Mediatek:hnat add support for macvlan wan dev

This commit is contained in:
padavanonly 2023-12-11 21:33:41 +08:00 committed by hanwckf
parent 1c7a824799
commit b7ac35dbc6
3 changed files with 24 additions and 2 deletions

View File

@ -759,6 +759,7 @@ static int hnat_probe(struct platform_device *pdev)
hnat_priv->ipv6_en = true; /* enable ipv6 by default */
hnat_priv->guest_en = true; /* enable guest wifi by default */
hnat_priv->dscp_en = false;
hnat_priv->macvlan_support = false;
err = hnat_init_debugfs(hnat_priv);
if (err)
return err;

View File

@ -685,6 +685,7 @@ struct mtk_hnat {
bool ipv6_en;
bool guest_en;
bool dscp_en;
bool macvlan_support;
};
struct extdev_entry {
@ -853,8 +854,9 @@ enum FoeIpAct {
#define NR_WDMA1_PORT 9
#define LAN_DEV_NAME hnat_priv->lan
#define IS_WAN(dev) \
(!strncmp((dev)->name, hnat_priv->wan, strlen(hnat_priv->wan)))
#define IS_LAN(dev) (!strncmp(dev->name, LAN_DEV_NAME, strlen(LAN_DEV_NAME)))
((!strncmp((dev)->name, hnat_priv->wan, strlen(hnat_priv->wan))) || ((!strncmp((dev)->name, "macvlan", 7)) && \
(hnat_priv->macvlan_support)))
#define IS_LAN(dev) (!strncmp(dev->name, LAN_DEV_NAME, strlen(LAN_DEV_NAME)))
#define IS_BR(dev) (!strncmp(dev->name, "br", 2))
#define IS_WHNAT(dev) \
((hnat_priv->data->whnat && \

View File

@ -575,6 +575,7 @@ int cr_set_usage(int level)
pr_info(" 9 0~1 Set hnat disable/enable guest (rax1/ra1)\n");
pr_info(" 10 0~1 Set hnat disable/enable dscp setting\n");
pr_info(" 11 1~30 Set hnat band rate\n");
pr_info(" 12 0~1 Set hnat macvlan support mode\n");
return 0;
}
@ -738,6 +739,22 @@ int bind_rate_setting(int bind_rate)
return 0;
}
int set_macvlan_support(int toggle)
{
struct mtk_hnat *h = hnat_priv;
if (toggle == 1)
pr_info("Enable macvlan support\n");
else if (toggle == 0)
pr_info("Disable macvlan support\n");
else {
pr_info("input error, current macvlan support setting=%d\n", h->macvlan_support);
return 0;
}
h->macvlan_support = toggle;
return 0;
}
void mtk_ppe_dev_hook(const char *name, int toggle)
{
@ -793,6 +810,7 @@ static const debugfs_write_func cr_set_func[] = {
[6] = udp_keep_alive, [7] = set_nf_update_toggle,
[8] = set_ipv6_toggle, [9] = set_guest_toggle,
[10] = set_dscp_toggle, [11] = bind_rate_setting,
[12] = set_macvlan_support,
};
int read_mib(struct mtk_hnat *h, u32 ppe_id,
@ -1572,6 +1590,7 @@ ssize_t hnat_setting_write(struct file *file, const char __user *buffer,
case 9:
case 10:
case 11:
case 12:
p_token = strsep(&p_buf, p_delimiter);
if (!p_token)
arg1 = 0;