Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVST Feature commit #38

Merged
merged 19 commits into from
Nov 19, 2024
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
29 changes: 23 additions & 6 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,37 @@ jobs:
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"

- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 142
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
patterns: |
target/debs/bookworm/libyang*.deb
target/debs/bookworm/libnl*.deb
displayName: "Download bookworm debs"

- script: |
set -ex
pwd
ls -l ../
pwd

#install HIREDIS
sudo apt-get install -y libhiredis0.14 libhiredis-dev

# LIBYANG
sudo dpkg -i ../target/debs/bookworm/libyang*1.0.73*.deb

# Install libnl3
sudo apt-get install -qq -y \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev
sudo apt-get -y purge libnl-3-dev libnl-route-3-dev
sudo dpkg -i ../target/debs/bookworm/libnl-3-200_*.deb
sudo dpkg -i ../target/debs/bookworm/libnl-genl-3-200_*.deb
sudo dpkg -i ../target/debs/bookworm/libnl-route-3-200_*.deb
sudo dpkg -i ../target/debs/bookworm/libnl-nf-3-200_*.deb
#sudo apt-get install -qq -y libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev

#install libswsscommon
sudo dpkg -i ../libswsscommon_1.0.0_${{ parameters.arch }}.deb
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ stages:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-buster
sonic_slave: sonic-slave-bookworm
swss_common_artifact_name: sonic-swss-common
artifact_name: sonic-stp

Expand All @@ -35,7 +35,7 @@ stages:
arch: armhf
timeout: 180
pool: sonicbld
sonic_slave: sonic-slave-buster-armhf
sonic_slave: sonic-slave-bookworm-armhf
swss_common_artifact_name: sonic-swss-common.armhf
artifact_name: sonic-stp.armhf

Expand All @@ -44,6 +44,6 @@ stages:
arch: arm64
timeout: 180
pool: sonicbld
sonic_slave: sonic-slave-buster-arm64
sonic_slave: sonic-slave-bookworm-arm64
swss_common_artifact_name: sonic-swss-common.arm64
artifact_name: sonic-stp.arm64
1 change: 0 additions & 1 deletion include/stp_externs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ extern struct STPD_CONTEXT stpd_context;
extern STP_GLOBAL stp_global;
extern uint32_t g_max_stp_port;
extern uint16_t g_stp_bmp_po_offset;
struct timeval g_stp_100ms_tv;
extern MAC_ADDRESS bridge_group_address;
extern MAC_ADDRESS pvst_bridge_group_address;
extern MAC_ADDRESS g_stp_base_mac_addr;
Expand Down
3 changes: 0 additions & 3 deletions include/stp_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ typedef struct
#define STPD_INCR_PKT_COUNT(x, y) (g_stpd_intf_stats[x]->y)++
#define STPD_GET_PKT_COUNT(x, y) (g_stpd_intf_stats[x]->y)

struct tm *g_tm;
struct timespec g_ts;

typedef struct
{
uint16_t no_of_sockets;
Expand Down
2 changes: 1 addition & 1 deletion include/stp_netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef struct netlink_db_s
}netlink_db_t;

typedef void stp_netlink_cb_ptr (netlink_db_t *if_db, uint8_t add, bool init_in_prog);
stp_netlink_cb_ptr *stp_netlink_cb;
extern stp_netlink_cb_ptr *stp_netlink_cb;

#define PRINT_MAC_FORMAT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
#define PRINT_MAC_VAL(x) *(char *)x,*((char *)x)+1,*((char *)x)+2,*((char *)x)+3,*((char *)x)+4,*((char *)x)+5
Expand Down
2 changes: 1 addition & 1 deletion stp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ else
DBGFLAGS = -g -DNDEBUG
endif

libstp_a_CFLAGS = -Werror $(COV_CFLAGS)
libstp_a_CFLAGS = -Werror -Wno-error=address-of-packed-member $(COV_CFLAGS)
libstp_a_SOURCES = stp.c stp_pkt.c stp_data.c stp_debug.c stp_intf.c stp_main.c stp_mgr.c stp_netlink.c stp_timer.c stp_util.c
2 changes: 1 addition & 1 deletion stp/stp_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "stp_netlink.h"

int stp_intf_get_netlink_fd();

