Revision d8e2262a5044c1a05b4da51e5d0976f10c487a9f authored by Saif Hasan on 21 September 2018, 21:30:05 UTC, committed by David S. Miller on 24 September 2018, 19:19:27 UTC
Summary:

This appears to be necessary and sufficient change to enable `MPLS` on
`ip6gre` tunnels (RFC4023).

This diff allows IP6GRE devices to be recognized by MPLS kernel module
and hence user can configure interface to accept packets with mpls
headers as well setup mpls routes on them.

Test Plan:

Test plan consists of multiple containers connected via GRE-V6 tunnel.
Then carrying out testing steps as below.

- Carry out necessary sysctl settings on all containers

```
sysctl -w net.mpls.platform_labels=65536
sysctl -w net.mpls.ip_ttl_propagate=1
sysctl -w net.mpls.conf.lo.input=1
```

- Establish IP6GRE tunnels

```
ip -6 tunnel add name if_1_2_1 mode ip6gre \
  local 2401:db00:21:6048:feed:0::1 \
  remote 2401:db00:21:6048:feed:0::2 key 1
ip link set dev if_1_2_1 up
sysctl -w net.mpls.conf.if_1_2_1.input=1
ip -4 addr add 169.254.0.2/31 dev if_1_2_1 scope link

ip -6 tunnel add name if_1_3_1 mode ip6gre \
  local 2401:db00:21:6048:feed:0::1 \
  remote 2401:db00:21:6048:feed:0::3 key 1
ip link set dev if_1_3_1 up
sysctl -w net.mpls.conf.if_1_3_1.input=1
ip -4 addr add 169.254.0.4/31 dev if_1_3_1 scope link
```

- Install MPLS encap rules on node-1 towards node-2

```
ip route add 192.168.0.11/32 nexthop encap mpls 32/64 \
  via inet 169.254.0.3 dev if_1_2_1
```

- Install MPLS forwarding rules on node-2 and node-3
```
// node2
ip -f mpls route add 32 via inet 169.254.0.7 dev if_2_4_1

// node3
ip -f mpls route add 64 via inet 169.254.0.12 dev if_4_3_1
```

- Ping 192.168.0.11 (node4) from 192.168.0.1 (node1) (where routing
  towards 192.168.0.1 is via IP route directly towards node1 from node4)
```
ping 192.168.0.11
```

- tcpdump on interface to capture ping packets wrapped within MPLS
  header which inturn wrapped within IP6GRE header

