Skip to content

[bcm SAI] enable Broadcom SAI 3.3 GA release #2329

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

Merged
merged 11 commits into from
Dec 2, 2018
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
8 changes: 4 additions & 4 deletions platform/broadcom/sai.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
BRCM_SAI = libsaibcm_3.1.3.5-12_amd64.deb
$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-12_amd64.deb?sv=2015-04-05&sr=b&sig=6%2Fwcn0EN0krkXMCeOpAgo4N2d%2FgiZJAuU%2FwYhaXNpBE%3D&se=2032-08-07T16%3A57%3A37Z&sp=r"
BRCM_SAI = libsaibcm_3.3.3.1-1_amd64.deb
$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.3.1-1_amd64.deb?sv=2015-04-05&sr=b&sig=Kp6Pjrvt9DD8fThhSjzDJNuVRYuW6aLwi2bgegM0hd8%3D&se=2032-08-09T02%3A22%3A31Z&sp=r"

BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-12_amd64.deb
BRCM_SAI_DEV = libsaibcm-dev_3.3.3.1-1_amd64.deb
$(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV)))
$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-12_amd64.deb?sv=2015-04-05&sr=b&sig=9Tf4Rm0Hftx9IavbLmV6PzsxzejuUzwCRFKNmU2pAkU%3D&se=2032-08-07T16%3A57%3A08Z&sp=r"
$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.3.1-1_amd64.deb?sv=2015-04-05&sr=b&sig=fTWUp3gOcNQNT9sS66CSEyP0JkSlPHNRlsvG4L64I0g%3D&se=2032-08-09T02%3A22%3A08Z&sp=r"

SONIC_ONLINE_DEBS += $(BRCM_SAI)
$(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI)
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,61 @@
# Short-Description: Load OpenNSL kernel modules
### END INIT INFO

function create_devices()
{
rm -f /dev/linux-knet-cb
rm -f /dev/linux-bcm-knet
rm -f /dev/linux-bcm-bde
rm -f /dev/linux-kernel-bde

mknod /dev/linux-knet-cb c 121 0
mknod /dev/linux-bcm-knet c 122 0
mknod /dev/linux-bcm-bde c 126 0
mknod /dev/linux-kernel-bde c 127 0
}

function load_kernel_modules()
{
modprobe linux-kernel-bde dmasize=32M maxpayload=128
modprobe linux-user-bde
modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238
modprobe linux-knet-cb
}

function remove_kernel_modules()
{
rmmod linux-knet-cb
rmmod linux-bcm-knet
rmmod linux-user-bde
rmmod linux-kernel-bde
}

case "$1" in
start)
echo -n "Load OpenNSL kernel modules... "
echo -n "Load OpenNSL kernel modules... "

modprobe linux-kernel-bde dmasize=32M maxpayload=128
modprobe linux-user-bde
modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238
create_devices
load_kernel_modules

echo "done."
;;
echo "done."
;;

stop)
echo -n "Unload OpenNSL kernel modules... "
echo -n "Unload OpenNSL kernel modules... "

rmmod linux-bcm-knet
rmmod linux-user-bde
rmmod linux-kernel-bde
remove_kernel_modules

echo "done."
;;
echo "done."
;;

force-reload|restart)
echo "Not supported"
;;
echo "Not supported"
;;

*)
echo "Usage: /etc/init.d/opennsl-modules-4.9.0-7-amd64.init {start|stop}"
exit 1
;;
echo "Usage: /etc/init.d/opennsl-modules-4.9.0-7-amd64.init {start|stop}"
exit 1
;;
esac

exit 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-7-amd64/extra
systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-7-amd64/extra
systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-7-amd64/extra
systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-7-amd64/extra
systemd/opennsl-modules-4.9.0-7-amd64.service lib/systemd/system
6 changes: 3 additions & 3 deletions platform/broadcom/saibcm-modules/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ kdist_config: prep-deb-files
kdist_clean: clean
dh_testdir
dh_clean
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
# rm -f driver/*.o driver/*.ko
#
### end KERNEL SETUP
Expand All @@ -78,7 +78,7 @@ build-arch-stamp:
dh_testdir

# Add here command to compile/build the package.
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6

touch $@

Expand All @@ -103,7 +103,7 @@ clean:
rm -f build-arch-stamp build-indep-stamp configure-stamp

# Add here commands to clean up after the build process.
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean

dh_clean

Expand Down
26 changes: 13 additions & 13 deletions platform/broadcom/saibcm-modules/include/ibde.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
* Copyright 2017 Broadcom
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation (the "GPL").
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 (GPLv2) for more details.
*
* You should have received a copy of the GNU General Public License
* version 2 (GPLv2) along with this source code.
*/
/*
* $Id: ibde.h,v 1.27 Broadcom SDK $
Expand Down Expand Up @@ -83,6 +82,7 @@ typedef struct ibde_s {
#define BDE_BYTE_SWAP 0x01000000 /* SW byte swap */
#define BDE_NO_IPROC 0x02000000 /* Device uses two BARs, but is not iProc */

#define BDE_8MB_REG_SPACE 0x10000000 /* 8MB sized CMIC BAR */
#define BDE_256K_REG_SPACE 0x20000000 /* Map 256K (v 64K) */
#define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */
#define BDE_320K_REG_SPACE 0x80000000 /* Map 256K+64K */
Expand Down
103 changes: 52 additions & 51 deletions platform/broadcom/saibcm-modules/include/kcom.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
* Copyright 2017 Broadcom
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation (the "GPL").
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 (GPLv2) for more details.
*
* You should have received a copy of the GNU General Public License
* version 2 (GPLv2) along with this source code.
*/
/*
* $Id: kcom.h,v 1.9 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
* File: kcom.h
* Purpose: User/Kernel message definitions
* File: kcom.h
* Purpose: User/Kernel message definitions
*/

#ifndef _KCOM_H
Expand All @@ -37,7 +36,6 @@
#define KCOM_MSG_TYPE_RSP 2 /* Command response */
#define KCOM_MSG_TYPE_EVT 3 /* Unsolicited event */


/*
* Message opcodes
*/
Expand All @@ -57,10 +55,11 @@
#define KCOM_M_FILTER_LIST 23 /* Get list of Rx filter IDs */
#define KCOM_M_FILTER_GET 24 /* Get Rx filter info */
#define KCOM_M_DMA_INFO 31 /* Tx/Rx DMA info */
#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
#define KCOM_M_WB_CLEANUP 51 /* Clean up for warmbooting */

#define KCOM_VERSION 8 /* Protocol version */
#define KCOM_VERSION 9 /* Protocol version */

/*
* Message status codes
Expand All @@ -80,7 +79,6 @@ typedef struct kcom_msg_hdr_s {
uint16 id;
} kcom_msg_hdr_t;


/*
* Object types
*/
Expand Down Expand Up @@ -267,44 +265,40 @@ typedef struct kcom_dma_info_s {
uint16 chan;
uint16 flags;
union {
void *p;
uint8 b[8];
} cookie;
union {
uint32 dcb_start;
uint64 dcb_start;
struct {
uint32 tx;
uint32 rx;
} seqno;
} data;
union {
void *p;
uint8 b[8];
} cookie;
} kcom_dma_info_t;

/* Default channel configuration */
#define KCOM_DMA_TX_CHAN 0
#define KCOM_DMA_RX_CHAN 1
#define KCOM_DMA_TX_CHAN 0
#define KCOM_DMA_RX_CHAN 1


#define KCOM_ETH_HW_T_RESET 1
#define KCOM_ETH_HW_T_INIT 2
#define KCOM_ETH_HW_T_OTHER 3

#define KCOM_ETH_HW_C_ALL 0xff

#define KCOM_ETH_HW_RESET_F_TX (1U << 0)
#define KCOM_ETH_HW_RESET_F_RX (1U << 1)
#define KCOM_ETH_HW_RESET_F_TX_RECLAIM (1U << 2)
#define KCOM_ETH_HW_RESET_F_RX_RECLAIM (1U << 3)

#define KCOM_ETH_HW_INIT_F_TX (1U << 0)
#define KCOM_ETH_HW_INIT_F_RX (1U << 1)
#define KCOM_ETH_HW_INIT_F_RX_FILL (1U << 2)


#define KCOM_ETH_HW_OTHER_F_FIFO_LOOPBACK (1U << 0)
#define KCOM_ETH_HW_OTHER_F_INTERRUPT (1U << 1)
#define KCOM_ETH_HW_C_ALL 0xff

#define KCOM_ETH_HW_RESET_F_TX (1U << 0)
#define KCOM_ETH_HW_RESET_F_RX (1U << 1)
#define KCOM_ETH_HW_RESET_F_TX_RECLAIM (1U << 2)
#define KCOM_ETH_HW_RESET_F_RX_RECLAIM (1U << 3)

#define KCOM_ETH_HW_INIT_F_TX (1U << 0)
#define KCOM_ETH_HW_INIT_F_RX (1U << 1)
#define KCOM_ETH_HW_INIT_F_RX_FILL (1U << 2)

#define KCOM_ETH_HW_OTHER_F_FIFO_LOOPBACK (1U << 0)
#define KCOM_ETH_HW_OTHER_F_INTERRUPT (1U << 1)

typedef struct kcom_eth_hw_config_s {
uint8 type;
Expand Down Expand Up @@ -339,7 +333,6 @@ typedef struct kcom_msg_string_s {
char val[KCOM_MSG_STRING_MAX];
} kcom_msg_string_t;


/*
* Indicate that eth hardware is about to be reset. Active
* DMA operations should be aborted and DMA and interrupts
Expand All @@ -354,7 +347,6 @@ typedef struct kcom_msg_eth_hw_config_s {
kcom_eth_hw_config_t config;
} kcom_msg_eth_hw_config_t;


/*
* Indicate that switch hardware is about to be reset. Active
* DMA operations should be aborted and DMA and interrupts
Expand All @@ -371,8 +363,11 @@ typedef struct kcom_msg_hw_reset_s {
*/
typedef struct kcom_msg_hw_init_s {
kcom_msg_hdr_t hdr;
uint16 dcb_size;
uint16 dcb_type;
uint8 cmic_type;
uint8 dcb_type;
uint8 dcb_size;
uint8 pkt_hdr_size;
uint32 dma_hi;
uint32 cdma_channels;
} kcom_msg_hw_init_t;

Expand Down Expand Up @@ -400,6 +395,14 @@ typedef struct kcom_msg_dbg_pkt_get_s {
int value;
} kcom_msg_dbg_pkt_get_t;

/*
* Clean up warmboot-related resources.
*/
typedef struct kcom_msg_wb_cleanup_s {
kcom_msg_hdr_t hdr;
uint32 flags;
} kcom_msg_wb_cleanup_t;

/*
* Create new system network interface. The network interface will
* be associated with the specified switch unit number.
Expand Down Expand Up @@ -458,8 +461,8 @@ typedef struct kcom_msg_filter_destroy_s {
* Get list of currently defined packet filters.
*/
#ifndef KCOM_FILTER_MAX
/* OPENNSL_FIXUP - Increased the filters to 1024 from 128 */
#define KCOM_FILTER_MAX 1024
/* SAI_FIXUP - Increased the filters to 1024 from 128 */
#define KCOM_FILTER_MAX 1024
#endif

typedef struct kcom_msg_filter_list_s {
Expand All @@ -484,11 +487,9 @@ typedef struct kcom_msg_dma_info_s {
kcom_dma_info_t dma_info;
} kcom_msg_dma_info_t;


/*
* All messages (e.g. for generic receive)
*/

typedef union kcom_msg_s {
kcom_msg_hdr_t hdr;
kcom_msg_version_t version;
Expand All @@ -508,9 +509,9 @@ typedef union kcom_msg_s {
kcom_msg_dma_info_t dma_info;
kcom_msg_dbg_pkt_set_t dbg_pkt_set;
kcom_msg_dbg_pkt_get_t dbg_pkt_get;
kcom_msg_wb_cleanup_t wb_cleanup;
} kcom_msg_t;


/*
* KCOM communication channel vectors
*
Expand Down Expand Up @@ -538,4 +539,4 @@ typedef struct kcom_chan_s {
int (*recv)(void *handle, void *msg, unsigned int bufsz);
} kcom_chan_t;

#endif /* _KCOM_H */
#endif /* _KCOM_H */
Loading