Commit cbc21dc1 authored by Taehee Yoo's avatar Taehee Yoo Committed by David S. Miller

amt: add data plane of amt interface

Before forwarding multicast traffic, the amt interface establishes between
gateway and relay. In order to establish, amt defined some message type
and those message flow looks like the below.

                      Gateway                  Relay
                      -------                  -----
                         :        Request        :
                     [1] |           N           |
                         |---------------------->|
                         |    Membership Query   | [2]
                         |    N,MAC,gADDR,gPORT  |
                         |<======================|
                     [3] |   Membership Update   |
                         |   ({G:INCLUDE({S})})  |
                         |======================>|
                         |                       |
    ---------------------:-----------------------:---------------------
   |                     |                       |                     |
   |                     |    *Multicast Data    |  *IP Packet(S,G)    |
   |                     |      gADDR,gPORT      |<-----------------() |
   |    *IP Packet(S,G)  |<======================|                     |
   | ()<-----------------|                       |                     |
   |                     |                       |                     |
    ---------------------:-----------------------:---------------------
                         ~                       ~
                         ~        Request        ~
                     [4] |           N'          |
                         |---------------------->|
                         |   Membership Query    | [5]
                         | N',MAC',gADDR',gPORT' |
                         |<======================|
                     [6] |                       |
                         |       Teardown        |
                         |   N,MAC,gADDR,gPORT   |
                         |---------------------->|
                         |                       | [7]
                         |   Membership Update   |
                         |  ({G:INCLUDE({S})})   |
                         |======================>|
                         |                       |
    ---------------------:-----------------------:---------------------
   |                     |                       |                     |
   |                     |    *Multicast Data    |  *IP Packet(S,G)    |
   |                     |     gADDR',gPORT'     |<-----------------() |
   |    *IP Packet (S,G) |<======================|                     |
   | ()<-----------------|                       |                     |
   |                     |                       |                     |
    ---------------------:-----------------------:---------------------
                         |                       |
                         :                       :

1. Discovery
 - Sent by Gateway to Relay
 - To find Relay unique ip address
2. Advertisement
 - Sent by Relay to Gateway
 - Contains the unique IP address
3. Request
 - Sent by Gateway to Relay
 - Solicit to receive 'Query' message.
4. Query
 - Sent by Relay to Gateway
 - Contains General Query message.
5. Update
 - Sent by  Gateway to Relay
 - Contains report message.
6. Multicast Data
 - Sent by Relay to Gateway
 - encapsulated multicast traffic.
7. Teardown
 - Not supported at this time.

Except for the Teardown message, it supports all messages.

In the next patch, IGMP/MLD logic will be added.
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9022b53
This diff is collapsed.
...@@ -38,6 +38,18 @@ enum amt_status { ...@@ -38,6 +38,18 @@ enum amt_status {
#define AMT_STATUS_MAX (__AMT_STATUS_MAX - 1) #define AMT_STATUS_MAX (__AMT_STATUS_MAX - 1)
struct amt_header {
#if defined(__LITTLE_ENDIAN_BITFIELD)
u8 type:4,
version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
u8 version:4,
type:4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
} __packed;
struct amt_header_discovery { struct amt_header_discovery {
#if defined(__LITTLE_ENDIAN_BITFIELD) #if defined(__LITTLE_ENDIAN_BITFIELD)
u32 type:4, u32 type:4,
...@@ -156,6 +168,29 @@ struct amt_relay_headers { ...@@ -156,6 +168,29 @@ struct amt_relay_headers {
}; };
} __packed; } __packed;
struct amt_skb_cb {
struct amt_tunnel_list *tunnel;
};
struct amt_tunnel_list {
struct list_head list;
/* Protect All resources under an amt_tunne_list */
spinlock_t lock;
struct amt_dev *amt;
u32 nr_groups;
u32 nr_sources;
enum amt_status status;
struct delayed_work gc_wq;
__be16 source_port;
__be32 ip4;
__be32 nonce;
siphash_key_t key;
u64 mac:48,
reserved:16;
struct rcu_head rcu;
struct hlist_head groups[];
};
struct amt_dev { struct amt_dev {
struct net_device *dev; struct net_device *dev;
struct net_device *stream_dev; struct net_device *stream_dev;
...@@ -211,12 +246,19 @@ struct amt_dev { ...@@ -211,12 +246,19 @@ struct amt_dev {
reserved:16; reserved:16;
}; };
#define AMT_TOS 0xc0
#define AMT_IPHDR_OPTS 4
#define AMT_MAX_GROUP 32 #define AMT_MAX_GROUP 32
#define AMT_MAX_SOURCE 128 #define AMT_MAX_SOURCE 128
#define AMT_HSIZE_SHIFT 8 #define AMT_HSIZE_SHIFT 8
#define AMT_HSIZE (1 << AMT_HSIZE_SHIFT) #define AMT_HSIZE (1 << AMT_HSIZE_SHIFT)
#define AMT_DISCOVERY_TIMEOUT 5000
#define AMT_INIT_REQ_TIMEOUT 1
#define AMT_INIT_QUERY_INTERVAL 125 #define AMT_INIT_QUERY_INTERVAL 125
#define AMT_MAX_REQ_TIMEOUT 120
#define AMT_MAX_REQ_COUNT 3
#define AMT_SECRET_TIMEOUT 60000
#define IANA_AMT_UDP_PORT 2268 #define IANA_AMT_UDP_PORT 2268
#define AMT_MAX_TUNNELS 128 #define AMT_MAX_TUNNELS 128
#define AMT_MAX_REQS 128 #define AMT_MAX_REQS 128
...@@ -232,4 +274,9 @@ static inline bool netif_is_amt(const struct net_device *dev) ...@@ -232,4 +274,9 @@ static inline bool netif_is_amt(const struct net_device *dev)
return dev->rtnl_link_ops && !strcmp(dev->rtnl_link_ops->kind, "amt"); return dev->rtnl_link_ops && !strcmp(dev->rtnl_link_ops->kind, "amt");
} }
static inline u64 amt_gmi(const struct amt_dev *amt)
{
return ((amt->qrv * amt->qi) + amt->qri) * 1000;
}
#endif /* _NET_AMT_H_ */ #endif /* _NET_AMT_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment