This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VH-Q1: linux native driver cpsw9g ALE setting

Part Number: TDA4VH-Q1

Dear ti,

We use the linux SDK 0805 linux native driver to test eth, we want to set the ALE VLAN entry in linux, 

Is this supported?

We see that there are the examples of “Adding a multicast entry for A72” and “Adding a VLAN entry for A72 only for Port 1”

 in RTOS [FAQ] TDA4VM: How to Configure CPSW 5G/9G ALE - Processors forum - Processors - TI E2E support forums

, can Linux operate according to the same setting?

we found the below linux API, Can these APIs be used to set up? Are there any examples of this

int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask,
int flags, u16 vid, int mcast_state)
{
u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
int idx, mask;

idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0);
if (idx >= 0)
½ cpsw_ale_read(ale, idx, ale_entry);

cpsw_ale_set_vlan_entry_type(ale_entry, flags, vid);

cpsw_ale_set_addr(ale_entry, addr);
cpsw_ale_set_super(ale_entry, (flags & ALE_SUPER) ? 1 : 0);
cpsw_ale_set_mcast_state(ale_entry, mcast_state);

mask = cpsw_ale_get_port_mask(ale_entry,
ale->port_mask_bits);
port_mask |= mask;
cpsw_ale_set_port_mask(ale_entry, port_mask,
ale->port_mask_bits);

if (idx < 0)
idx = cpsw_ale_match_free(ale);
if (idx < 0)
idx = cpsw_ale_find_ageable(ale);
if (idx < 0)
return -ENOMEM;

cpsw_ale_write(ale, idx, ale_entry);
return 0;
}

int cpsw_ale_add_ucast(struct cpsw_ale *ale, const u8 *addr, int port,
int flags, u16 vid)
{
u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
int idx;

cpsw_ale_set_vlan_entry_type(ale_entry, flags, vid);

cpsw_ale_set_addr(ale_entry, addr);
cpsw_ale_set_ucast_type(ale_entry, ALE_UCAST_PERSISTANT);
cpsw_ale_set_secure(ale_entry, (flags & ALE_SECURE) ? 1 : 0);
cpsw_ale_set_blocked(ale_entry, (flags & ALE_BLOCKED) ? 1 : 0);
cpsw_ale_set_port_num(ale_entry, port, ale->port_num_bits);

idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0);
if (idx < 0)
idx = cpsw_ale_match_free(ale);
if (idx < 0)
idx = cpsw_ale_find_ageable(ale);
if (idx < 0)
return -ENOMEM;

cpsw_ale_write(ale, idx, ale_entry);
return 0;
}

int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port_mask, int untag,
int reg_mcast, int unreg_mcast)
{
u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
int idx;

idx = cpsw_ale_match_vlan(ale, vid);
if (idx >= 0)
cpsw_ale_read(ale, idx, ale_entry);

cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_VLAN);
cpsw_ale_set_vlan_id(ale_entry, vid);
cpsw_ale_set_vlan_untag(ale, ale_entry, vid, untag);

if (!ale->params.nu_switch_ale) {
cpsw_ale_vlan_set_fld(ale, ale_entry,
ALE_ENT_VID_REG_MCAST_MSK, reg_mcast);
cpsw_ale_vlan_set_fld(ale, ale_entry,
ALE_ENT_VID_UNREG_MCAST_MSK, unreg_mcast);
} else {
cpsw_ale_vlan_set_fld(ale, ale_entry,
ALE_ENT_VID_UNREG_MCAST_IDX,
NU_VLAN_UNREG_MCAST_IDX);
cpsw_ale_set_vlan_mcast(ale, ale_entry, reg_mcast, unreg_mcast);
}

cpsw_ale_vlan_set_fld(ale, ale_entry,
ALE_ENT_VID_MEMBER_LIST, port_mask);

if (idx < 0)
idx = cpsw_ale_match_free(ale);
if (idx < 0)
idx = cpsw_ale_find_ageable(ale);
if (idx < 0)
return -ENOMEM;

cpsw_ale_write(ale, idx, ale_entry);
return 0;
}