Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set default_cable = '0m' %}
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
Expand Down
1 change: 1 addition & 0 deletions dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN apt-get update && \
dmidecode \
i2c-tools \
psmisc \
python3-jsonschema \
libpci3

# TODO: Remove these lines once we no longer need Python 2
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
python-dev \
python3-dev

# Install j2cli for handling jinja template
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10"

# Install Python client for Redis
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install "redis==3.5.3"
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "redis==3.5.3"
Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/pcie.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_pcie_check(self):
id_conf = item_conf["id"]
dev_conf = item_conf["dev"]
fn_conf = item_conf["fn"]
bus_conf = self._device_id_to_bus_map.get(id_conf)
bus_conf = self._device_id_to_bus_map.get(str(id_conf))
if bus_conf and self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16),
func=int(fn_conf, base=16)):
item_conf["result"] = "Passed"
Expand Down
27 changes: 15 additions & 12 deletions src/iccpd/include/iccp_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ typedef enum

typedef struct cli_param_queue
{
char ifname[16];
char ifname[16];
cli_queue_type_et type;
int param;
int itf_add;
int param;
int itf_add;
LIST_ENTRY(cli_param_queue) cli_queue_next;
} cli_param_queue_st;

Expand All @@ -50,18 +50,21 @@ typedef struct cli_param_queue
#define MCLAG_INTF_STR "mclag_interface"
#define SYSTEM_MAC_STR "system_mac"

int set_mc_lag_id(struct CSM* csm, uint16_t domain);
int set_peer_link(int mid, const char* ifname);
int set_local_address(int mid, const char* addr);
int set_peer_address(int mid, const char* addr);
int unset_mc_lag_id(struct CSM* csm, uint16_t domain);
int set_mc_lag_id(struct CSM *csm, uint16_t domain);
int set_peer_link(int mid, const char *ifname);
int set_local_address(int mid, const char *addr);
int set_peer_address(int mid, const char *addr);
int unset_mc_lag_id(struct CSM *csm, uint16_t domain);
int unset_peer_link(int mid);
int unset_local_address(int mid);
int unset_peer_address(int mid);

int iccp_cli_attach_mclag_domain_to_port_channel(int domain, const char* ifname);
int iccp_cli_detach_mclag_domain_to_port_channel(const char* ifname);
int set_local_system_id(const char* mac);
int unset_local_system_id( );
int iccp_cli_attach_mclag_domain_to_port_channel(int domain, const char *ifname);
int iccp_cli_detach_mclag_domain_to_port_channel(const char *ifname);
int set_local_system_id(const char *mac);
int unset_local_system_id();

int set_keepalive_time(int mid, int keepalive_time);
int set_session_timeout(int mid, int session_timeout_val);

#endif
3 changes: 3 additions & 0 deletions src/iccpd/include/iccp_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@

int iccp_config_from_file(char *config_default_dir);

int set_mc_lag_by_id(uint16_t mid);
int unset_mc_lag_by_id(uint16_t mid);

#endif /* ICCP_CMD_H_ */
2 changes: 2 additions & 0 deletions src/iccpd/include/iccp_cmd_show.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ extern int iccp_ndisc_dump(char * *buf, int *num, int mclag_id);
extern int iccp_mac_dump(char * *buf, int *num, int mclag_id);
extern int iccp_local_if_dump(char * *buf, int *num, int mclag_id);
extern int iccp_peer_if_dump(char * *buf, int *num, int mclag_id);
extern int iccp_cmd_dbg_counter_dump(char * *buf, int *data_len, int mclag_id);
extern int iccp_unique_ip_if_dump(char * *buf, int *num, int mclag_id);
#endif
11 changes: 8 additions & 3 deletions src/iccpd/include/iccp_csm.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@

#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif /* INET_ADDRSTRLEN */
#endif /* INET_ADDRSTRLEN */
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif /* INET6_ADDRSTRLEN */
#endif /* INET6_ADDRSTRLEN */
/* For socket binding */
#define ICCP_TCP_PORT 8888
#define MAX_ACCEPT_CONNETIONS 20
Expand Down Expand Up @@ -113,10 +113,15 @@ struct CSM
time_t peer_warm_reboot_time;
time_t warm_reboot_disconn_time;
char peer_itf_name[IFNAMSIZ];
time_t peer_link_learning_retry_time;
char peer_ip[INET_ADDRSTRLEN];
char sender_ip[INET_ADDRSTRLEN];
void* sock_read_event_ptr;

