diff options
| author | Sharath Ramamurthy <sramamurthy@nvidia.com> | 2021-07-27 13:22:11 +0530 | 
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2023-02-13 18:12:04 -0500 | 
| commit | b95ce8fadbceea40639224d59bfcc0a2679f5604 (patch) | |
| tree | 77baf12b6777643344377e0798bc1d461c8bb307 /zebra/zebra_dplane.c | |
| parent | 784d88aa14c115411ed21f6ac518ab1a8f9d27b7 (diff) | |
zebra: single vxlan device dataplace vni update changes
dplane_mac_info and dplane_neigh_info is modified to be vni aware.
dplane_rem_mac_add/del dplane_mac_init is modified to be vni aware.
During dplane context update (mac and neigh), we use the vni information
and if set, corresponding netlink attribute NDA_SRC_VNI is set and passed to the
dplane.
Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
Diffstat (limited to 'zebra/zebra_dplane.c')
| -rw-r--r-- | zebra/zebra_dplane.c | 90 | 
1 files changed, 46 insertions, 44 deletions
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index ef4cef65ca..1f32351d4c 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -222,6 +222,7 @@ struct dplane_mac_info {  	vlanid_t vid;  	ifindex_t br_ifindex;  	struct ethaddr mac; +	vni_t vni;  	struct in_addr vtep_ip;  	bool is_sticky;  	uint32_t nhg_id; @@ -237,6 +238,7 @@ struct dplane_neigh_info {  		struct ethaddr mac;  		struct ipaddr ip_addr;  	} link; +	vni_t vni;  	uint32_t flags;  	uint16_t state;  	uint32_t update_flags; @@ -628,12 +630,11 @@ static enum zebra_dplane_result pw_update_internal(struct zebra_pw *pw,  static enum zebra_dplane_result intf_addr_update_internal(  	const struct interface *ifp, const struct connected *ifc,  	enum dplane_op_e op); -static enum zebra_dplane_result mac_update_common( -	enum dplane_op_e op, const struct interface *ifp, -	const struct interface *br_ifp, -	vlanid_t vid, const struct ethaddr *mac, -	struct in_addr vtep_ip,	bool sticky, uint32_t nhg_id, -	uint32_t update_flags); +static enum zebra_dplane_result +mac_update_common(enum dplane_op_e op, const struct interface *ifp, +		  const struct interface *br_ifp, vlanid_t vid, +		  const struct ethaddr *mac, vni_t vni, struct in_addr vtep_ip, +		  bool sticky, uint32_t nhg_id, uint32_t update_flags);  static enum zebra_dplane_result  neigh_update_internal(enum dplane_op_e op, const struct interface *ifp,  		      const void *link, int link_family, @@ -2229,6 +2230,12 @@ const struct ethaddr *dplane_ctx_mac_get_addr(  	return &(ctx->u.macinfo.mac);  } +vni_t dplane_ctx_mac_get_vni(const struct zebra_dplane_ctx *ctx) +{ +	DPLANE_CTX_VALID(ctx); +	return ctx->u.macinfo.vni; +} +  const struct in_addr *dplane_ctx_mac_get_vtep_ip(  	const struct zebra_dplane_ctx *ctx)  { @@ -2264,6 +2271,12 @@ const struct ethaddr *dplane_ctx_neigh_get_mac(  	return &(ctx->u.neigh.link.mac);  } +vni_t dplane_ctx_neigh_get_vni(const struct zebra_dplane_ctx *ctx) +{ +	DPLANE_CTX_VALID(ctx); +	return ctx->u.neigh.vni; +} +  uint32_t dplane_ctx_neigh_get_flags(const struct zebra_dplane_ctx *ctx)  {  	DPLANE_CTX_VALID(ctx); @@ -4649,14 +4662,11 @@ enum zebra_dplane_result dplane_intf_delete(const struct interface *ifp)  /*   * Enqueue vxlan/evpn mac add (or update).   */ -enum zebra_dplane_result dplane_rem_mac_add(const struct interface *ifp, -					const struct interface *bridge_ifp, -					vlanid_t vid, -					const struct ethaddr *mac, -					struct in_addr vtep_ip, -					bool sticky, -					uint32_t nhg_id, -					bool was_static) +enum zebra_dplane_result +dplane_rem_mac_add(const struct interface *ifp, +		   const struct interface *bridge_ifp, vlanid_t vid, +		   const struct ethaddr *mac, vni_t vni, struct in_addr vtep_ip, +		   bool sticky, uint32_t nhg_id, bool was_static)  {  	enum zebra_dplane_result result;  	uint32_t update_flags = 0; @@ -4666,8 +4676,9 @@ enum zebra_dplane_result dplane_rem_mac_add(const struct interface *ifp,  		update_flags |= DPLANE_MAC_WAS_STATIC;  	/* Use common helper api */ -	result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp, -				   vid, mac, vtep_ip, sticky, nhg_id, update_flags); +	result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp, vid, +				   mac, vni, vtep_ip, sticky, nhg_id, +				   update_flags);  	return result;  } @@ -4675,10 +4686,10 @@ enum zebra_dplane_result dplane_rem_mac_add(const struct interface *ifp,   * Enqueue vxlan/evpn mac delete.   */  enum zebra_dplane_result dplane_rem_mac_del(const struct interface *ifp, -					const struct interface *bridge_ifp, -					vlanid_t vid, -					const struct ethaddr *mac, -					struct in_addr vtep_ip) +					    const struct interface *bridge_ifp, +					    vlanid_t vid, +					    const struct ethaddr *mac, +					    vni_t vni, struct in_addr vtep_ip)  {  	enum zebra_dplane_result result;  	uint32_t update_flags = 0; @@ -4686,8 +4697,8 @@ enum zebra_dplane_result dplane_rem_mac_del(const struct interface *ifp,  	update_flags |= DPLANE_MAC_REMOTE;  	/* Use common helper api */ -	result = mac_update_common(DPLANE_OP_MAC_DELETE, ifp, bridge_ifp, -				   vid, mac, vtep_ip, false, 0, update_flags); +	result = mac_update_common(DPLANE_OP_MAC_DELETE, ifp, bridge_ifp, vid, +				   mac, vni, vtep_ip, false, 0, update_flags);  	return result;  } @@ -4746,9 +4757,8 @@ enum zebra_dplane_result dplane_local_mac_add(const struct interface *ifp,  	vtep_ip.s_addr = 0;  	/* Use common helper api */ -	result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp, -				     vid, mac, vtep_ip, sticky, 0, -				     update_flags); +	result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp, vid, +				   mac, 0, vtep_ip, sticky, 0, update_flags);  	return result;  } @@ -4767,21 +4777,17 @@ dplane_local_mac_del(const struct interface *ifp,  	/* Use common helper api */  	result = mac_update_common(DPLANE_OP_MAC_DELETE, ifp, bridge_ifp, vid, -				   mac, vtep_ip, false, 0, 0); +				   mac, 0, vtep_ip, false, 0, 0);  	return result;  }  /*   * Public api to init an empty context - either newly-allocated or   * reset/cleared - for a MAC update.   */ -void dplane_mac_init(struct zebra_dplane_ctx *ctx, -		     const struct interface *ifp, -		     const struct interface *br_ifp, -		     vlanid_t vid, -		     const struct ethaddr *mac, -		     struct in_addr vtep_ip, -		     bool sticky, -		     uint32_t nhg_id, +void dplane_mac_init(struct zebra_dplane_ctx *ctx, const struct interface *ifp, +		     const struct interface *br_ifp, vlanid_t vid, +		     const struct ethaddr *mac, vni_t vni, +		     struct in_addr vtep_ip, bool sticky, uint32_t nhg_id,  		     uint32_t update_flags)  {  	struct zebra_ns *zns; @@ -4801,6 +4807,7 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,  	ctx->u.macinfo.br_ifindex = br_ifp->ifindex;  	ctx->u.macinfo.vtep_ip = vtep_ip;  	ctx->u.macinfo.mac = *mac; +	ctx->u.macinfo.vni = vni;  	ctx->u.macinfo.vid = vid;  	ctx->u.macinfo.is_sticky = sticky;  	ctx->u.macinfo.nhg_id = nhg_id; @@ -4811,15 +4818,10 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,   * Common helper api for MAC address/vxlan updates   */  static enum zebra_dplane_result -mac_update_common(enum dplane_op_e op, -		  const struct interface *ifp, -		  const struct interface *br_ifp, -		  vlanid_t vid, -		  const struct ethaddr *mac, -		  struct in_addr vtep_ip, -		  bool sticky, -		  uint32_t nhg_id, -		  uint32_t update_flags) +mac_update_common(enum dplane_op_e op, const struct interface *ifp, +		  const struct interface *br_ifp, vlanid_t vid, +		  const struct ethaddr *mac, vni_t vni, struct in_addr vtep_ip, +		  bool sticky, uint32_t nhg_id, uint32_t update_flags)  {  	enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;  	int ret; @@ -4833,7 +4835,7 @@ mac_update_common(enum dplane_op_e op,  	ctx->zd_op = op;  	/* Common init for the ctx */ -	dplane_mac_init(ctx, ifp, br_ifp, vid, mac, vtep_ip, sticky, +	dplane_mac_init(ctx, ifp, br_ifp, vid, mac, vni, vtep_ip, sticky,  			nhg_id, update_flags);  	/* Enqueue for processing on the dplane pthread */  | 
