Message ID | 20240813074233.2473876-8-danishanwar@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Introduce HSR offload support for ICSSG | expand |
On 13/08/2024 10:42, MD Danish Anwar wrote: > From: Ravi Gunasekaran <r-gunasekaran@ti.com> > > Add support to offload HSR Tx Tag Insertion and Rx Tag Removal > and duplicate discard. I can see code for Tx Tag insertion and RX tag removal. Where are you doing duplicate discard in this patch? > > Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> > --- > drivers/net/ethernet/ti/icssg/icssg_common.c | 3 +++ > drivers/net/ethernet/ti/icssg/icssg_config.c | 4 +++- > drivers/net/ethernet/ti/icssg/icssg_config.h | 2 ++ > drivers/net/ethernet/ti/icssg/icssg_prueth.c | 11 ++++++++++- > drivers/net/ethernet/ti/icssg/icssg_prueth.h | 1 + > 5 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c > index 2d6d8648f5a9..4eae4f9250c0 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_common.c > +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c > @@ -721,6 +721,9 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev > if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_DUP)) > dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG; > > + if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_TAG_INS)) > + epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS; > + > cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id); > k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma); > cppi5_hdesc_attach_buf(first_desc, buf_dma, pkt_len, buf_dma, pkt_len); > diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c > index 2f485318c940..f061fa97a377 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_config.c > +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c > @@ -531,7 +531,9 @@ static const struct icssg_r30_cmd emac_r32_bitmask[] = { > {{EMAC_NONE, 0xffff4000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx ENABLE*/ > {{EMAC_NONE, 0xbfff0000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx DISABLE*/ > {{0xffff0010, EMAC_NONE, 0xffff0010, EMAC_NONE}}, /* VLAN AWARE*/ > - {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}} /* VLAN UNWARE*/ > + {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}}, /* VLAN UNWARE*/ > + {{0xffff2000, EMAC_NONE, EMAC_NONE, EMAC_NONE}}, /* HSR_RX_OFFLOAD_ENABLE */ > + {{0xdfff0000, EMAC_NONE, EMAC_NONE, EMAC_NONE}} /* HSR_RX_OFFLOAD_DISABLE */ > }; > > int icssg_set_port_state(struct prueth_emac *emac, > diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h > index 1ac60283923b..92c2deaa3068 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_config.h > +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h > @@ -80,6 +80,8 @@ enum icssg_port_state_cmd { > ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, > ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, > ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, > + ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, > + ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE, > ICSSG_EMAC_PORT_MAX_COMMANDS > }; > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c > index 521e9f914459..582e72dd8f3f 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c > +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c > @@ -42,7 +42,9 @@ > #define DEFAULT_UNTAG_MASK 1 > > #define NETIF_PRUETH_HSR_OFFLOAD (NETIF_F_HW_HSR_FWD | \ > - NETIF_F_HW_HSR_DUP) > + NETIF_F_HW_HSR_DUP | \ > + NETIF_F_HW_HSR_TAG_INS | \ > + NETIF_F_HW_HSR_TAG_RM) > > /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ > #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) > @@ -1032,6 +1034,13 @@ static void icssg_change_mode(struct prueth *prueth) > > for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { > emac = prueth->emac[mac]; > + if (prueth->is_hsr_offload_mode) { > + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) > + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); > + else > + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); > + } > + > if (netif_running(emac->ndev)) { > icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, > ICSSG_FDB_ENTRY_P0_MEMBERSHIP | > diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h > index 6cb1dce8b309..246f1e41c13a 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h > +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h > @@ -58,6 +58,7 @@ > #define IEP_DEFAULT_CYCLE_TIME_NS 1000000 /* 1 ms */ > > #define PRUETH_UNDIRECTED_PKT_DST_TAG 0 > +#define PRUETH_UNDIRECTED_PKT_TAG_INS BIT(30) > > /* Firmware status codes */ > #define ICSS_HS_FW_READY 0x55555555
On 21/08/24 5:45 pm, Roger Quadros wrote: > > > On 13/08/2024 10:42, MD Danish Anwar wrote: >> From: Ravi Gunasekaran <r-gunasekaran@ti.com> >> >> Add support to offload HSR Tx Tag Insertion and Rx Tag Removal >> and duplicate discard. > > I can see code for Tx Tag insertion and RX tag removal. > Where are you doing duplicate discard in this patch? > Roger, duplicate discard is done as part of RX tag removal and it is done by firmware. When driver sends the command ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, firmware does RX tag removal as well as duplicate discard. Maybe I can modify the commit message to stated that duplicate discard is done as part of rx tag removal? >> >> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> >> --- >> drivers/net/ethernet/ti/icssg/icssg_common.c | 3 +++ >> drivers/net/ethernet/ti/icssg/icssg_config.c | 4 +++- >> drivers/net/ethernet/ti/icssg/icssg_config.h | 2 ++ >> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 11 ++++++++++- >> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 1 + >> 5 files changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c >> index 2d6d8648f5a9..4eae4f9250c0 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_common.c >> +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c >> @@ -721,6 +721,9 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev >> if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_DUP)) >> dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG; >> >> + if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_TAG_INS)) >> + epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS; >> + >> cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id); >> k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma); >> cppi5_hdesc_attach_buf(first_desc, buf_dma, pkt_len, buf_dma, pkt_len); >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c >> index 2f485318c940..f061fa97a377 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_config.c >> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c >> @@ -531,7 +531,9 @@ static const struct icssg_r30_cmd emac_r32_bitmask[] = { >> {{EMAC_NONE, 0xffff4000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx ENABLE*/ >> {{EMAC_NONE, 0xbfff0000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx DISABLE*/ >> {{0xffff0010, EMAC_NONE, 0xffff0010, EMAC_NONE}}, /* VLAN AWARE*/ >> - {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}} /* VLAN UNWARE*/ >> + {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}}, /* VLAN UNWARE*/ >> + {{0xffff2000, EMAC_NONE, EMAC_NONE, EMAC_NONE}}, /* HSR_RX_OFFLOAD_ENABLE */ >> + {{0xdfff0000, EMAC_NONE, EMAC_NONE, EMAC_NONE}} /* HSR_RX_OFFLOAD_DISABLE */ >> }; >> >> int icssg_set_port_state(struct prueth_emac *emac, >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h >> index 1ac60283923b..92c2deaa3068 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_config.h >> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h >> @@ -80,6 +80,8 @@ enum icssg_port_state_cmd { >> ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, >> ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, >> ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, >> + ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, >> + ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE, >> ICSSG_EMAC_PORT_MAX_COMMANDS >> }; >> >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> index 521e9f914459..582e72dd8f3f 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> @@ -42,7 +42,9 @@ >> #define DEFAULT_UNTAG_MASK 1 >> >> #define NETIF_PRUETH_HSR_OFFLOAD (NETIF_F_HW_HSR_FWD | \ >> - NETIF_F_HW_HSR_DUP) >> + NETIF_F_HW_HSR_DUP | \ >> + NETIF_F_HW_HSR_TAG_INS | \ >> + NETIF_F_HW_HSR_TAG_RM) >> >> /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ >> #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) >> @@ -1032,6 +1034,13 @@ static void icssg_change_mode(struct prueth *prueth) >> >> for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { >> emac = prueth->emac[mac]; >> + if (prueth->is_hsr_offload_mode) { >> + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) >> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); Duplicate discard is done here ^^^^ >> + else >> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); >> + } >> + >> if (netif_running(emac->ndev)) { >> icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, >> ICSSG_FDB_ENTRY_P0_MEMBERSHIP | >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >> index 6cb1dce8b309..246f1e41c13a 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h >> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >> @@ -58,6 +58,7 @@ >> #define IEP_DEFAULT_CYCLE_TIME_NS 1000000 /* 1 ms */ >> >> #define PRUETH_UNDIRECTED_PKT_DST_TAG 0 >> +#define PRUETH_UNDIRECTED_PKT_TAG_INS BIT(30) >> >> /* Firmware status codes */ >> #define ICSS_HS_FW_READY 0x55555555 >
On 22/08/2024 11:03, MD Danish Anwar wrote: > > > On 21/08/24 5:45 pm, Roger Quadros wrote: >> >> >> On 13/08/2024 10:42, MD Danish Anwar wrote: >>> From: Ravi Gunasekaran <r-gunasekaran@ti.com> >>> >>> Add support to offload HSR Tx Tag Insertion and Rx Tag Removal >>> and duplicate discard. >> >> I can see code for Tx Tag insertion and RX tag removal. >> Where are you doing duplicate discard in this patch? >> > > Roger, duplicate discard is done as part of RX tag removal and it is > done by firmware. > When driver sends the command ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, firmware > does RX tag removal as well as duplicate discard. > > Maybe I can modify the commit message to stated that duplicate discard > is done as part of rx tag removal? Yes please, that will help. Thanks! > >>> >>> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> >>> --- >>> drivers/net/ethernet/ti/icssg/icssg_common.c | 3 +++ >>> drivers/net/ethernet/ti/icssg/icssg_config.c | 4 +++- >>> drivers/net/ethernet/ti/icssg/icssg_config.h | 2 ++ >>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 11 ++++++++++- >>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 1 + >>> 5 files changed, 19 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c >>> index 2d6d8648f5a9..4eae4f9250c0 100644 >>> --- a/drivers/net/ethernet/ti/icssg/icssg_common.c >>> +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c >>> @@ -721,6 +721,9 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev >>> if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_DUP)) >>> dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG; >>> >>> + if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_TAG_INS)) >>> + epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS; >>> + >>> cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id); >>> k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma); >>> cppi5_hdesc_attach_buf(first_desc, buf_dma, pkt_len, buf_dma, pkt_len); >>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c >>> index 2f485318c940..f061fa97a377 100644 >>> --- a/drivers/net/ethernet/ti/icssg/icssg_config.c >>> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c >>> @@ -531,7 +531,9 @@ static const struct icssg_r30_cmd emac_r32_bitmask[] = { >>> {{EMAC_NONE, 0xffff4000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx ENABLE*/ >>> {{EMAC_NONE, 0xbfff0000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx DISABLE*/ >>> {{0xffff0010, EMAC_NONE, 0xffff0010, EMAC_NONE}}, /* VLAN AWARE*/ >>> - {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}} /* VLAN UNWARE*/ >>> + {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}}, /* VLAN UNWARE*/ >>> + {{0xffff2000, EMAC_NONE, EMAC_NONE, EMAC_NONE}}, /* HSR_RX_OFFLOAD_ENABLE */ >>> + {{0xdfff0000, EMAC_NONE, EMAC_NONE, EMAC_NONE}} /* HSR_RX_OFFLOAD_DISABLE */ >>> }; >>> >>> int icssg_set_port_state(struct prueth_emac *emac, >>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h >>> index 1ac60283923b..92c2deaa3068 100644 >>> --- a/drivers/net/ethernet/ti/icssg/icssg_config.h >>> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h >>> @@ -80,6 +80,8 @@ enum icssg_port_state_cmd { >>> ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, >>> ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, >>> ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, >>> + ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, >>> + ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE, >>> ICSSG_EMAC_PORT_MAX_COMMANDS >>> }; >>> >>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>> index 521e9f914459..582e72dd8f3f 100644 >>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>> @@ -42,7 +42,9 @@ >>> #define DEFAULT_UNTAG_MASK 1 >>> >>> #define NETIF_PRUETH_HSR_OFFLOAD (NETIF_F_HW_HSR_FWD | \ >>> - NETIF_F_HW_HSR_DUP) >>> + NETIF_F_HW_HSR_DUP | \ >>> + NETIF_F_HW_HSR_TAG_INS | \ >>> + NETIF_F_HW_HSR_TAG_RM) >>> >>> /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ >>> #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) >>> @@ -1032,6 +1034,13 @@ static void icssg_change_mode(struct prueth *prueth) >>> >>> for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { >>> emac = prueth->emac[mac]; >>> + if (prueth->is_hsr_offload_mode) { >>> + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) >>> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); > > Duplicate discard is done here ^^^^ Got it. > >>> + else >>> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); >>> + } >>> + >>> if (netif_running(emac->ndev)) { >>> icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, >>> ICSSG_FDB_ENTRY_P0_MEMBERSHIP | >>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>> index 6cb1dce8b309..246f1e41c13a 100644 >>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>> @@ -58,6 +58,7 @@ >>> #define IEP_DEFAULT_CYCLE_TIME_NS 1000000 /* 1 ms */ >>> >>> #define PRUETH_UNDIRECTED_PKT_DST_TAG 0 >>> +#define PRUETH_UNDIRECTED_PKT_TAG_INS BIT(30) >>> >>> /* Firmware status codes */ >>> #define ICSS_HS_FW_READY 0x55555555 >> >
On 8/22/2024 4:58 PM, Roger Quadros wrote: > > > On 22/08/2024 11:03, MD Danish Anwar wrote: >> >> >> On 21/08/24 5:45 pm, Roger Quadros wrote: >>> >>> >>> On 13/08/2024 10:42, MD Danish Anwar wrote: >>>> From: Ravi Gunasekaran <r-gunasekaran@ti.com> >>>> >>>> Add support to offload HSR Tx Tag Insertion and Rx Tag Removal >>>> and duplicate discard. >>> >>> I can see code for Tx Tag insertion and RX tag removal. >>> Where are you doing duplicate discard in this patch? >>> >> >> Roger, duplicate discard is done as part of RX tag removal and it is >> done by firmware. >> When driver sends the command ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, firmware >> does RX tag removal as well as duplicate discard. >> >> Maybe I can modify the commit message to stated that duplicate discard >> is done as part of rx tag removal? > > Yes please, that will help. Thanks! > Sure Roger, will do. >> >>>> >>>> Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> >>>> --- >>>> drivers/net/ethernet/ti/icssg/icssg_common.c | 3 +++ >>>> drivers/net/ethernet/ti/icssg/icssg_config.c | 4 +++- >>>> drivers/net/ethernet/ti/icssg/icssg_config.h | 2 ++ >>>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 11 ++++++++++- >>>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 1 + >>>> 5 files changed, 19 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c >>>> index 2d6d8648f5a9..4eae4f9250c0 100644 >>>> --- a/drivers/net/ethernet/ti/icssg/icssg_common.c >>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c >>>> @@ -721,6 +721,9 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev >>>> if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_DUP)) >>>> dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG; >>>> >>>> + if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_TAG_INS)) >>>> + epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS; >>>> + >>>> cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id); >>>> k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma); >>>> cppi5_hdesc_attach_buf(first_desc, buf_dma, pkt_len, buf_dma, pkt_len); >>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c >>>> index 2f485318c940..f061fa97a377 100644 >>>> --- a/drivers/net/ethernet/ti/icssg/icssg_config.c >>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c >>>> @@ -531,7 +531,9 @@ static const struct icssg_r30_cmd emac_r32_bitmask[] = { >>>> {{EMAC_NONE, 0xffff4000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx ENABLE*/ >>>> {{EMAC_NONE, 0xbfff0000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx DISABLE*/ >>>> {{0xffff0010, EMAC_NONE, 0xffff0010, EMAC_NONE}}, /* VLAN AWARE*/ >>>> - {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}} /* VLAN UNWARE*/ >>>> + {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}}, /* VLAN UNWARE*/ >>>> + {{0xffff2000, EMAC_NONE, EMAC_NONE, EMAC_NONE}}, /* HSR_RX_OFFLOAD_ENABLE */ >>>> + {{0xdfff0000, EMAC_NONE, EMAC_NONE, EMAC_NONE}} /* HSR_RX_OFFLOAD_DISABLE */ >>>> }; >>>> >>>> int icssg_set_port_state(struct prueth_emac *emac, >>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h >>>> index 1ac60283923b..92c2deaa3068 100644 >>>> --- a/drivers/net/ethernet/ti/icssg/icssg_config.h >>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h >>>> @@ -80,6 +80,8 @@ enum icssg_port_state_cmd { >>>> ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, >>>> ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, >>>> ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, >>>> + ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, >>>> + ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE, >>>> ICSSG_EMAC_PORT_MAX_COMMANDS >>>> }; >>>> >>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>>> index 521e9f914459..582e72dd8f3f 100644 >>>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >>>> @@ -42,7 +42,9 @@ >>>> #define DEFAULT_UNTAG_MASK 1 >>>> >>>> #define NETIF_PRUETH_HSR_OFFLOAD (NETIF_F_HW_HSR_FWD | \ >>>> - NETIF_F_HW_HSR_DUP) >>>> + NETIF_F_HW_HSR_DUP | \ >>>> + NETIF_F_HW_HSR_TAG_INS | \ >>>> + NETIF_F_HW_HSR_TAG_RM) >>>> >>>> /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ >>>> #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) >>>> @@ -1032,6 +1034,13 @@ static void icssg_change_mode(struct prueth *prueth) >>>> >>>> for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { >>>> emac = prueth->emac[mac]; >>>> + if (prueth->is_hsr_offload_mode) { >>>> + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) >>>> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); >> >> Duplicate discard is done here ^^^^ > > Got it. > >> >>>> + else >>>> + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); >>>> + } >>>> + >>>> if (netif_running(emac->ndev)) { >>>> icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, >>>> ICSSG_FDB_ENTRY_P0_MEMBERSHIP | >>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>>> index 6cb1dce8b309..246f1e41c13a 100644 >>>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h >>>> @@ -58,6 +58,7 @@ >>>> #define IEP_DEFAULT_CYCLE_TIME_NS 1000000 /* 1 ms */ >>>> >>>> #define PRUETH_UNDIRECTED_PKT_DST_TAG 0 >>>> +#define PRUETH_UNDIRECTED_PKT_TAG_INS BIT(30) >>>> >>>> /* Firmware status codes */ >>>> #define ICSS_HS_FW_READY 0x55555555 >>> >> >
diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c index 2d6d8648f5a9..4eae4f9250c0 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_common.c +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c @@ -721,6 +721,9 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_DUP)) dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG; + if (prueth->is_hsr_offload_mode && (ndev->features & NETIF_F_HW_HSR_TAG_INS)) + epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS; + cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id); k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma); cppi5_hdesc_attach_buf(first_desc, buf_dma, pkt_len, buf_dma, pkt_len); diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c index 2f485318c940..f061fa97a377 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_config.c +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c @@ -531,7 +531,9 @@ static const struct icssg_r30_cmd emac_r32_bitmask[] = { {{EMAC_NONE, 0xffff4000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx ENABLE*/ {{EMAC_NONE, 0xbfff0000, EMAC_NONE, EMAC_NONE}}, /* Preemption on Tx DISABLE*/ {{0xffff0010, EMAC_NONE, 0xffff0010, EMAC_NONE}}, /* VLAN AWARE*/ - {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}} /* VLAN UNWARE*/ + {{0xffef0000, EMAC_NONE, 0xffef0000, EMAC_NONE}}, /* VLAN UNWARE*/ + {{0xffff2000, EMAC_NONE, EMAC_NONE, EMAC_NONE}}, /* HSR_RX_OFFLOAD_ENABLE */ + {{0xdfff0000, EMAC_NONE, EMAC_NONE, EMAC_NONE}} /* HSR_RX_OFFLOAD_DISABLE */ }; int icssg_set_port_state(struct prueth_emac *emac, diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h index 1ac60283923b..92c2deaa3068 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_config.h +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h @@ -80,6 +80,8 @@ enum icssg_port_state_cmd { ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, + ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE, + ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE, ICSSG_EMAC_PORT_MAX_COMMANDS }; diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 521e9f914459..582e72dd8f3f 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -42,7 +42,9 @@ #define DEFAULT_UNTAG_MASK 1 #define NETIF_PRUETH_HSR_OFFLOAD (NETIF_F_HW_HSR_FWD | \ - NETIF_F_HW_HSR_DUP) + NETIF_F_HW_HSR_DUP | \ + NETIF_F_HW_HSR_TAG_INS | \ + NETIF_F_HW_HSR_TAG_RM) /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) @@ -1032,6 +1034,13 @@ static void icssg_change_mode(struct prueth *prueth) for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) { emac = prueth->emac[mac]; + if (prueth->is_hsr_offload_mode) { + if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); + else + icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); + } + if (netif_running(emac->ndev)) { icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, ICSSG_FDB_ENTRY_P0_MEMBERSHIP | diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h index 6cb1dce8b309..246f1e41c13a 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h @@ -58,6 +58,7 @@ #define IEP_DEFAULT_CYCLE_TIME_NS 1000000 /* 1 ms */ #define PRUETH_UNDIRECTED_PKT_DST_TAG 0 +#define PRUETH_UNDIRECTED_PKT_TAG_INS BIT(30) /* Firmware status codes */ #define ICSS_HS_FW_READY 0x55555555