int keepalive_time;
int session_timeout;
int peer_link_learning_enable;

/* Msg queue */
TAILQ_HEAD(msg_list, Msg) msg_list;

Expand Down Expand Up @@ -164,5 +169,5 @@ void iccp_csm_correspond_from_rg_connect_msg(struct CSM*, struct Msg*);
void iccp_csm_correspond_from_rg_disconnect_msg(struct CSM*, struct Msg*);

int mlacp_bind_port_channel_to_csm(struct CSM* csm, const char *ifname);

int iccp_csm_init_mac_msg(struct MACMsg **mac_msg, char* data, int len);
#endif /* ICCP_CSM_H_ */
4 changes: 3 additions & 1 deletion src/iccpd/include/iccp_ifm.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ int do_one_neigh_request(struct nlmsghdr *n);

void iccp_from_netlink_port_state_handler( char * ifname, int state);

void iccp_parse_if_vlan_info_from_netlink(struct nlmsghdr *n);
void vlan_mbrship_change_handler(unsigned int vlan_id, char *mbr_if_name, int add_flag);
void del_all_pending_vlan_mbr_ifs(struct System *sys);
void move_pending_vlan_mbr_to_lif(struct System *sys, struct LocalInterface* lif);
#endif // LACP_IFM_H

16 changes: 9 additions & 7 deletions src/iccpd/include/iccp_netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
#include <stdarg.h>
#include <unistd.h>
#include <netlink/netlink.h>

#include <linux/types.h>

#include "../include/system.h"
#include "../include/port.h"
#include <netinet/icmp6.h>
Expand All @@ -37,6 +35,7 @@
#define NDISC_NEIGHBOUR_ADVERTISEMENT 136
#define ND_OPT_TARGET_LL_ADDR 2
#define NEXTHDR_ICMP 58
#define ICCP_NLE_SEQ_MISMATCH -16

struct nd_msg
{
Expand All @@ -51,17 +50,20 @@ struct in6_pktinfo
unsigned int ipi6_ifindex; /* send/recv interface index */
};

int iccp_get_port_member_list(struct LocalInterface* lif);
int iccp_get_port_member_list(struct LocalInterface *lif);
void iccp_event_handler_obj_input_newlink(struct nl_object *obj, void *arg);
void iccp_event_handler_obj_input_dellink(struct nl_object *obj, void *arg);
int iccp_system_init_netlink_socket();
void iccp_system_dinit_netlink_socket();
int iccp_init_netlink_event_fd(struct System *sys);
int iccp_handle_events(struct System * sys);
void update_if_ipmac_on_standby(struct LocalInterface* lif_po);
int iccp_handle_events(struct System *sys);
void update_if_ipmac_on_standby(struct LocalInterface *lif_po, int dir);
int iccp_sys_local_if_list_get_addr();
int iccp_netlink_neighbor_request(int family, uint8_t *addr, int add, uint8_t *mac, char *portname);
int iccp_netlink_neighbor_request(int family, uint8_t *addr, int add, uint8_t *mac, char *portname, int permanent, int dir);
int iccp_check_if_addr_from_netlink(int family, uint8_t *addr, struct LocalInterface *lif);

void recover_if_ipmac_on_standby(struct LocalInterface* lif_po, int dir);
void update_vlan_if_mac_on_standby(struct LocalInterface* lif_vlan, int dir);
void recover_vlan_if_mac_on_standby(struct LocalInterface* lif_vlan, int dir, uint8_t *remote_system_mac);
void update_vlan_if_mac_on_iccp_up(struct LocalInterface* lif_peer, int is_up, uint8_t *remote_system_mac);
#endif

