Skip to content

Commit 5d78dd0

Browse files
authored
Merge pull request #2329 from yxieca/pub-3.3
[bcm SAI] enable Broadcom SAI 3.3 GA release
2 parents bff3165 + 1812d6c commit 5d78dd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4059
-1700
lines changed

platform/broadcom/sai.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
BRCM_SAI = libsaibcm_3.1.3.5-12_amd64.deb
2-
$(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"
1+
BRCM_SAI = libsaibcm_3.3.3.1-1_amd64.deb
2+
$(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"
33

4-
BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-12_amd64.deb
4+
BRCM_SAI_DEV = libsaibcm-dev_3.3.3.1-1_amd64.deb
55
$(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV)))
6-
$(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"
6+
$(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"
77

88
SONIC_ONLINE_DEBS += $(BRCM_SAI)
99
$(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI)

platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.init

+43-17
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,61 @@
1212
# Short-Description: Load OpenNSL kernel modules
1313
### END INIT INFO
1414

15+
function create_devices()
16+
{
17+
rm -f /dev/linux-knet-cb
18+
rm -f /dev/linux-bcm-knet
19+
rm -f /dev/linux-bcm-bde
20+
rm -f /dev/linux-kernel-bde
21+
22+
mknod /dev/linux-knet-cb c 121 0
23+
mknod /dev/linux-bcm-knet c 122 0
24+
mknod /dev/linux-bcm-bde c 126 0
25+
mknod /dev/linux-kernel-bde c 127 0
26+
}
27+
28+
function load_kernel_modules()
29+
{
30+
modprobe linux-kernel-bde dmasize=32M maxpayload=128
31+
modprobe linux-user-bde
32+
modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238
33+
modprobe linux-knet-cb
34+
}
35+
36+
function remove_kernel_modules()
37+
{
38+
rmmod linux-knet-cb
39+
rmmod linux-bcm-knet
40+
rmmod linux-user-bde
41+
rmmod linux-kernel-bde
42+
}
43+
1544
case "$1" in
1645
start)
17-
echo -n "Load OpenNSL kernel modules... "
46+
echo -n "Load OpenNSL kernel modules... "
1847

19-
modprobe linux-kernel-bde dmasize=32M maxpayload=128
20-
modprobe linux-user-bde
21-
modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238
48+
create_devices
49+
load_kernel_modules
2250

23-
echo "done."
24-
;;
51+
echo "done."
52+
;;
2553

2654
stop)
27-
echo -n "Unload OpenNSL kernel modules... "
55+
echo -n "Unload OpenNSL kernel modules... "
2856

29-
rmmod linux-bcm-knet
30-
rmmod linux-user-bde
31-
rmmod linux-kernel-bde
57+
remove_kernel_modules
3258

33-
echo "done."
34-
;;
59+
echo "done."
60+
;;
3561

3662
force-reload|restart)
37-
echo "Not supported"
38-
;;
63+
echo "Not supported"
64+
;;
3965

4066
*)
41-
echo "Usage: /etc/init.d/opennsl-modules-4.9.0-7-amd64.init {start|stop}"
42-
exit 1
43-
;;
67+
echo "Usage: /etc/init.d/opennsl-modules-4.9.0-7-amd64.init {start|stop}"
68+
exit 1
69+
;;
4470
esac
4571

4672
exit 0
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-7-amd64/extra
22
systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-7-amd64/extra
33
systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-7-amd64/extra
4+
systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-7-amd64/extra
45
systemd/opennsl-modules-4.9.0-7-amd64.service lib/systemd/system

platform/broadcom/saibcm-modules/debian/rules

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ kdist_config: prep-deb-files
6060
kdist_clean: clean
6161
dh_testdir
6262
dh_clean
63-
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
63+
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
6464
# rm -f driver/*.o driver/*.ko
6565
#
6666
### end KERNEL SETUP
@@ -78,7 +78,7 @@ build-arch-stamp:
7878
dh_testdir
7979

8080
# Add here command to compile/build the package.
81-
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
81+
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
8282

8383
touch $@
8484

@@ -103,7 +103,7 @@ clean:
103103
rm -f build-arch-stamp build-indep-stamp configure-stamp
104104

105105
# Add here commands to clean up after the build process.
106-
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
106+
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
107107

108108
dh_clean
109109

platform/broadcom/saibcm-modules/include/ibde.h

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

