diff --git a/include/osi_common.h b/include/osi_common.h index 6e312b1..0bbf743 100644 --- a/include/osi_common.h +++ b/include/osi_common.h @@ -64,6 +64,9 @@ #define OSI_HASH_FILTER_MODE 1U #define OSI_PERFECT_FILTER_MODE 0U +#define OSI_IPV6_MATCH 1U +#define OSI_SOURCE_MATCH 0U + #define OSI_L4_FILTER_TCP 0U #define OSI_L4_FILTER_UDP 1U diff --git a/include/osi_core.h b/include/osi_core.h index fef16ba..6f5af66 100644 --- a/include/osi_core.h +++ b/include/osi_core.h @@ -81,7 +81,7 @@ struct osi_vlan_filter { /** * Struct osi_l2_da_filter - L2 filter function depedent parameter * @perfect_hash: perfect(0) or hash(1) - * @perfect_inverse_match: perfect(0) or hash(1) + * @perfect_inverse_match: perfect(0) or inverse(1) */ struct osi_l2_da_filter { unsigned int perfect_hash; @@ -781,7 +781,7 @@ int osi_config_l2_da_perfect_inverse_match(struct osi_core_priv_data *osi_core, unsigned int perfect_inverse_match); /** - * osi_update_vlan_id - invoke osi call to get VLAn ID + * osi_update_vlan_id - invoke osi call to update VLAN ID * * @osi_core: OSI private data structure. * @vid: VLAN ID diff --git a/osi/core/eqos_core.c b/osi/core/eqos_core.c index 7dcca11..d8b810e 100644 --- a/osi/core/eqos_core.c +++ b/osi/core/eqos_core.c @@ -1701,6 +1701,7 @@ static int eqos_config_l2_da_perfect_inverse_match(void *base, unsigned int * @osi_core: OSI private data structure. * @filter_no: filter index * @addr: ipv4 address + * @src_dst_addr_match: 0 - source addr otherwise - dest addr * * Algorithm: This sequence is used to update IPv4 source/destination * Address for L3 layer filtering @@ -1727,12 +1728,6 @@ static int eqos_update_ip4_addr(struct osi_core_priv_data *osi_core, return -1; } - if (src_dst_addr_match != 0U && src_dst_addr_match != 1U) { - osd_err(osi_core->osd, "invalid src_dst_addr_match %d parameter\n" - , src_dst_addr_match); - return -1; - } - value = addr[3]; temp = (unsigned int)addr[2] << 8; value |= temp; @@ -1740,7 +1735,7 @@ static int eqos_update_ip4_addr(struct osi_core_priv_data *osi_core, value |= temp; temp = (unsigned int)addr[0] << 24; value |= temp; - if (src_dst_addr_match == 0U) { + if (src_dst_addr_match == OSI_SOURCE_MATCH) { osi_writel(value, (unsigned char *)base + EQOS_MAC_L3_AD0R(filter_no)); } else { @@ -1843,7 +1838,7 @@ static int eqos_update_l4_port_no(struct osi_core_priv_data *osi_core, } value = osi_readl((unsigned char *)base + EQOS_MAC_L4_ADR(filter_no)); - if (src_dst_port_match == 0U) { + if (src_dst_port_match == OSI_SOURCE_MATCH) { value &= ~EQOS_MAC_L4_SP_MASK; value |= ((unsigned int)port_no & EQOS_MAC_L4_SP_MASK); } else { @@ -1900,9 +1895,9 @@ static int eqos_config_l3_filters(struct osi_core_priv_data *osi_core, EQOS_MAC_L3L4_CTR(filter_no)); /* For IPv6 either SA/DA can be checked not both */ - if (ipv4_ipv6_match == 1U) { - if (enb_dis == 1U) { - if (src_dst_addr_match == 0U) { + if (ipv4_ipv6_match == OSI_IPV6_MATCH) { + if (enb_dis == OSI_ENABLE) { + if (src_dst_addr_match == OSI_SOURCE_MATCH) { /* Enable L3 filters for IPv6 SOURCE addr * matching */ @@ -1944,8 +1939,8 @@ static int eqos_config_l3_filters(struct osi_core_priv_data *osi_core, EQOS_MAC_L3L4_CTR(filter_no)); } } else { - if (src_dst_addr_match == 0U) { - if (enb_dis == 1U) { + if (src_dst_addr_match == OSI_SOURCE_MATCH) { + if (enb_dis == OSI_ENABLE) { /* Enable L3 filters for IPv4 SOURCE addr * matching */ @@ -1972,7 +1967,7 @@ static int eqos_config_l3_filters(struct osi_core_priv_data *osi_core, EQOS_MAC_L3L4_CTR(filter_no)); } } else { - if (enb_dis == 1U) { + if (enb_dis == OSI_ENABLE) { /* Enable L3 filters for IPv4 DESTINATION addr * matching */ @@ -2046,8 +2041,8 @@ static int eqos_config_l4_filters(struct osi_core_priv_data *osi_core, osi_writel(value, (unsigned char *)base + EQOS_MAC_L3L4_CTR(filter_no)); - if (src_dst_port_match == 0U) { - if (enb_dis == 1U) { + if (src_dst_port_match == OSI_SOURCE_MATCH) { + if (enb_dis == OSI_ENABLE) { /* Enable L4 filters for SOURCE Port No matching */ value = osi_readl((unsigned char *)base + EQOS_MAC_L3L4_CTR(filter_no)); @@ -2070,7 +2065,7 @@ static int eqos_config_l4_filters(struct osi_core_priv_data *osi_core, EQOS_MAC_L3L4_CTR(filter_no)); } } else { - if (enb_dis == 1U) { + if (enb_dis == OSI_ENABLE) { /* Enable L4 filters for DESTINATION port No * matching */ @@ -2144,7 +2139,7 @@ static int eqos_config_vlan_filtering(struct osi_core_priv_data *osi_core, } /** - * eqos_update_vlan_id - + * eqos_update_vlan_id - update VLAN ID in Tag register * * @base: Base address from OSI private data structure. *