```
16:43:41.121073 IP6
  2401:db00:21:6048:feed::1 > 2401:db00:21:6048:feed::2:
  DSTOPT GREv0, key=0x1, length 100:
  MPLS (label 32, exp 0, ttl 255) (label 64, exp 0, [S], ttl 255)
  IP 192.168.0.1 > 192.168.0.11:
  ICMP echo request, id 1208, seq 45, length 64

0x0000:  6000 2cdb 006c 3c3f 2401 db00 0021 6048  `.,..l<?$....!`H
0x0010:  feed 0000 0000 0001 2401 db00 0021 6048  ........$....!`H
0x0020:  feed 0000 0000 0002 2f00 0401 0401 0100  ......../.......
0x0030:  2000 8847 0000 0001 0002 00ff 0004 01ff  ...G............
0x0040:  4500 0054 3280 4000 ff01 c7cb c0a8 0001  E..T2.@.........
0x0050:  c0a8 000b 0800 a8d7 04b8 002d 2d3c a05b  ...........--<.[
0x0060:  0000 0000 bcd8 0100 0000 0000 1011 1213  ................
0x0070:  1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  .............!"#
0x0080:  2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
0x0090:  3435 3637                                4567
```

Signed-off-by: Saif Hasan <has@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d2f85c9
Raw File
Kconfig.cpu
comment "Processor Features"

config CPU_BIG_ENDIAN
	def_bool !CPU_LITTLE_ENDIAN

config CPU_LITTLE_ENDIAN
	bool "Little endian"
	default y

config HWZOL
	bool "hardware zero overhead loop support"
	depends on CPU_D10 || CPU_D15
	default n
	help
	  A set of Zero-Overhead Loop mechanism is provided to reduce the
	  instruction fetch and execution overhead of loop-control instructions.
	  It will save 3 registers($LB, $LC, $LE) for context saving if say Y.
	  You don't need to save these registers if you can make sure your user
	  program doesn't use these registers.

	  If unsure, say N.

config CPU_CACHE_ALIASING
	bool "Aliasing cache"
	depends on CPU_N10 || CPU_D10 || CPU_N13 || CPU_V3
	default y
	help
	  If this CPU is using VIPT data cache and its cache way size is larger
	  than page size, say Y. If it is using PIPT data cache, say N.

	  If unsure, say Y.

choice
	prompt "minimum CPU type"
	default CPU_V3
	help
	  The data cache of N15/D15 is implemented as PIPT and it will not cause
	  the cache aliasing issue. The rest cpus(N13, N10 and D10) are
	  implemented as VIPT data cache. It may cause the cache aliasing issue
	  if its cache way size is larger than page size. You can specify the
	  CPU type direcly or choose CPU_V3 if unsure.

          A kernel built for N10 is able to run on N15, D15, N13, N10 or D10.
          A kernel built for N15 is able to run on N15 or D15.
          A kernel built for D10 is able to run on D10 or D15.
          A kernel built for D15 is able to run on D15.
          A kernel built for N13 is able to run on N15, N13 or D15.

config CPU_N15
	bool "AndesCore N15"
config CPU_N13
	bool "AndesCore N13"
	select CPU_CACHE_ALIASING if ANDES_PAGE_SIZE_4KB
config CPU_N10
	bool "AndesCore N10"
	select CPU_CACHE_ALIASING
config CPU_D15
	bool "AndesCore D15"
config CPU_D10
	bool "AndesCore D10"
	select CPU_CACHE_ALIASING
config CPU_V3
	bool "AndesCore v3 compatible"
	select CPU_CACHE_ALIASING
endchoice
choice
	prompt "Paging -- page size "
	default ANDES_PAGE_SIZE_4KB
config  ANDES_PAGE_SIZE_4KB
	bool "use 4KB page size"
config  ANDES_PAGE_SIZE_8KB
	bool "use 8KB page size"
endchoice

config CPU_ICACHE_DISABLE
	bool "Disable I-Cache"
	help
	  Say Y here to disable the processor instruction cache. Unless
	  you have a reason not to or are unsure, say N.

config CPU_DCACHE_DISABLE
	bool "Disable D-Cache"
	help
	  Say Y here to disable the processor data cache. Unless
	  you have a reason not to or are unsure, say N.

config CPU_DCACHE_WRITETHROUGH
	bool "Force write through D-cache"
	depends on !CPU_DCACHE_DISABLE
	help
	  Say Y here to use the data cache in writethrough mode. Unless you
	  specifically require this or are unsure, say N.

config WBNA
	bool "WBNA"
	default n
	help
	  Say Y here to enable write-back memory with no-write-allocation policy.

config ALIGNMENT_TRAP
	bool "Kernel support unaligned access handling by sw"
	depends on PROC_FS
	default n
	help
	  Andes processors cannot load/store information which is not
	  naturally aligned on the bus, i.e., a 4 byte load must start at an
	  address divisible by 4. On 32-bit Andes processors, these non-aligned
	  load/store instructions will be emulated in software if you say Y
	  here, which has a severe performance impact. With an IP-only
	  configuration it is safe to say N, otherwise say Y.

config HW_SUPPORT_UNALIGNMENT_ACCESS
	bool "Kernel support unaligned access handling by hw"
	depends on !ALIGNMENT_TRAP
	default n
	help
	  Andes processors load/store world/half-word instructions can access
	  unaligned memory locations without generating the Data Alignment
	  Check exceptions. With an IP-only configuration it is safe to say N,
	  otherwise say Y.

config HIGHMEM
	bool "High Memory Support"
	depends on MMU && !CPU_CACHE_ALIASING
	help
	  The address space of Andes processors is only 4 Gigabytes large
	  and it has to accommodate user address space, kernel address
	  space as well as some memory mapped IO. That means that, if you
	  have a large amount of physical memory and/or IO, not all of the
	  memory can be "permanently mapped" by the kernel. The physical
	  memory that is not permanently mapped is called "high memory".

	  Depending on the selected kernel/user memory split, minimum
	  vmalloc space and actual amount of RAM, you may not need this
	  option which should result in a slightly faster kernel.

	  If unsure, say N.

config CACHE_L2
	bool "Support L2 cache"
        default y
	help
	  Say Y here to enable L2 cache if your SoC are integrated with L2CC.
	  If unsure, say N.

menu "Memory configuration"

choice
	prompt "Memory split"
	depends on MMU
	default VMSPLIT_3G_OPT
	help
	  Select the desired split between kernel and user memory.

	  If you are not absolutely sure what you are doing, leave this
	  option alone!

	config VMSPLIT_3G
		bool "3G/1G user/kernel split"
	config VMSPLIT_3G_OPT
		bool "3G/1G user/kernel split (for full 1G low memory)"
	config VMSPLIT_2G
		bool "2G/2G user/kernel split"
	config VMSPLIT_1G
		bool "1G/3G user/kernel split"
endchoice

config PAGE_OFFSET
	hex
	default 0x40000000 if VMSPLIT_1G
	default 0x80000000 if VMSPLIT_2G
	default 0xB0000000 if VMSPLIT_3G_OPT
	default 0xC0000000

endmenu
back to top