85+
#define BDE_8MB_REG_SPACE 0x10000000 /* 8MB sized CMIC BAR */
8686
#define BDE_256K_REG_SPACE 0x20000000 /* Map 256K (v 64K) */
8787
#define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */
8888
#define BDE_320K_REG_SPACE 0x80000000 /* Map 256K+64K */

platform/broadcom/saibcm-modules/include/kcom.h

+52-51
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
/*
2-
* Unless you and Broadcom execute a separate written software license
3-
* agreement governing use of this software, this software is licensed to
4-
* you under the terms of the GNU General Public License version 2 (the
5-
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
6-
* with the following added to such license:
2+
* Copyright 2017 Broadcom
73
*
8-
* As a special exception, the copyright holders of this software give
9-
* you permission to link this software with independent modules, and to
10-
* copy and distribute the resulting executable under terms of your
11-
* choice, provided that you also meet, for each linked independent
12-
* module, the terms and conditions of the license of that module. An
13-
* independent module is a module which is not derived from this
14-
* software. The special exception does not apply to any modifications
15-
* of the software.
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License, version 2, as
6+
* published by the Free Software Foundation (the "GPL").
7+
*
8+
* This program is distributed in the hope that it will be useful, but
9+
* WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
* General Public License version 2 (GPLv2) for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* version 2 (GPLv2) along with this source code.
1615
*/
1716
/*
1817
* $Id: kcom.h,v 1.9 Broadcom SDK $
1918
* $Copyright: (c) 2005 Broadcom Corp.
2019
* All Rights Reserved.$
2120
*
22-
* File: kcom.h
23-
* Purpose: User/Kernel message definitions
21+
* File: kcom.h
22+
* Purpose: User/Kernel message definitions
2423
*/
2524

2625
#ifndef _KCOM_H
@@ -37,7 +36,6 @@
3736
#define KCOM_MSG_TYPE_RSP 2 /* Command response */
3837
#define KCOM_MSG_TYPE_EVT 3 /* Unsolicited event */
3938

40-
4139
/*
4240
* Message opcodes
4341
*/
@@ -57,10 +55,11 @@
5755
#define KCOM_M_FILTER_LIST 23 /* Get list of Rx filter IDs */
5856
#define KCOM_M_FILTER_GET 24 /* Get Rx filter info */
5957
#define KCOM_M_DMA_INFO 31 /* Tx/Rx DMA info */
60-
#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
61-
#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
58+
#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
59+
#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
60+
#define KCOM_M_WB_CLEANUP 51 /* Clean up for warmbooting */
6261

63-
#define KCOM_VERSION 8 /* Protocol version */
62+
#define KCOM_VERSION 9 /* Protocol version */
6463

6564
/*
6665
* Message status codes
@@ -80,7 +79,6 @@ typedef struct kcom_msg_hdr_s {
8079
uint16 id;
8180
} kcom_msg_hdr_t;
8281

83-
8482
/*
8583
* Object types
8684
*/
@@ -267,44 +265,40 @@ typedef struct kcom_dma_info_s {
267265
uint16 chan;
268266
uint16 flags;
269267
union {
270-
void *p;
271-
uint8 b[8];
272-
} cookie;
273-
union {
274-
uint32 dcb_start;
268+
uint64 dcb_start;
275269
struct {
276270
uint32 tx;
277271
uint32 rx;
278272
} seqno;
279273
} data;
274+
union {
275+
void *p;
276+
uint8 b[8];
277+
} cookie;
280278
} kcom_dma_info_t;
281279

282280
/* Default channel configuration */
283-
#define KCOM_DMA_TX_CHAN 0
284-
#define KCOM_DMA_RX_CHAN 1
281+
#define KCOM_DMA_TX_CHAN 0
282+
#define KCOM_DMA_RX_CHAN 1
285283

286284

287285
#define KCOM_ETH_HW_T_RESET 1
288286
#define KCOM_ETH_HW_T_INIT 2
289287
#define KCOM_ETH_HW_T_OTHER 3
290288

291-
#define KCOM_ETH_HW_C_ALL 0xff
292-
293-
#define KCOM_ETH_HW_RESET_F_TX (1U << 0)
294-
#define KCOM_ETH_HW_RESET_F_RX (1U << 1)
295-
#define KCOM_ETH_HW_RESET_F_TX_RECLAIM (1U << 2)
296-
#define KCOM_ETH_HW_RESET_F_RX_RECLAIM (1U << 3)
297-
298-
#define KCOM_ETH_HW_INIT_F_TX (1U << 0)
299-
#define KCOM_ETH_HW_INIT_F_RX (1U << 1)
300-
#define KCOM_ETH_HW_INIT_F_RX_FILL (1U << 2)
301-
302-
303-
#define KCOM_ETH_HW_OTHER_F_FIFO_LOOPBACK (1U << 0)
304-
#define KCOM_ETH_HW_OTHER_F_INTERRUPT (1U << 1)
289+
#define KCOM_ETH_HW_C_ALL 0xff
305290

