Skip to content

Commit e22e86e

Browse files
semihalf-szpak-zytadavem330
authored andcommitted
net: thunderx: Configure tunnelling protocol parsing
This patch enables parsing of inner layers for tunnelled packets. Signed-off-by: Zyta Szpak <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c43548d commit e22e86e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

drivers/net/ethernet/cavium/thunder/nic_main.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,25 @@ static int nic_reset_stat_counters(struct nicpf *nic,
835835
return 0;
836836
}
837837

838+
static void nic_enable_tunnel_parsing(struct nicpf *nic, int vf)
839+
{
840+
u64 prot_def = (IPV6_PROT << 32) | (IPV4_PROT << 16) | ET_PROT;
841+
u64 vxlan_prot_def = (IPV6_PROT_DEF << 32) |
842+
(IPV4_PROT_DEF) << 16 | ET_PROT_DEF;
843+
844+
/* Configure tunnel parsing parameters */
845+
nic_reg_write(nic, NIC_PF_RX_GENEVE_DEF,
846+
(1ULL << 63 | UDP_GENEVE_PORT_NUM));
847+
nic_reg_write(nic, NIC_PF_RX_GENEVE_PROT_DEF,
848+
((7ULL << 61) | prot_def));
849+
nic_reg_write(nic, NIC_PF_RX_NVGRE_PROT_DEF,
850+
((7ULL << 61) | prot_def));
851+
nic_reg_write(nic, NIC_PF_RX_VXLAN_DEF_0_1,
852+
((1ULL << 63) | UDP_VXLAN_PORT_NUM));
853+
nic_reg_write(nic, NIC_PF_RX_VXLAN_PROT_DEF,
854+
((0xfULL << 60) | vxlan_prot_def));
855+
}
856+
838857
static void nic_enable_vf(struct nicpf *nic, int vf, bool enable)
839858
{
840859
int bgx, lmac;
@@ -908,6 +927,8 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
908927
*/
909928
if (pass2_silicon(nic->pdev))
910929
nic_reg_write(nic, NIC_PF_RX_CFG, 0x01);
930+
if (!pass1_silicon(nic->pdev))
931+
nic_enable_tunnel_parsing(nic, vf);
911932
break;
912933
case NIC_MBOX_MSG_RQ_BP_CFG:
913934
reg_addr = NIC_PF_QSET_0_127_RQ_0_7_BP_CFG |

drivers/net/ethernet/cavium/thunder/nic_reg.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@
3636
#define NIC_PF_MAILBOX_ENA_W1C (0x0450)
3737
#define NIC_PF_MAILBOX_ENA_W1S (0x0470)
3838
#define NIC_PF_RX_ETYPE_0_7 (0x0500)
39+
#define NIC_PF_RX_GENEVE_DEF (0x0580)
40+
#define UDP_GENEVE_PORT_NUM 0x17C1ULL
41+
#define NIC_PF_RX_GENEVE_PROT_DEF (0x0588)
42+
#define IPV6_PROT 0x86DDULL
43+
#define IPV4_PROT 0x800ULL
44+
#define ET_PROT 0x6558ULL
45+
#define NIC_PF_RX_NVGRE_PROT_DEF (0x0598)
46+
#define NIC_PF_RX_VXLAN_DEF_0_1 (0x05A0)
47+
#define UDP_VXLAN_PORT_NUM 0x12B5
48+
#define NIC_PF_RX_VXLAN_PROT_DEF (0x05B0)
49+
#define IPV6_PROT_DEF 0x2ULL
50+
#define IPV4_PROT_DEF 0x1ULL
51+
#define ET_PROT_DEF 0x3ULL
3952
#define NIC_PF_RX_CFG (0x05D0)
4053
#define NIC_PF_PKIND_0_15_CFG (0x0600)
4154
#define NIC_PF_ECC0_FLIP0 (0x1000)

0 commit comments

Comments
 (0)