stp_netlink_cb_ptr *stp_netlink_cb;

int stp_set_sock_buf_size(int sock, int optname, int size)
{
Expand Down
38 changes: 18 additions & 20 deletions stpsync/stp_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include <linux/if.h>
#include <chrono>
#include "logger.h"
#include "dbconnector.h"
#include "producerstatetable.h"
#include "stp_sync.h"
#include "stp_dbsync.h"
#include <algorithm>
Expand All @@ -48,94 +46,94 @@ StpSync::StpSync(DBConnector *db, DBConnector *cfgDb) :

DBConnector db(APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
DBConnector cfgDb(CONFIG_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
StpSync sync(&db, &cfgDb);
StpSync stpsync(&db, &cfgDb);

extern "C" {

void stpsync_add_vlan_to_instance(uint16_t vlan_id, uint16_t instance)
{
sync.addVlanToInstance(vlan_id, instance);
stpsync.addVlanToInstance(vlan_id, instance);
}

void stpsync_del_vlan_from_instance(uint16_t vlan_id, uint16_t instance)
{
sync.delVlanFromInstance(vlan_id, instance);
stpsync.delVlanFromInstance(vlan_id, instance);
}

void stpsync_update_stp_class(STP_VLAN_TABLE * stp_vlan)
{
sync.updateStpVlanInfo(stp_vlan);
stpsync.updateStpVlanInfo(stp_vlan);
}

void stpsync_del_stp_class(uint16_t vlan_id)
{
sync.delStpVlanInfo(vlan_id);
stpsync.delStpVlanInfo(vlan_id);
}

void stpsync_update_port_class(STP_VLAN_PORT_TABLE * stp_vlan_intf)
{
sync.updateStpVlanInterfaceInfo(stp_vlan_intf);
stpsync.updateStpVlanInterfaceInfo(stp_vlan_intf);
}

void stpsync_del_port_class(char * if_name, uint16_t vlan_id)
{
sync.delStpVlanInterfaceInfo(if_name, vlan_id);
stpsync.delStpVlanInterfaceInfo(if_name, vlan_id);
}

void stpsync_update_port_state(char * ifName, uint16_t instance, uint8_t state)
{
sync.updateStpPortState(ifName, instance, state);
stpsync.updateStpPortState(ifName, instance, state);
}

void stpsync_del_port_state(char * ifName, uint16_t instance)
{
sync.delStpPortState(ifName, instance);
stpsync.delStpPortState(ifName, instance);
}

#if 0
void stpsync_update_vlan_port_state(char * ifName, uint16_t vlan_id, uint8_t state)
{
sync.updateStpVlanPortState(ifName, vlan_id, state);
stpsync.updateStpVlanPortState(ifName, vlan_id, state);
}

void stpsync_del_vlan_port_state(char * ifName, uint16_t vlan_id)
{
sync.delStpVlanPortState(ifName, vlan_id);
stpsync.delStpVlanPortState(ifName, vlan_id);
}
#endif
void stpsync_update_fastage_state(uint16_t vlan_id, bool add)
{
sync.updateStpVlanFastage(vlan_id, add);
stpsync.updateStpVlanFastage(vlan_id, add);
}

void stpsync_update_port_admin_state(char * ifName, bool up, bool physical)
{
sync.updatePortAdminState(ifName, up, physical);
stpsync.updatePortAdminState(ifName, up, physical);
}

uint32_t stpsync_get_port_speed(char * ifName)
{
return sync.getPortSpeed(ifName);
return stpsync.getPortSpeed(ifName);
}

void stpsync_update_bpdu_guard_shutdown(char * ifName, bool enabled)
{
sync.updateBpduGuardShutdown(ifName, enabled);
stpsync.updateBpduGuardShutdown(ifName, enabled);
}

void stpsync_update_port_fast(char * ifName, bool enabled)
{
sync.updatePortFast(ifName, enabled);
stpsync.updatePortFast(ifName, enabled);
}

void stpsync_del_stp_port(char * ifName)
{
sync.delStpInterface(ifName);
stpsync.delStpInterface(ifName);
}

void stpsync_clear_appdb_stp_tables(void)
{
sync.clearAllStpAppDbTables();
stpsync.clearAllStpAppDbTables();
}
}

Expand Down