291+
#define KCOM_ETH_HW_RESET_F_TX (1U << 0)
292+
#define KCOM_ETH_HW_RESET_F_RX (1U << 1)
293+
#define KCOM_ETH_HW_RESET_F_TX_RECLAIM (1U << 2)
294+
#define KCOM_ETH_HW_RESET_F_RX_RECLAIM (1U << 3)
306295

296+
#define KCOM_ETH_HW_INIT_F_TX (1U << 0)
297+
#define KCOM_ETH_HW_INIT_F_RX (1U << 1)
298+
#define KCOM_ETH_HW_INIT_F_RX_FILL (1U << 2)
307299

300+
#define KCOM_ETH_HW_OTHER_F_FIFO_LOOPBACK (1U << 0)
301+
#define KCOM_ETH_HW_OTHER_F_INTERRUPT (1U << 1)
308302

309303
typedef struct kcom_eth_hw_config_s {
310304
uint8 type;
@@ -339,7 +333,6 @@ typedef struct kcom_msg_string_s {
339333
char val[KCOM_MSG_STRING_MAX];
340334
} kcom_msg_string_t;
341335

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

357-
358350
/*
359351
* Indicate that switch hardware is about to be reset. Active
360352
* DMA operations should be aborted and DMA and interrupts
@@ -371,8 +363,11 @@ typedef struct kcom_msg_hw_reset_s {
371363
*/
372364
typedef struct kcom_msg_hw_init_s {
373365
kcom_msg_hdr_t hdr;
374-
uint16 dcb_size;
375-
uint16 dcb_type;
366+
uint8 cmic_type;
367+
uint8 dcb_type;
368+
uint8 dcb_size;
369+
uint8 pkt_hdr_size;
370+
uint32 dma_hi;
376371
uint32 cdma_channels;
377372
} kcom_msg_hw_init_t;
378373

@@ -400,6 +395,14 @@ typedef struct kcom_msg_dbg_pkt_get_s {
400395
int value;
401396
} kcom_msg_dbg_pkt_get_t;
402397

398+
/*
399+
* Clean up warmboot-related resources.
400+
*/
401+
typedef struct kcom_msg_wb_cleanup_s {
402+
kcom_msg_hdr_t hdr;
403+
uint32 flags;
404+
} kcom_msg_wb_cleanup_t;
405+
403406
/*
404407
* Create new system network interface. The network interface will
405408
* be associated with the specified switch unit number.
@@ -458,8 +461,8 @@ typedef struct kcom_msg_filter_destroy_s {
458461
* Get list of currently defined packet filters.
459462
*/
460463
#ifndef KCOM_FILTER_MAX
461-
/* OPENNSL_FIXUP - Increased the filters to 1024 from 128 */
462-
#define KCOM_FILTER_MAX 1024
464+
/* SAI_FIXUP - Increased the filters to 1024 from 128 */
465+
#define KCOM_FILTER_MAX 1024
463466
#endif
464467

465468
typedef struct kcom_msg_filter_list_s {
@@ -484,11 +487,9 @@ typedef struct kcom_msg_dma_info_s {
484487
kcom_dma_info_t dma_info;
485488
} kcom_msg_dma_info_t;
486489

487-
488490
/*
489491
* All messages (e.g. for generic receive)
490492
*/
491-
492493
typedef union kcom_msg_s {
493494
kcom_msg_hdr_t hdr;
494495
kcom_msg_version_t version;
@@ -508,9 +509,9 @@ typedef union kcom_msg_s {
508509
kcom_msg_dma_info_t dma_info;
509510
kcom_msg_dbg_pkt_set_t dbg_pkt_set;
510511
kcom_msg_dbg_pkt_get_t dbg_pkt_get;
512+
kcom_msg_wb_cleanup_t wb_cleanup;
511513
} kcom_msg_t;
512514

513-
514515
/*
515516
* KCOM communication channel vectors
516517
*
@@ -538,4 +539,4 @@ typedef struct kcom_chan_s {
538539
int (*recv)(void *handle, void *msg, unsigned int bufsz);
539540
} kcom_chan_t;
540541

541-
#endif /* _KCOM_H */
542+
#endif /* _KCOM_H */

0 commit comments

Comments
 (0)