2 changes: 1 addition & 1 deletion src/iccpd/include/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
typedef enum _iccpd_log_level_t
{
CRITICAL_LOG_LEVEL = 0,
ERR_LOG_LEVEL = 1,
ERR_LOG_LEVEL = 1,
WARN_LOG_LEVEL = 2,
NOTICE_LOG_LEVEL = 3,
INFO_LOG_LEVEL = 4,
Expand Down
96 changes: 93 additions & 3 deletions src/iccpd/include/mlacp_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
#define _MLACP_FSM_H

#include "../include/port.h"
#include "../include/mlacp_tlv.h"

#define MLCAP_SYNC_PHY_DEV_SEC 1 /*every 1 sec*/

#define MLACP_LOCAL_IF_DOWN_TIMER 600 // 600 seconds.

#define MLACP(csm_ptr) (csm_ptr->app_csm.mlacp)

struct CSM;
Expand All @@ -47,7 +50,7 @@ typedef enum MLACP_APP_STATE MLACP_APP_STATE_E;
/* for sender only*/
enum MLACP_SYNC_STATE
{
MLACP_SYNC_SYSCONF=0,
MLACP_SYNC_SYSCONF = 0,
MLACP_SYNC_AGGCONF,
MLACP_SYNC_AGGSTATE,
MLACP_SYNC_AGGINFO,
Expand All @@ -66,6 +69,85 @@ struct Remote_System
uint32_t node_id;
};

/****************************************************************
* Debug counters to track message sent and received between
* MC-LAG peers over ICCP
***************************************************************/
typedef uint8_t ICCP_DBG_CNTR_DIR_e;
enum ICCP_DBG_CNTR_DIR_e
{
ICCP_DBG_CNTR_DIR_TX = 0,
ICCP_DBG_CNTR_DIR_RX = 1,
ICCP_DBG_CNTR_DIR_MAX
};

typedef uint8_t ICCP_DBG_CNTR_STS_e;
enum ICCP_DBG_CNTR_STS_e
{
ICCP_DBG_CNTR_STS_OK = 0,
ICCP_DBG_CNTR_STS_ERR = 1, /* Send error or receive processing error*/
ICCP_DBG_CNTR_STS_MAX
};

/* Change MCLAGDCTL_MAX_DBG_COUNTERS if ICCP_DBG_CNTR_MSG_MAX is more than 32 */
enum ICCP_DBG_CNTR_MSG
{
ICCP_DBG_CNTR_MSG_SYS_CONFIG = 0,
ICCP_DBG_CNTR_MSG_AGGR_CONFIG = 1,
ICCP_DBG_CNTR_MSG_AGGR_STATE = 2,
ICCP_DBG_CNTR_MSG_MAC_INFO = 3,
ICCP_DBG_CNTR_MSG_ARP_INFO = 4,
ICCP_DBG_CNTR_MSG_L2MC_INFO = 5,
ICCP_DBG_CNTR_MSG_PORTCHANNEL_INFO = 6,
ICCP_DBG_CNTR_MSG_PEER_LINK_INFO = 7,
ICCP_DBG_CNTR_MSG_HEART_BEAT = 8,
ICCP_DBG_CNTR_MSG_NAK = 9,
ICCP_DBG_CNTR_MSG_SYNC_DATA = 10,
ICCP_DBG_CNTR_MSG_SYNC_REQ = 11,
ICCP_DBG_CNTR_MSG_WARM_BOOT = 12,
ICCP_DBG_CNTR_MSG_IF_UP_ACK = 13,
ICCP_DBG_CNTR_MSG_STP_CONNECT = 14,
ICCP_DBG_CNTR_MSG_STP_DISCONNECT = 15,
ICCP_DBG_CNTR_MSG_STP_SYSTEM_CONFIG = 16,
ICCP_DBG_CNTR_MSG_STP_REGION_NAME = 17,
ICCP_DBG_CNTR_MSG_STP_REVISION_LEVEL = 18,
ICCP_DBG_CNTR_MSG_STP_INSTANCE_PRIORITY = 19,
ICCP_DBG_CNTR_MSG_STP_CONFIGURATION_DIGEST = 20,
ICCP_DBG_CNTR_MSG_STP_TC_INSTANCES = 21,
ICCP_DBG_CNTR_MSG_STP_ROOT_TIME_PARAM = 22,
ICCP_DBG_CNTR_MSG_STP_MIST_ROOT_TIME_PARAM = 23,
ICCP_DBG_CNTR_MSG_STP_SYNC_REQ = 24,
ICCP_DBG_CNTR_MSG_STP_SYNC_DATA = 25,
ICCP_DBG_CNTR_MSG_STP_PO_PORT_MAP = 26,
ICCP_DBG_CNTR_MSG_STP_AGE_OUT = 27,
ICCP_DBG_CNTR_MSG_STP_COMMON_MSG = 28,
ICCP_DBG_CNTR_MSG_MAX
};
typedef enum ICCP_DBG_CNTR_MSG ICCP_DBG_CNTR_MSG_e;

/* Count messages sent to MCLAG peer */
#define MLACP_SET_ICCP_TX_DBG_COUNTER(csm, tlv_type, status)\
do{\
ICCP_DBG_CNTR_MSG_e dbg_type;\
dbg_type = mlacp_fsm_iccp_to_dbg_msg_type(tlv_type);\
if (csm && ((dbg_type) < ICCP_DBG_CNTR_MSG_MAX) && ((status) < ICCP_DBG_CNTR_STS_MAX))\
++MLACP(csm).dbg_counters.iccp_counters[dbg_type][ICCP_DBG_CNTR_DIR_TX][status];\
}while(0);

/* Count messages received from MCLAG peer */
#define MLACP_SET_ICCP_RX_DBG_COUNTER(csm, tlv_type, status)\
do{\
ICCP_DBG_CNTR_MSG_e dbg_type;\
dbg_type = mlacp_fsm_iccp_to_dbg_msg_type(tlv_type);\
if (csm && ((dbg_type) < ICCP_DBG_CNTR_MSG_MAX) && ((status) < ICCP_DBG_CNTR_STS_MAX))\
++MLACP(csm).dbg_counters.iccp_counters[dbg_type][ICCP_DBG_CNTR_DIR_RX][status];\
}while(0);

typedef struct mlacp_dbg_counter_info
{
uint64_t iccp_counters[ICCP_DBG_CNTR_MSG_MAX][ICCP_DBG_CNTR_DIR_MAX][ICCP_DBG_CNTR_STS_MAX];
}mlacp_dbg_counter_info_t;

struct mLACP
{
int id;
Expand All @@ -88,22 +170,30 @@ struct mLACP
TAILQ_HEAD(arp_info_list, Msg) arp_list;
TAILQ_HEAD(ndisc_msg_list, Msg) ndisc_msg_list;
TAILQ_HEAD(ndisc_info_list, Msg) ndisc_list;
TAILQ_HEAD(mac_msg_list, Msg) mac_msg_list;
TAILQ_HEAD(mac_info_list, Msg) mac_list;
TAILQ_HEAD(mac_msg_list, MACMsg) mac_msg_list;

struct mac_rb_tree mac_rb;

LIST_HEAD(lif_list, LocalInterface) lif_list;
LIST_HEAD(lif_purge_list, LocalInterface) lif_purge_list;
LIST_HEAD(pif_list, PeerInterface) pif_list;

/* ICCP message tx/rx debug counters */
mlacp_dbg_counter_info_t dbg_counters;
};

void mlacp_init(struct CSM* csm, int all);
void mlacp_finalize(struct CSM* csm);
void mlacp_fsm_transit(struct CSM* csm);
void mlacp_enqueue_msg(struct CSM*, struct Msg*);
struct Msg* mlacp_dequeue_msg(struct CSM*);
char* mlacp_state(struct CSM* csm);

/* from app_csm*/
extern int mlacp_bind_local_if(struct CSM* csm, struct LocalInterface* local_if);
extern int mlacp_unbind_local_if(struct LocalInterface* local_if);

/* Debug counter API */
ICCP_DBG_CNTR_MSG_e mlacp_fsm_iccp_to_dbg_msg_type(uint32_t tlv_type);

#endif /* _MLACP_HANDLER_H */
Loading