CPCI-910 Programmer's Guide - Emerson Network Power
CPCI-910 Programmer's Guide - Emerson Network Power
CPCI-910 Programmer's Guide - Emerson Network Power
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>CPCI</strong>-<strong>910</strong><br />
Programmer’s <strong>Guide</strong><br />
P/N 221014 Revision AD<br />
April 2004
The information in this publication is subject to change without notice. Force Computers reserves the right to make changes without<br />
notice to this, or any of its products, to improve reliability, performance, or design.<br />
Force Computers shall not be liable for technical or editorial errors or omissions contained herein, nor for indirect, special, incidental,<br />
or consequential damages resulting from the furnishing, performance, or use of this material. This information is provided<br />
“as is” and Force Computers expressly disclaims any and all warranties, express, implied, statutory, or otherwise, including<br />
without limitation, any express, statutory, or implied warranty of merchantability, fitness for a particular purpose, or non-infringement.<br />
This publication contains information protected by copyright. This publication shall not be reproduced, transmitted, or stored in<br />
a retrieval system, nor its contents used for any purpose, without the prior written consent of Force Computers.<br />
Force Computers assumes no responsibility for the use of any circuitry other than circuitry that is part of a product of Force<br />
Computers. Force Computers does not convey to the purchaser of the product described herein any license under the patent<br />
rights of Force Computers nor the rights of others.<br />
Copyright© 2004 by Force Computers. All rights reserved.<br />
The Force logo is a trademark of Force Computers.<br />
Copyright<br />
IEEE is a registered trademark of the Institute for Electrical and Electronics Engineers, Inc.<br />
PICMG, CompactPCI, and the CompactPCI logo are registered trademarks and the PICMG logo is a trademark of the PCI Industrial<br />
Computer Manufacturer’s Group.<br />
MS-DOS, Windows95, Windows98, Windows2000 and Windows NT are registered trademarks and the logos are a trademark of<br />
the Microsoft Corporation.<br />
Intel and Pentium are registered trademarks and the Intel logo is a trademark of the Intel Corporation.<br />
StrongARM is a registered trademark of ARM, Limited.<br />
Linux is a registered trademark of Linus Torvalds.<br />
Broadcom is a registered trademark of the Broadcom Corporation.<br />
Other product names mentioned herein may be trademarks and/or registered trademarks of their respective companies.
221014 410 000 AD<br />
World Wide Web: www.forcecomputers.com<br />
24-hour access to on-line manuals, driver updates, and application<br />
notes is provided via SMART, our SolutionsPLUS customer support<br />
program that provides current technical and services information.<br />
Headquarters<br />
The Americas Europe Asia<br />
Corporate Headquarters/CA<br />
Force Computers<br />
4211 Starboard Drive<br />
Fremont, CA 94538<br />
Tel.: +1 510 624-8274<br />
Fax: +1 510 445-6007<br />
Email: support@fci.com<br />
Force Computers GmbH<br />
Lilienthalstr. 15<br />
D-85579 Neubiberg/München<br />
Germany<br />
Tel.: +49 (89) 608 14-0<br />
Fax: +49 (89) 609 77 93<br />
Email: support-de@fci.com<br />
Force Computers Japan KK<br />
Shibadaimon MF Building 4F<br />
2-1-16 Shiba Daimon<br />
Minato-ku, Tokyo 105-0012 Japan<br />
Tel.: +81 (03) 3437 6221<br />
Fax: +81 (03) 3437 6223<br />
Email: support-de@fci.com
Using This Manual<br />
Other Sources of Information<br />
1 Introduction<br />
Contents<br />
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3<br />
Software Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3<br />
Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3<br />
Linux Support Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4<br />
Switching Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4<br />
Packet Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5<br />
JFFS Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5<br />
JFFS Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5<br />
Message Passing Using Sentinel (PCI-PCI Bridge) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6<br />
Watchdog Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6<br />
Software Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7<br />
BCM Demo Software and BCM CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-7<br />
MAC Numbers in Boot Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12<br />
Support for IXP1250 Microcode Development IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12<br />
2 API Call Reference<br />
<strong>CPCI</strong>-<strong>910</strong> v
List of APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3<br />
Virtual Local Area <strong>Network</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4<br />
Address Resolution Table Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8<br />
Filter Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14<br />
Steps To Create a Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20<br />
Register Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22<br />
MIIM APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23<br />
Interrupt Control APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24<br />
PCI Config Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25<br />
PCI Memory Mapped Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26<br />
Indirect Mapped Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27<br />
Trunking (Link Aggregation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28<br />
Trunk Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34<br />
Stacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35<br />
PTABLE Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37<br />
Packet Driver APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38<br />
Port-Related APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-40<br />
Port Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-54<br />
L3 Support APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-57<br />
L3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-58<br />
L3 Interface Table Related APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-58<br />
L3 Table APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-60<br />
L3 DEFIP Table APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64<br />
Multicast Table Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68<br />
Mirror APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71<br />
CoSQ Management APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75<br />
Flash API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-79<br />
Watchdog APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-79<br />
A Error Codes<br />
Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3<br />
B Project Configuration and Example Design<br />
Project Configuration and Example Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3<br />
Building Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-3<br />
Example Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-6<br />
Modifying Example Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-6<br />
vi <strong>CPCI</strong>-<strong>910</strong>
Receive Processing for Receive Microengine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .B-6<br />
Transmitting Packets for Receive Microengine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .B-7<br />
Transmitting Packet Details for Transmit Microengine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .B-8<br />
Index of Functions<br />
Product Error Report<br />
<strong>CPCI</strong>-<strong>910</strong> vii
viii <strong>CPCI</strong>-<strong>910</strong>
Figures<br />
Introduction<br />
Figure 1 Software Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7<br />
Figure 2 Architecture of BCM Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8<br />
API Call Reference<br />
Figure 3 Copper Daughter Card Port Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56<br />
Figure 4 Fiber Optic Daughter Card Port Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-57<br />
<strong>CPCI</strong>-<strong>910</strong> vii
viii <strong>CPCI</strong>-<strong>910</strong>
Using This Manual<br />
Conventions<br />
Abbreviations<br />
This Programmer’s guide is for designers, developers, and system integrators<br />
who design and build <strong>CPCI</strong>-<strong>910</strong> modules into application systems.<br />
Manufacturing and field technicians and support specialists can also use<br />
the information in this manual to help configure systems and diagnose<br />
problems.<br />
The guide assumes you have experience with system design and the<br />
module’s bus design and specifications. In addition, you must also be<br />
familiar with Linux TM Operating Systems both as a user and as a<br />
programmer.<br />
This manual describes how to use the dual stacked/cascaded Gigabit<br />
Multilayer Switch Broadcom BCM5680.<br />
Notation Description<br />
57 All numbers are decimal numbers except when used with the following<br />
notations:<br />
00000000 16<br />
0000 2<br />
Typical notation for hexadecimal numbers (digits are 0 through F),<br />
e.g. used for addresses and offsets.<br />
Same for binary numbers (digits are 0 and 1)<br />
Bold Character format used to emphasize a word<br />
Courier Character format used for user input/on-screen output<br />
Italics<br />
<br />
[text]<br />
Note:<br />
Character format for references and for table and figure descriptions.<br />
Typical notation used for variables and keys.<br />
Typical notation for buttons.<br />
No danger encountered. Pay attention to important information<br />
marked using this layout.<br />
API Application Programming Interface<br />
ARL Address Resolution Logic<br />
<strong>CPCI</strong>-<strong>910</strong> ix
BIB Board Information Block<br />
CMIC CPU Management Interface Controller<br />
CoS Class of Service<br />
<strong>CPCI</strong> Compact PCI<br />
CRC Cyclic Redundancy Check<br />
DLF Destination Lookup Failure<br />
Flash Utility<br />
(FUtil)<br />
Utility to update Flash, available as part of Boot Manager<br />
FFP Fast Filter Processor<br />
IBMU Intelligent Base Board Management Unit<br />
IP Internet Protocol<br />
IPMI Intelligent Platform Management Interface<br />
JFSS Journalling Flash File System<br />
OS Operating System<br />
PCI Peripheral Component Interconnect Bus<br />
RFIFO Receive First in First Out<br />
SA Strong Arm<br />
SDK Software Development Kit<br />
SLF Source Lookup Failure<br />
SOP Start Of Packet<br />
TFTP Trivial File Transfer Protocol<br />
x <strong>CPCI</strong>-<strong>910</strong>
Revision History<br />
Document<br />
Number, P/N, or<br />
Order Number<br />
Document<br />
Number 19-<br />
0010-01<br />
P/N<br />
<strong>CPCI</strong><strong>910</strong>PG<br />
Revision Date Description<br />
A June 2002 Initial Release<br />
B September<br />
2002<br />
<strong>CPCI</strong><strong>910</strong>PG C November<br />
2002<br />
<strong>CPCI</strong><strong>910</strong>PG D January<br />
2003<br />
Added IPMI Application Usage information<br />
Editorial changes<br />
Adopted SAP P/N with elimination of<br />
document number<br />
Added “Packet Driver” page 1-5<br />
Modified Figure 1 “Software Architecture”<br />
page 1-7<br />
Added “BCM Demo Software and BCM<br />
CLI” page 1-7 and “Packet Driver APIs”<br />
page 2-38<br />
Editorial Changes<br />
Address ranges modified in section<br />
“JFFS Support” page 1-5<br />
Added note under section “Linux Support<br />
Package” page 1-4<br />
Modified note in section “Packet Driver”<br />
page 1-5<br />
Modified Figure 2 “Architecture of BCM<br />
Software” page 1-8<br />
Modified note in section “List of APIs”<br />
page 2-3<br />
Removed all init APIs<br />
Added section “Steps To Create a Filter”<br />
page 2-20<br />
Added section “Trunk Usage” page 2-34<br />
Added section “Port Configurations”<br />
page 2-54<br />
<strong>CPCI</strong>-<strong>910</strong> xi
Document<br />
Number, P/N, or<br />
Order Number<br />
Order Number<br />
221014 410 000<br />
Order Number<br />
221014 410 000<br />
Order Number<br />
221014 410 000<br />
Order Number<br />
221014 410 000<br />
Revision Date Description<br />
AA July 2003 Release F1.1<br />
Replaced P/N with Order Number<br />
Editorial Changes<br />
Changes made for F1.1<br />
AB September<br />
2003<br />
AC February<br />
2004<br />
Release F1.2.<br />
Added note for auto negotiation.<br />
Release F1.3<br />
Corrected information related to daughter<br />
card ports<br />
AD April 2004 Release F1.4<br />
Improved the status of APIs by adding<br />
include files<br />
Included new index<br />
xii <strong>CPCI</strong>-<strong>910</strong>
Other Sources of Information<br />
For further information refer to the following documents:<br />
Company URL Document<br />
Intel ®<br />
Broadcom ®<br />
www.intel.com Intel ® IXP 1200 Software development Kit<br />
version 2.0.1 documentation<br />
futil.txt and bootMgr.txt available with<br />
Boot Manager code<br />
Cygmon BSP for IXA SDK 2.0 User <strong>Guide</strong><br />
Revision 1.3<br />
Cygmon_readme_ixm1200.doc available<br />
with Cygmon code<br />
README file for building Cygmon<br />
www.broadcom.com Broadcom ® 5680 Development Kit,<br />
version 3.0.1 documentation<br />
<strong>CPCI</strong>-<strong>910</strong> xiii
xiv <strong>CPCI</strong>-<strong>910</strong>
1<br />
Introduction
Introduction Introduction<br />
Introduction<br />
Software Details<br />
Firmware<br />
<strong>CPCI</strong>-<strong>910</strong> is a dual Intel IXP1250 <strong>Network</strong> Processor Compact Peripheral<br />
Component Interconnect (CompactPCI) board that can operate in the peripheral<br />
slot. It has two cascaded/stacked Broadcom Gigabit switches (BCM5680) to<br />
provide Layer 2 switching capabilities. <strong>CPCI</strong>-<strong>910</strong> provides four Gigabit Ethernet<br />
Interfaces each through front panel, daughter card, RTB, and two Gigabit Ethernet<br />
Interfaces to the CompactPCI Packet Switching Backplane (PSB) which conforms<br />
to PICMG 2.16 standards.<br />
<strong>CPCI</strong>-<strong>910</strong> Software consists of:<br />
• Firmware<br />
• Linux Support Package<br />
• Switching Software<br />
• Boot Firmware<br />
Firmware begins to execute after a cold or warm IXP 1250 reset. There is an initial<br />
boot phase, which is called Boot Manager, in Intel ® SDK terminology. This presents<br />
a menu using which the user may boot to any one of the following:<br />
– Cygmon<br />
– minilinux<br />
– Diagnostics<br />
– VxWorks<br />
Cygmon is a bootstrap loader firmware that enables booting Linux.<br />
• Diagnostics Firmware<br />
It is a menu-based set of utilities to diagnose the functionalities of various components<br />
on board. The health of components such as IXBus, IXF1002, IPMI,<br />
SDRAM and so on can be checked using this firmware. Diagnostics firmware can<br />
be invoked from Boot Manager command prompt.<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 3
Introduction Introduction<br />
Linux Support Package<br />
The Linux Support Package consists of the Linux kernel and driver modules such<br />
as:<br />
• BCM driver modules<br />
• Microengine modules<br />
• IXF 1002 Driver<br />
• peth Driver<br />
• Flash Driver<br />
• Montavista’s open IPMI Driver<br />
Switching Software<br />
Note: <strong>CPCI</strong><strong>910</strong> software does not support hotswap functionality in system<br />
slot.<br />
The OS image for both the Master and Slave IXP is derived from the same Linux<br />
source tree. Linux is aware of the Master Slave feature and is able to determine its<br />
role during run time using hardware registers.<br />
Linux Support Package can:<br />
• automatically detect if the IXP is monarch or Non-monarch at run time.<br />
• manage own devices such as serial port and Flash through standard Linux<br />
device drivers.<br />
• initialize and manage its own microengines and internal devices on the chip.<br />
• provide support for access to microengine features (based on Intel ® SDK 2.0).<br />
• support Journalling Flash File System (JFSS) for User Flash<br />
Note: PCI I/O access beyond bridge should always be 32-bit<br />
Switching Software consists of Broadcom 5680 Driver and <strong>CPCI</strong>-<strong>910</strong> Switch APIs.<br />
The Switch APIs provide application writer-access to all hardware features of<br />
switch. Switch APIs are part of SDK module. The driver code uses API functions<br />
to initialize the switch. Driver module depends on SDK module for its loading.<br />
Note: Ensure that you refer to the latest Release Notes for current<br />
information and any changes.<br />
1 - 4 <strong>CPCI</strong>-<strong>910</strong>
Introduction Introduction<br />
Packet Driver<br />
JFFS Support<br />
JFFS Usage<br />
The packet driver is a pseudo Ethernet driver. It offers all the functions of typical<br />
Ethernet driver. This is visible in Linux as an Ethernet interface. The packet driver<br />
makes use of Gigabit switch APIs to send and receive packets to and from a network<br />
attached to Gigabit switch ports. Packets sent using this interface from Linux<br />
are sent to the Gigabit switch over PCI DMA. Packets destined for packet driver<br />
interface are also sent to it by the Gigabit switch over PCI DMA. This pseudo<br />
Ethernet interface has been named as bcmnet.The driver is shipped as part of<br />
Ramdisk. Following commands are needed to invoke packet driver action.:<br />
$insmod /lib/modules/bcmnet.o<br />
$ifconfig bcmnet up<br />
Note: The packet driver interface is not a high performance interface. The<br />
packet driver interface should be used only for control plane applications.<br />
Partitions made are:<br />
• Boot Partition from 0x0 - 0x80000 , which is not programmable.<br />
• Mini-linux partition from 0x200000 - 0x400000<br />
• Kernel partition from 0x420000 - 0x4e0000.<br />
• Ramdisk partition from 0x4e0000 - 0x800000.<br />
The MTD devices are /dev/mtd0,1,2,3 as character devices, and<br />
/dev/mtdblock0,1,2,3 are the corresponding block devices. Except for<br />
/dev/mtd0 and /dev/mtdblock0, all the other devices are write enabled.<br />
First read the file, /proc/mtd to see all the partitions.Use utility, mkfs.jffs<br />
in /cpci<strong>910</strong> directory to create a JFFS file-system.<br />
Create a JFFS file system:<br />
# /redlion/eraseall /dev/mtd1[2, 3]<br />
Note: eraseall should be used only when the entire partition contents<br />
(JFFS) has to be removed. It is suggested to execute eraseall before first<br />
mount.<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 5
Introduction Introduction<br />
Mount the jffs file system:<br />
#mount -t jffs /dev/mtdblock1(2 or 3) <br />
Unmount the JFFS file system:<br />
#umount <br />
For further details, please refer to mtd-jffs-HOWTO.txt available on Internet.<br />
Message Passing Using Sentinel (PCI-PCI Bridge)<br />
Sentinel is a universal PCI-to-PCI bridge. The most important feature is the dual<br />
nature. The CompactPCI signal SYSEN# is used to differentiate between slot 1(the<br />
system slot) and any other CompactPCI slot. This makes the board with Sentinel<br />
chip, compatible with any slot, and the Sentinel chip behaves in appropriate mode.<br />
Prerequisites The system slot board should be able to scan the peripheral board and should allocate<br />
a memory window to the device.<br />
Sentinel driver can work both in system slot and peripheral slot with messaging<br />
feature enabled. This driver basically enables sentinel chip to communicate with<br />
the system slot board. A sample code is provided for communicating with the sentinel<br />
in peripheral slot and any other board in the system slot.<br />
A system slot board can post messages to the peripheral board by writing into the<br />
Inbound Post List FIFO register in the Device specific register space of Peripheral<br />
Sentinel. This space has to be mapped into the memory and should not be used<br />
from configuration space. Whenever a message is posted, the sentinel on the<br />
peripheral board will generate an interrupt which will be serviced by the driver.<br />
Driver is responsible for reading the head pointer from the Inbound Post List FIFO<br />
register and should process all the messages in between the head pointer and the tail<br />
pointer.<br />
Watchdog Implementation<br />
The <strong>CPCI</strong>-<strong>910</strong> board has implementation of watchdog, SHORTDOG, to monitor<br />
program execution in both the network processors, IXP-A and IXP-B. The Linux<br />
kernel provides APIs to arm, disarm, and refresh the shortdog for both IXP-A and<br />
IXP-B.<br />
1 - 6 <strong>CPCI</strong>-<strong>910</strong>
Introduction Software Architecture<br />
Software Architecture<br />
BCM API DEMO<br />
APPLICATION<br />
bcm_appln<br />
BCM API DEMO<br />
MODULE<br />
bcm_mtest.o<br />
switchconfig<br />
FACTORY<br />
DEFAULT UTILITY<br />
bcmsdk.o<br />
BCM SDK MODULE<br />
*BCM 5680<br />
Figure 1: Software Architecture<br />
BCM Demo Software and BCM CLI<br />
The software architecture is shown below in Figure 1:<br />
frc_bcm_drv.o<br />
BCM DRIVER<br />
MODULE<br />
TCP/IP<br />
APPLICATIONS<br />
JFFS<br />
FLASH DRIVER<br />
LINUX TCP/IP STACK<br />
PACKET DRIVER<br />
IXP1250<br />
IXP1250<br />
*StrongARM TM CORE<br />
MICROCODE<br />
LOADER<br />
MICROENGINE<br />
DRIVER<br />
MICROCODE<br />
APPLICATION<br />
TCP/IP<br />
APPLICATIONS<br />
LINUX TCP/IP STACK<br />
*MICROENGINES<br />
PETH DRIVER<br />
IXF1002 DRIVER<br />
USER<br />
LEVEL<br />
LINUX<br />
KERNEL<br />
* Indicates names are registered trademarks and copyright of their respective manufacturers<br />
The BCM Demo Software has a modular architecture. It consists of a user level<br />
application, bcm_appln, provided as a command line interface and a kernel module<br />
(bcm_mtest.o). You can use the Command Line Interface (CLI) for configuring<br />
VLAN, Trunk etc. The architecture of the BCM Demo Software is shown in<br />
Figure 2 “Architecture of BCM Software” page 1-8.<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 7<br />
*IXF1002<br />
IPMI<br />
UTILITY<br />
Open IPMI Driver<br />
HARDWARE<br />
IPMI Firmware and<br />
Hardware
Software Architecture Introduction<br />
Invoking the BCM<br />
CLI<br />
USER<br />
SPACE<br />
KERNEL<br />
SPACE<br />
CLI<br />
(bcm_appln)<br />
ioctls<br />
Test Module<br />
(bcm_mtest.o)<br />
Figure 2:Architecture of BCM Software<br />
Factory default utility<br />
switchconfig<br />
Functional<br />
Interface<br />
(Exported<br />
Functions)<br />
BCM SDK Module<br />
bcmsdk.o<br />
CLI interacts with the test module through ioctls . The BCM driver is a<br />
character driver and consists of two subsections (API and Linux Character Driver).<br />
The API has functions for configuring VLAN, Stack, Trunk etc. and various<br />
initialization routines. BCM Driver exports all these functions to the Linux kernel.<br />
The test module invokes these exported functions. You can invoke the BCM CLI at<br />
the command prompt. The CLI is a menu driven and self explanatory application.<br />
At the Linux prompt type bcm_appln to invoke the BCM CLI. You will see the<br />
following output on screen:<br />
[root@Linux /root]$bcm_appln<br />
0 : EXIT TESTING<br />
1 : PCI<br />
2 : VLAN<br />
3 : Port based VLAN<br />
4 : ARL<br />
5 : TRUNK<br />
6 : STACK<br />
7 : FILTER -- FFP<br />
8 : READ REGISTER CONTENTS<br />
9 : MIIM Test<br />
10 : PORT<br />
11 : INTERRUPT<br />
12 : L3<br />
13 : COS<br />
14 : MULTICAST<br />
1 - 8 <strong>CPCI</strong>-<strong>910</strong><br />
ioctl
Introduction Software Architecture<br />
15 : MIRROR<br />
Select the API to test[0 - 15]--><br />
Refer to see the “API Call Reference” chapter for information on APIs.<br />
Factory Default Utility Switchconfig is a factory default utility to configure Broadcom switches on<br />
<strong>CPCI</strong><strong>910</strong> at boot time. Switchconfig executes from runlevel 3 init script and<br />
allows to configure VLANs, trunks, port, stacking, and so on by means of the<br />
default config file, config.bcm<br />
config.bcm provides the following options:<br />
• STACK<br />
This command allows to stack both switches on <strong>CPCI</strong><strong>910</strong>. For details on stacking<br />
feature on Broadcom switches, please refer 'Theory of operations' of BCM56XX<br />
switches.<br />
SYNTAX ||<br />
Note:<br />
• Stack mode is always in the duplex mode, which is derived from <strong>CPCI</strong><strong>910</strong><br />
hardware design.<br />
• Stacking count is set to '1' because of duplex mode.<br />
• For more information, see file, stack.c<br />
Example:<br />
A2 | B1 |<br />
OVER:<br />
By default, switches are configured in cascaded mode. Ports involved in cascading/stacking<br />
are hard wired on <strong>CPCI</strong><strong>910</strong>. Therefore, the ports shown in default config<br />
file should not be modified.<br />
Port number 2 of switch A and port number 1 of switch B are hard wired on board<br />
for cascading/stacking purposes.<br />
• TRUNK<br />
This command allows you to create trunk. The syntax for trunk configuration is as<br />
follows:<br />
SYNTAX TID |PORTS | PSC |BCAST_PORT|<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 9
Software Architecture Introduction<br />
VLAN<br />
INPUT<br />
Note: Only the broadcast port will appear in VLAN.<br />
Example:<br />
0 | A4,A5 | 1 | A4 |<br />
4 | B3,B4 | 1 | B3 |<br />
OVER:<br />
TID Trunk id to be created.<br />
PORTS List of trunk members separated by commas.<br />
PSC Port selection criteria.<br />
BCAST_POR<br />
T<br />
Designated broadcast/DLF port for trunk.<br />
Note: All the fields are separated by '|' character.<br />
• VLAN<br />
This command allows you to create tagged vlans. The syntax for vlan configuration<br />
is as follows:<br />
SYNTAX | | |<br />
INPUT<br />
Note: Stack ports should not be included in untagged members.<br />
Example:<br />
2 | A0,A1,A2,A3,A4,A5,A6,A7 | A0,A1,A3,A4,A5,A6,A7 |<br />
3 | B0,B1,B2,B3,B4,B5,B6,B7 | B0,B2,B3,B4,B5,B6,B7 |<br />
OVER:<br />
VLANID vlan id to be created.<br />
1 - 10 <strong>CPCI</strong>-<strong>910</strong>
Introduction Software Architecture<br />
TAGGED<br />
VLAN<br />
PORTS<br />
UNTAGGED<br />
VLAN<br />
PORTS<br />
PORTCONTROL<br />
AUTOLEARN<br />
Comma separated list of vlan members.<br />
Comma separated list of untagged members of vlan.<br />
Note:<br />
• Ports specified in UNTAGGED VLAN PORTS are subset of TAGGED<br />
VLAN PORTS.<br />
• The field separation character '|' is very important. If there are no<br />
untagged members in a vlan, the last '|' char is still required.<br />
• Port related configuration<br />
The syntax for vlan configuration is as follows:<br />
SYNTAX PORTS| SPEEDMODE | or PORTS| ON |<br />
Note:<br />
• Either you can force ports to a particular speed and mode or, you can set<br />
them in auto-negotiate mode.<br />
• The possible SPEEDMODEs are 10H, 10F, 100H, 100F, 1000H, 1000F<br />
• Multiple port listing is separated by the ',' seperator.<br />
Example:<br />
A3 | 10H |<br />
A4 | 100F |<br />
A0,A1,A2,A5,A6,A7,B1,B6,B2,B3,B4,B0,B7,B5| ON |<br />
OVER:<br />
This command allows you to control port speed.<br />
• Port learning<br />
Port learning allows you to configure MAC address learning behavior on each port.<br />
The syntax is as follows.<br />
SYNTAX PORTS| ALFLAG|<br />
The valid values for ALFLAG are the following:<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 11
Software Architecture Introduction<br />
5- Learn ARL, do not send to CPU for learning, switch the packet<br />
2- Do not learn ARL, send to CPU for learning, do not switch the packet<br />
7- Learn ARL, send to CPU for learning, switch the packet<br />
4- Do not learn ARL, do not send to CPU for learning, switch the packet<br />
0- Do not learn ARL, do not send to CPU for learning, do not switch the packet<br />
Example:<br />
A0 | 5 | A1 | 5 | A2 | 5 | A3 | 5 | A4 | 5 | A5 | 5 | A6 | 5 | A7 |<br />
5 |<br />
B0 | 5 | B1 | 5 | B2 | 5 | B3 | 5 | B4 | 0 | B5 | 5 | B6 | 5 | B7 |<br />
5 |<br />
#OVER:<br />
MAC Numbers in Boot Flash<br />
There are 21 unique MAC numbers stored in Boot Flash. Devices requiring unique<br />
MAC numbers can read the MAC numbers by executing an API. The API for reading<br />
MAC number is available in API call reference section.<br />
The following tabulates the distribution of MAC numbers among various devices:<br />
Table 1:Distribution of MAC Numbers Among Devices<br />
MAC Number Device Using MAC Number<br />
0 Peth0 of IXP A<br />
1 Peth1 of IXP A<br />
2 Peth0 of IXP B<br />
3 Peth1 of IXP B<br />
4 BCM packet driver<br />
Support for IXP1250 Microcode Development IDE<br />
Intel IXP1250 microcode development IDE requires support from the target board.<br />
<strong>CPCI</strong><strong>910</strong> supports IXP1250 microcode development IDE. IDE running on Windows<br />
NT machine can load microcode on microengines on <strong>CPCI</strong><strong>910</strong>. This is a very<br />
useful feature during development phase. For details on IXP1250 microcode development<br />
IDE, you can refer Intel documentation.<br />
The following steps should be carried out to create a ramdisk for IDE support:<br />
1. Mount the ramdisk using the following command<br />
1 - 12 <strong>CPCI</strong>-<strong>910</strong>
Introduction Software Architecture<br />
#gunzip ramdisk_img.gz; mount -t ext2 -o loop ramdisk_img ./mnt<br />
2. Do not run /etc/rc.d/init.d/ueinit on boot<br />
#mv /etc/rc.d/rc3.d/S52ueinit /etc/rc.d/rc3.d/K52ueinit<br />
3. Make /etc/rc.d/init.d/rsudebuginit run on boot<br />
#cd /etc/rc.d/rc3.d ; ln -s ../init.d/rsudebuginit S52rsudebuginit<br />
4. Unmount the ramdisk<br />
#umount ./mnt; gzip ramdisk_img<br />
Use the modified ramdisk for development.<br />
Note: Only IXP-A microengines can be controlled by IDE. Therefore, init<br />
script loads sample microcode (/cpci<strong>910</strong>/bonsai.uof) on IXP-B microengines.<br />
<strong>CPCI</strong>-<strong>910</strong> 1 - 13
Software Architecture Introduction<br />
1 - 14 <strong>CPCI</strong>-<strong>910</strong>
2<br />
API Call Reference
API Call Reference List of APIs<br />
List of APIs<br />
The Broadcom BCM5680 APIs reside in a kernel space. All API calls of<br />
Broadcom SDK are exported to the kernel. You can access these functions by<br />
writing a kernel module. The logical grouping of exported functions are:<br />
• Virtual Local Area <strong>Network</strong><br />
• Address Resolution Logic<br />
• Filters<br />
• Register Access<br />
• Trunking<br />
• Stacking<br />
• PTABLE Management<br />
• Packet Driver API<br />
• Port related API<br />
• L3 features<br />
• Multicast table management<br />
• Mirroring<br />
• CoSQ Management<br />
• MAC read<br />
• Watchdog support<br />
Each of these are detailed in this chapter.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 3
List of APIs API Call Reference<br />
Note:<br />
Virtual Local Area <strong>Network</strong><br />
int bcm_vlan_create (int unit, int vid)<br />
• Unit= 0 refers to BCM switch connected to IXP-A and unit=1 refers to<br />
BCM switch connected to IXP-B<br />
• The term “Input” used in this chapter is a parameter that must be<br />
passed to the function.<br />
• The term “Output” used in this chapter is the result of the function.<br />
• The term “Return” used in this chapter is the value returned by the<br />
function.<br />
• Refer to the “Error Codes” page A-3 for details on error codes that<br />
are returned.<br />
Please look into file src/tulsi_drivers/bcm_cli_kern/error.h for definitions<br />
of error codes.<br />
• Valid port numbers are 0 to 7 for gigabit ports and 27 for CPU port<br />
The BCM SDK API layer provides the capability to manipulate the Virtual<br />
Local Area <strong>Network</strong> (VLAN) configuration of the system. This provides full<br />
access to the bitmaps associated with each VLAN and ensures consistency<br />
within the system.<br />
Basic VLAN configuration allows the creation and destruction of VLANs and<br />
the addition and removal of ports from a VLAN. The BCM API layer maintains<br />
consistency between trunking, VLAN configuration and port-based<br />
VLAN configuration.<br />
Port based VLAN determines the VLAN tag that is assigned to untagged<br />
packets arriving on that port. These packets may or may not exit with the tag<br />
depending on the configuration of that VLAN.<br />
DESCRIPTION Allocates and configure a VLAN on the Broadcom switching device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
Unit Unit number (driver internal)<br />
2 - 4 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
Vid VLAN ID to create, as described in the IEEE 802.1q Standard<br />
RETURN VALUE<br />
BCM_E_VLAN_EXISTS (VLAN ID already in use)<br />
BCM_E_XXX<br />
int bcm_vlan_destroy (int unit, int vid)<br />
BCM_E_NONE (Success)<br />
DESCRIPTION Deallocates VLAN from the device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
unit Unit number (driver internal)<br />
RETURN VALUE<br />
BCM_E_VLAN_ID - (Cannot remove default VLAN.)<br />
BCM_E_NONE (Success)<br />
Note: The default VLAN cannot be destroyed.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 5
List of APIs API Call Reference<br />
int bcm_vlan_destroy_all (int unit)<br />
DESCRIPTION Deallocates all VLANs from the device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
unit Unit number (driver internal)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Note: The default VLAN cannot be destroyed. See vlan_destroy.<br />
2 - 6 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
int bcm_vlan_port_add (int unit, int vid, unsigned int pbmb, unsigned int ubmp)<br />
DESCRIPTION Adds ports to the specified VLAN<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
Unit Unit number (driver internal)<br />
Vid VLAN ID to add port to as a member<br />
Pbmp Direct bitmap<br />
Ubmp Bitmap specifying untagged members of VLAN. Outgoing packets to these<br />
ports will not contain the 802.1q Tag Header<br />
RETURN VALUE<br />
BCM_E_VLAN_NOT_FOUND - (VLAN ID does not exist)<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Note: The port bitmap specifies ALL ports to be added the VLAN. The<br />
untagged bitmap specifies the subset of these ports that are untagged.<br />
int bcm_vlan_port_remove (int unit, int vid, unsigned int pbmp)<br />
DESCRIPTION Removes the specified ports from the given VLAN<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
unit Unit number (driver internal)<br />
Vid VLAN ID from which the port(s) will be removed<br />
Pbmp Bitmap specifying VLAN members<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 7
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_VLAN_NOT_FOUND (VLAN ID does not exist)<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_vlan_port_get (int unit, int vid, unsigned int *pbmp, unsigned int *ubmp)<br />
DESCRIPTION Retrieves the ports assigned to an existing VLAN<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/vlan.h<br />
INPUT<br />
unit Unit number (driver internal)<br />
Vid VLAN ID. to lookup<br />
Pbmp (OUT) member port bitmap (ignored if NULL)<br />
Ubmp (OUT) untagged port bitmap (ignored if NULL)<br />
RETURN VALUE<br />
BCM_E_VLAN_NOT_FOUND - (No such VLAN defined)<br />
BCM_E_NONE (Success)<br />
Address Resolution Table Management<br />
Note: The resulting bitmaps may only show a single port of a trunk<br />
group.<br />
The BCM Layer 2 API allows application developers to manage Layer 2 table<br />
of BCM5680 device. In addition to allowing programming of the Address<br />
Resolution (ARL) tables, they also provide mechanisms for changing the<br />
behavior of the ARL controller in general.<br />
2 - 8 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
Fundamental to the use of L2 address table entries is an opaque type, which is<br />
used to communicate the L2 entry to the BCM5680 device.<br />
struct arl_t {<br />
unsigned int flags; /* BCM_L2_XXX flags */<br />
unsigned char mac[6];/* 802.3 MAC address */<br />
unsigned short vid; /* VLAN identifier */<br />
int port; /* Zero-based port number */<br />
int tgid; /* Trunk group ID */<br />
int rtag; /* Trunk port select formula */<br />
int cos_dst; /* COS based on dst addr */<br />
int cos_src; /* COS based on src addr */<br />
} arl_t;<br />
In other API routines, either a MAC address (unsigned char *) and/or<br />
VLAN ID (int) are used for manipulation of the address table.<br />
int bcm_l2_addr_remove_by_port(int unit, unsigned int pbmp, unsigned int flags)<br />
DESCRIPTION Removes all L2 (MAC) addresses associated with the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
INPUT<br />
unit StrataSwitch PCI device unit number (driver internal)<br />
pbmp Bitmap of ports to affect<br />
flags BCM_L2_REMOVE_XXX<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
Note: Static entries are removed only if BCM_L2_REMOVE_STATIC<br />
flag is used.<br />
Note: ARL aging and learning on all ports is disabled during this operation.<br />
If these were not disabled, the hardware could shift the contents of<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 9
List of APIs API Call Reference<br />
the ARL table during the remove operation, causing some entries that<br />
should be removed to remain in the table.<br />
int bcm_l2_addr_remove_by_vlan (int unit, int vid, unsigned int flags)<br />
DESCRIPTION Removes all L2 (MAC) addresses associated with vid<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
INPUT<br />
unit Device number<br />
vlan vid to check<br />
flags BCM_L2_REMOVE_XXX<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
Note: Static entries are removed only if BCM_L2_REMOVE_ STATIC<br />
flag is used.<br />
Note: ARL aging and learning on all ports is disabled during this operation.<br />
If these were not disabled, the hardware could shift the contents of<br />
the ARL table during the remove operation, causing some entries that<br />
should be removed to remain in the table.<br />
int bcm_l2_addr_remove_by_trunk(int unit, int tid, unsigned int flags)<br />
DESCRIPTION Removes all L2 (MAC) addresses associated with tid<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
2 - 10 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit StrataSwitch PCI device unit number (driver internal)<br />
tid tid to check<br />
flags BCM_L2_REMOVE_XXX<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
int bcm_l2_addr_add (int unit, arl_t *l2addr)<br />
BCM_E_INTERNAL(Chip access Failure)<br />
Note: Static entries are removed only if BCM_L2_REMOVE_STATIC<br />
flag is used.<br />
Note: ARL aging and learning on all ports is disabled during this operation.<br />
If these were not disabled, the hardware could shift around the contents<br />
of the ARL table during the remove operation, causing some entries<br />
that should be removed to remain in the table.<br />
DESCRIPTION Adds the L2 address entry to the specified device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
INPUT<br />
Unit Unit number<br />
arl_t ARL entry structure (look for arl_t structure in the arl.h file)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 11
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
BCM L2 Flags: The flags given below are defined in arl.h file.<br />
BCM_L2_COS_SRC_PRI<br />
BCM_L2_DISCARD_DST<br />
BCM_L2_COPY_TO_CPU<br />
BCM_L2_L3LOOKUP<br />
BCM_L2_STATIC<br />
BCM_L2_HIT<br />
BCM_L2_TRUNK_MEMBER<br />
BCM_L2_RTAG_MAC_SRC<br />
Source COS has priority over Destination COS<br />
Discard on destination<br />
Send a copy to the CPU<br />
L3 interface MAC address<br />
Static entry (non-aged)<br />
The switch recorded a hit for this entry<br />
Also a member of trunk group<br />
If L2_TRUNK_MEMBER bit is set in the flags, the following should be provided<br />
for the rtag filed of the provided arl_t data<br />
Trunk selection based on Source MAC address<br />
2 - 12 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
BCM_L2_RTAG_MAC_SRCDST<br />
BCM_L2_RTAG_IP_SRC<br />
BCM_L2_RTAG_IP_DST<br />
BCM_L2_RTAG_IP_SRCDST<br />
Trunk selection based on Source and destination MAC Address<br />
Trunk selection based on IP (L3) source address<br />
Trunk selection based on IP (L3) source address<br />
Trunk selection based on Source and destination IP (L3) address<br />
int bcm_l2_addr_remove (int unit, unsigned char *mac, int vid)<br />
DESCRIPTION Removes the MAC address for the specified VLAN from the ARL table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
INPUT<br />
unit Number<br />
Mac 802.3 MAC address<br />
Vid VLAN ID<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l2_addr_get (int unit, unsigned char *mac, int vid, arl_t *l2addr)<br />
DESCRIPTION Given a MAC address and VLAN ID, check if the entry is present in the L2<br />
table, and if so, return an entry<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/arl.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 13
List of APIs API Call Reference<br />
INPUT<br />
Unit Unit number (driver internal)<br />
Mac MAC address to search<br />
Vid VLAN ID to search<br />
l2addr (OUT) Pointer to arl_t structure to receive results<br />
RETURN VALUE<br />
Filter Management<br />
BCM_E_PARAM Illegal parameter (NULL pointer)<br />
BCM_E_L2_NOT_FOUND Address not found (l2addr not filled in)<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
On Success, the flags mentioned in page 2-12 may be set for the entry<br />
The BCM SDK filter layer APIs provide access to the BCM 5680 filtering<br />
features. Filters can be used to classify packets based on certain protocol<br />
fields from Layer 2 through Layer 7. Based on these classifications, you can<br />
perform various actions such as:<br />
• Discarding the packet<br />
• Sending the packet to CPU<br />
• Sending the packet to mirrored port<br />
• Sending the packet to COS queue<br />
• Changing the 802.1p.QoS<br />
Filters are composed of two parts:<br />
• Field mask<br />
• Rules<br />
Field Mask specifies packet data fields being searched.<br />
Rules specify the action to be taken should a match occur.<br />
2 - 14 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
int bcm_filter_create(int unit, struct filter **bf_return)<br />
DESCRIPTION Creates new filter<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number<br />
bf_return Kernel pointer to filter template. Memory for this template is allocated by<br />
API. This memory which, when released by API while destroying.<br />
bf_return should be used as a handle for further filter settings. The<br />
struct filter is defined in filter.h<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_remove(int unit, struct filter *bf)<br />
DESCRIPTION This API removes the filter entry from hardware, but is still maintains the filter<br />
settings in software template<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number.<br />
bf Pointer to filter template.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 15
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_destroy(int unit, struct filter *bf)<br />
DESCRIPTION This API frees memory corresponding to software template<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
Unit Device number.<br />
bf Pointer to filter template<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_qualify_priority(int unit, struct filter *bf, int prio)<br />
DESCRIPTION Sets priority of this filter relative to other filters that match simultaneously<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
Unit Device number.<br />
bf Pointer to filter template<br />
prio Relative priority from 0 (min) to 255 (max)<br />
2 - 16 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_qualify_ingress(int unit, struct filter *bf, unsigned int pbmp)<br />
DESCRIPTION Sets ingress port(s) that the packet must match to trigger filter<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number.<br />
bf Pointer to filter template<br />
pbmp Bitmap of ingress ports eg. 0x02 for Port number 1<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_qualify_egress(int unit, struct filter *bf, unsigned int pbmp)<br />
DESCRIPTION Sets egress port(s) that the packet must match to trigger filter<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number.<br />
bf Pointer to filter template<br />
pbmp Bitmap of egress ports eg. 0x02 for Port number 1<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 17
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_qualify_data(int unit, struct filter *bf, int offset, int len, unsigned char *val , unsigned<br />
char *mask )<br />
DESCRIPTION Adds data field that the packet must match to trigger filter<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number.<br />
bf Pointer to filter template.<br />
offset Offset in packet at which value to be seen<br />
len Length of pattern eg. 1<br />
Value Value to be matched eg. 0xFF<br />
mask Mask to be applied on packet data eg. 0xFF<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_action_match(int unit, struct filter *bf , filter_action_t action, unsigned int param )<br />
DESCRIPTION Sets the action to be taken when filter triggers<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
2 - 18 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Device number<br />
bf Pointer to filter template<br />
action Action to be taken<br />
(Look for possible actions in enum filter_action_t in filter.h)<br />
param Parameter required by some actions (use 0 if not required)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_install(int unit, struct filter *bf )<br />
DESCRIPTION Gets the created filter in action<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
INPUT<br />
unit Device number<br />
bf Pointer to filter template<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_filter_reinstall(int unit, struct filter *bf )<br />
DESCRIPTION This API re-installs the filter if you want to dynamically change the action to<br />
be taken<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/filter.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 19
List of APIs API Call Reference<br />
INPUT<br />
unit Device number<br />
bf Pointer to filter template<br />
RETURN VALUE<br />
Steps To Create a Filter<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Note:<br />
• This API can be used if you want to dynamically change the action to<br />
be taken while the filter is in action.<br />
• If you have already removed the filter using the API<br />
bcm_filter_remove(), use the API bcm_filter_install()<br />
for reconfiguring the filter.<br />
Filter initialization happens as part of BCM switch init. The steps to create a<br />
filter as follows:<br />
1. Filter create<br />
This will give you a handle for the created filter. You have to provide this handle<br />
for further configuration.<br />
2. Qualify ingress or qualify egress<br />
Depending upon where you want to apply filter rule, you specify the bitmap.<br />
It can be either ingress, egress, or both.<br />
3. Filter qualify data<br />
This is to specify the data pattern you are expecting in the packet.<br />
Example:<br />
Data pattern - 0x8100 (hex value)<br />
Offset - 12 ( zero reference value in decimal )<br />
2 - 20 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
4. Filter action match<br />
This is to specify the action to take when you get a filter match.<br />
For a sample case, if the action is set to 6, which is the sent packet to a specified<br />
port, the port number can be specified as 'param'.<br />
Details of other possible actions can be found in the <strong>Programmer's</strong> Reference<br />
<strong>Guide</strong>.<br />
The filter action match also requires the parameter and meter ids. For certain<br />
actions, the parameters have to be provided. If the parameter or meter ids are<br />
not relevant, they may be set to zero. The possible action description and corresponding<br />
number is given in the table below:<br />
Table 2: Filter Action Match-Number and Action Description<br />
Action Value<br />
Discard packet (still copy to cpu/mirr) 0<br />
Do switch(Overrides a drop decision that is matched by a different rule 1<br />
Send a Copy of packet to CPU port 2<br />
Send a Copy of packet to Mirror-to port 3<br />
Set 802.1p priority for CoSQ assignment without modifying packet 5<br />
Redirect normally switched unicast packet to specific port 6<br />
Set IPv4 TOS value in packet PARAMETER: TOS 10<br />
5. Qualify filter priority<br />
This sets the priority among the filters. If two different filter rules match<br />
simultaneously on a same packet, the filter with the higher priority is applied.<br />
The priority range is 0 - 255, with 255 being the highest range.<br />
6. Install filter<br />
This puts the filter into action<br />
7. Reinstall filter<br />
Use this API to re-install the filter if you want to dynamically change the<br />
action to be taken.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 21
List of APIs API Call Reference<br />
Register Access<br />
8. Remove filter<br />
This is used to remove the filter from action. Removing the filter still preserves<br />
the filter settings. To reactivate the filter, after removing it, use the API<br />
bcm_install_filter().<br />
9. Destroy filter<br />
Use this procedure to destroy filter settings completely.<br />
Under this section of BCM APIs three types of register access is made available<br />
to application writers:<br />
• PCI config space of BCM5680 devices.<br />
• PCI memory mapped registers.<br />
• BCM5680 internal registers through S-channel message mechanism.<br />
Each of these have read/write calls.<br />
Note: Ensure that the Application Writer knows the details of each register<br />
being accessed.<br />
Caution Improper values written to registers can threaten switch functioning.<br />
2 - 22 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
MIIM APIs<br />
int cmic_read_miim(int unit, unsigned char phy_id, unsigned char phy_reg_addr, unsigned short<br />
*phy_rd_data)<br />
DESCRIPTION Reads a value from a PHY register<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/miim.h<br />
INPUT<br />
unit Device number<br />
phy_id PHY ID to read (MIIM Address)<br />
phy_reg_addr PHY register to read<br />
phy_rd_data (OUT) data in the register<br />
RETURN VALUE<br />
Returns SOC_E_NONE, if Successful, else negative value<br />
int cmic_write_miim(int unit, unsigned char phy_id, unsigned char phy_reg_addr, unsgned short<br />
phy_wr_data)<br />
DESCRIPTION Writes a value to a MIIM register<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/miim.h<br />
INPUT<br />
unit Device number<br />
phy_id Phy ID to write (MIIM address)<br />
phy_reg_addr PHY register to write<br />
phy_wr_date Data to write<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 23
List of APIs API Call Reference<br />
RETURN VALUE<br />
Interrupt Control APIs<br />
unsigned int cmic_irq_enable(int unit, unsigned int mask)<br />
Returns SOC_E_NONE, if Successful, else returns a negative value<br />
DESCRIPTION Enables a set of CMIC Interrupts<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/interrupt.h<br />
INPUT<br />
unit Device number<br />
mask The bit mask of interrupts to be enabled.<br />
RETURN VALUE<br />
The previous bitmask of enabled interrupts.<br />
unsigned int cmic_irq_disable(int unit, unsigned int mask)<br />
DESCRIPTION Disables a set of CMIC Interrupts<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/interrupt.h<br />
INPUT<br />
unit Device number<br />
mask The bit mask of interrupts to be disabled<br />
2 - 24 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
PCI Config Space<br />
The previous bitmask of enabled interrupts<br />
int PCI_config_read( int unit, uint32 offset, uint32 *data)<br />
Following APIs allows you to read/write config space memory corresponding<br />
to BCM5680 devices. These APIs are wrappers around PCI config space<br />
kernel calls.<br />
DESCRIPTION Reads PCI config space of BCM5680 device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number between 0 to 1<br />
offset Valid offset within config space (0 - 255)<br />
data Value read<br />
RETURN VALUE<br />
0 (Success)<br />
-ve (Failure)<br />
int PCI_config_write( int unit, uint32 offset, uint32 data)<br />
DESCRIPTION Writing PCI config space of BCM5680 device<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number between 0 to 1<br />
offset Valid offset within config space (0 - 255)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 25
List of APIs API Call Reference<br />
data Value to be written<br />
RETURN VALUE<br />
0 (Success)<br />
-ve (Failure)<br />
PCI Memory Mapped Registers<br />
unsigned int cmic_pci_getreg(int unit, unsigned int addr)<br />
The following APIs allow you to read/write BCM5680 PCI memory mapped<br />
registers. For details of list of PCI memory mapped registers see BCM5680<br />
product family Register Reference.<br />
DESCRIPTION Reads CMIC PCI register<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number<br />
addr Register address<br />
RETURN VALUE<br />
This API returns the data stored in the register.<br />
int cmic_pci_setreg(int unit, unsigned int addr, unsigned int data)<br />
DESCRIPTION Sets CMIC PCI register<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number<br />
addr Register address<br />
2 - 26 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
data Value to be written<br />
RETURN VALUE<br />
Indirect Mapped Registers<br />
0 (Success)<br />
-ve (Failure)<br />
The following APIs allow you to read/write BCM5680 indirect mapped registers.<br />
For a detailed list of indirect mapped registers see BCM5680 product<br />
family Register Reference.<br />
S-channel messaging mechanism is used to read/write this category of registers.<br />
Indirect mapped registers are a set of registers for each block. While calculating<br />
offset for each block zero based block number is used.<br />
For example<br />
Register GEGR_ENABLE<br />
Offset 0x00m80001<br />
For block 0 - 0x00080001<br />
For block 1 - 0x00180001<br />
int cmic_read_reg(int unit, unsigned int addr, unsigned int *data)<br />
DESCRIPTION Reads an internal SOC register through S-Channel messaging buffer<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number<br />
addr Register address<br />
data (OUT) data stored in the register<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 27
List of APIs API Call Reference<br />
RETURN VALUE<br />
SOC_E_NONE (Success)<br />
-ve (Failure)<br />
int cmic_write_reg(int unit, unsigned int addr, unsigned int data)<br />
DESCRIPTION Writes an internal SOC register through S-Channel messaging buffer<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pci.h<br />
INPUT<br />
unit Device number<br />
addr Register address<br />
data Value to be written<br />
RETURN VALUE<br />
Trunking (Link Aggregation)<br />
SOC_E_NONE (Success)<br />
-ve (Failure)<br />
Trunking (also know as Port Bundling and Link Aggregation is a method by<br />
which up to eight Ethernet ports can be bundled together to form a trunk. The<br />
trunk is like one logical link, and is useful when one requires high bandwidth<br />
and/or redundancy between switches. All ports in a trunk must be configured<br />
with the same speed and Full Duplex.<br />
Trunking can provide a number of valuable features such as:<br />
• Incremental bandwidth based on demand.<br />
• Link redundancy, in the case of a trunk port with the Failure, is removed<br />
from the trunk group.<br />
• High bandwidth load balancing.<br />
2 - 28 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
int bcm_trunk_use_tid(int unit, int tid, int psc)<br />
Note: Please refer header files in sample code for argument types, which<br />
are passed/received as structure.<br />
DESCRIPTION Creates a trunk group with specified trunk ID<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
tid Trunk ID<br />
psc Identify the trunk selection criteria (see note on RTAG in Trunk Usage<br />
page 2-34)<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_XXX<br />
int bcm_trunk_create(int unit, int psc, int *tid)<br />
DESCRIPTION Creates trunk group<br />
Note: The function above does not provide any ASIC tables update.<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
psc Port selection criteria (see note on RTAG in Trunk Usage page 2-34)<br />
tid Created trunk id (output parameter)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 29
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_psc_get(int unit, int tid, int *psc )<br />
-1 - (Out of range parameter values)<br />
DESCRIPTION Gets port selection criteria for a trunk group<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
tid Trunk ID.<br />
psc Port selection criteria (output parameter)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_info_get(int unit, struct t_info *ta_info)<br />
DESCRIPTION Gets trunking information for a specified unit<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
ta_info Trunk information (output parameter)<br />
(Look for struct t_info in trunk.h)<br />
2 - 30 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_broadcast_port_get(int unit, int tid, int *port )<br />
DESCRIPTION Gest broadcast port for a specified trunk<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number.<br />
tid Trunk ID.<br />
port Broadcast port (output parameter)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_set( int unit, int tid, struct t_add_info*add_info)<br />
DESCRIPTION Adds ports to a trunk group<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number.<br />
tid Trunk ID.<br />
add_info Trunk information to be set<br />
(Look for struct t_add_info in trunk.h)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 31
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
int bcm_trunk_destroy(int unit, int tid )<br />
BCM_E_NONE (Success)<br />
DESCRIPTION Destroys specified trunk<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number.<br />
tid Trunk ID. to be destroyed<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_mcast_join(int unit, int tid, int vid , unsigned char *mac )<br />
DESCRIPTION Adds the trunk group to the existing MAC multicast entry<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
tid Trunk ID.<br />
vid VLAN ID<br />
mac Multicast MAC address<br />
2 - 32 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_bitmap_expand(int unit , unsigned int *pbmp_ptr)<br />
DESCRIPTION Given a port bitmap, if any of the ports are in a trunk, adds ALL of the ports in<br />
that trunk to the bitmap<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
pbmp_ptr Bitmap to be forced in trunk (input/output para)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_trunk_get( int unit, int tid,int flag, void *t_data )<br />
DESCRIPTION Returns a port information of given trunk ID<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/trunk.h<br />
INPUT<br />
unit Device number<br />
tid Trunk ID.<br />
flag Indicates what format of trunk information will be returned<br />
pbmp Place to store bitmap of returned ports. (Output parameter)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 33
List of APIs API Call Reference<br />
Trunk Usage<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
The steps to be followed for trunk usage are given below:<br />
1. Trunk create<br />
This procedure creates a trunk and returns the trunk ID. This procedure<br />
prompts for the RTAG value.<br />
The various values for the RTAG field are described below:<br />
2. Add ports<br />
This procedure adds trunk members to the specified trunk ID.<br />
The RTAG value decides port selection criteria among the member ports.<br />
Table 3:<br />
RTAG Value Port Selection<br />
1 Selection based on source MAC address destination<br />
2 Selection based on source MAC address<br />
3 Selection based on source and destination MAC<br />
addresses<br />
4 Selection based on source IP address<br />
5 Selection based on destination IP address<br />
6 Selection based on source and destination IP addresses<br />
3. Trunk destroy<br />
This procedure destroys the trunk.<br />
4. Get port info of a trunk ID<br />
If provided with unit number and trunk id, this procedure provides member<br />
ports with the trunk.<br />
2 - 34 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
Stacking<br />
5. Get trunk selection criteria<br />
This procedure obtains the port selection criteria for a given trunk ID.<br />
6. Get dedicated broadcast port for trunk group<br />
This procedure gets the broadcast port for a given trunk ID.<br />
7. Add trunk to multicast entry<br />
This procedure adds the trunk to a multicast table.<br />
8. Trunk bit map update<br />
int bcm_stk_init(int unit, unsigned int sp, int mode)<br />
This procedure, when provided with a port bitmap, and if any of the ports are<br />
in a trunk, adds all the ports in that trunk.<br />
After the driver performs BCM5680 initialization, the switch remains in cascaded<br />
mode.<br />
The APIs used for stacking mode of operation between multiple BCM5680<br />
devices, are given below:<br />
DESCRIPTION Initializes the stack module<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/stack.h<br />
INPUT<br />
unit Device number<br />
sp Bitmap of the ports involved in stacking mode eg. 0x02<br />
mode The mode of stacking:<br />
0 - Duplex<br />
1 - Simplex<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 35
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_stk_port_get(int unit, unsigned int *sp)<br />
DESCRIPTION Gets the bitmap of ports that are involved in stacking<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/stack.h<br />
INPUT<br />
unit Device number.<br />
sp Bitmap of stack ports (output parameters)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_stk_port_is_stack(int unit, int port)<br />
DESCRIPTION Checks if the given port is a stacking port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/stack.h<br />
INPUT<br />
unit Device number<br />
port Port number<br />
2 - 36 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
PTABLE Management<br />
1 (Port is a stacking port)<br />
0 (Port is not a stacking port)<br />
-ve (Failure)<br />
These APIs help in modifying/view PTABLE entries.<br />
int bcm_port_vlan_set(int unit, unsigned int port, int vid)<br />
DESCRIPTION Sets PTABLE entries for given ports with sepcified vid<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pvlan.h<br />
INPUT<br />
unit Device number<br />
port Port bitmap of VLAN members eg. 0xFF<br />
vid vid to be forced for above ports<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Note: Specified vid should exist in VTABLE and all specified ports<br />
should be members of that VLAN.<br />
int bcm_port_vlan_get(int unit, int port, struct vlan_data_t *vdata)<br />
DESCRIPTION Gets PTABLE entry for a given port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/pvlan.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 37
List of APIs API Call Reference<br />
INPUT<br />
unit Device number<br />
port Port number<br />
vdata VLAN data (Output parameter)<br />
(Look for struct vlan_data_t in vlan.h)<br />
RETURN VALUE<br />
Packet Driver APIs<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
The set of functions available in this API enables you to send packets to the<br />
network attached to the Gigabit Switches on <strong>CPCI</strong>-<strong>910</strong>.<br />
Note: The packets should be a valid Ethernet packet with 4 Bytes of<br />
Frame Check Sequence (FCS) at the end of the packet. The length<br />
includes FCS bytes. However, the FCS could also be updated by the<br />
Gigabit Switch depending upon the flags setting.<br />
int bcm_packet_send_sync(int unit, void *packet, int length, uint32 flags)<br />
DESCRIPTION Sends a packet synchronously based on the destination MAC address<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/packet.h<br />
INPUT<br />
unit Device number (0 to 1)<br />
packet Pointer to valid Ethernet packet<br />
length Packet length<br />
flags Flags indicating various actions; currently supported are:<br />
• BCM_PACKET_CRC_APPEND - append CRC<br />
2 - 38 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
• BCM_PACKET_CRC_REGEN - regenerate CRC<br />
• BCM_PACKET_CRC_VALID - valid CRC already.<br />
If the packet has valid CRC, but a tag is inserted, then this routine will override<br />
a VALID flag to BCM_PACKET_CRC_REGEN.<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_packet_send_async(int unit, rl_packet_callback_t f, void *cookie, void *packet, int length,<br />
uint32 flags)<br />
DESCRIPTION Sends a packet asynchronously, and call back to the specified function<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/packet.h<br />
INPUT<br />
unit Device number (0 to 1)<br />
f Callback function (void f(int unit, void *packet, void *cookie))<br />
cookie Context pointer for callback<br />
packet Pointer to valid Ethernet packet<br />
length Packet length<br />
flags Flags indicating various actions, currently supported are:<br />
• BCM_PACKET_CRC_APPEND - append CRC<br />
• BCM_PACKET_CRC_REGEN - regenerate CRC<br />
• BCM_PACKET_CRC_VALID -valid CRC already.<br />
If the packet has valid CRC, but a tag is inserted, then this routine will override<br />
a VALID flag to BCM_PACKET_CRC_REGEN.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 39
List of APIs API Call Reference<br />
RETURN VALUE<br />
Port-Related APIs<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
These APIs allow to control the following features of the port.<br />
• Controlling the link scanning mode for the port.<br />
• Get/set the speed of the port.<br />
• Get/set the duplex mode of the port.<br />
• Get/set the learning behavior of the port.<br />
• Get/set the auto-negotiation behavior of the port.<br />
• Get/set the pause control behavior of the port.<br />
• Get/set the loopback on the port.<br />
• Shutdown the port<br />
• Bringup the port<br />
• Get/set the STP behavior of the port<br />
• Get the type of daughter card (copper/fibre)<br />
Listed below are the port-related APIs supported.<br />
int bcm_port_linkscan_get(int unit, int port, int *linkscan)<br />
Note: Auto-Negotiation is MANDATORY for gigabit Ethernet. It is<br />
ILLEGAL to force a device into 1000BASE-T mode. The BCM Demo<br />
Software provides a mechanism for diagnostic modes that allow a device<br />
to be forced into 1000Base-T mode. However, these modes should not be<br />
used for establishing a normal link.<br />
DESCRIPTION Returns the linkscan mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Device number<br />
2 - 40 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
port Port number<br />
linkscan Pointer where return value will be stored<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE, the return<br />
values would be as follows:<br />
LINKSCAN_MODE_NONE (Linkscan disabled)<br />
LINKSCAN_MODE_SW - (Software Linkscan)<br />
LINKSCAN_MODE_HW - (Hardware Linkscan)<br />
int bcm_port_linkscan_set(int unit, int port, int linkscan)<br />
DESCRIPTION Sets the linkscan mode for port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
linkscan The mode to be set which can be any of the following:<br />
LINKSCAN_MODE_NONE (Linkscan disabled)<br />
LINKSCAN_MODE_SW (Software Linkscan)<br />
LINKSCAN_MODE_HW (Hardware Linkscan)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 41
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_link_status_get(int unit, int port, int *up)<br />
DESCRIPTION Gets the link status on the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
up The return pointer where status will be stored<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_autoneg_get(int unit, int port, int *autoneg)<br />
Returns pointer if return value from function is BCM_E_NONE, if value of<br />
up is 1, the link is up, else the link is down.<br />
DESCRIPTION Gets the auto negotiation status for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
autoneg The return pointer where status will be stored<br />
2 - 42 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. If the<br />
autoneg value is 1, the auto negotiation is enabled, else auto negotiation<br />
disabled.<br />
Note: Refer note on page 2-40 on auto-negotiation.<br />
int bcm_port_autoneg_set(int unit, int port, int autoneg)<br />
DESCRIPTION Sets the auto negotiation status for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
autoneg The value to be set, which can be 1 - enable, 0 - disable<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_speed_get(int unit, int port, int *speed)<br />
DESCRIPTION Gets the speed for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 43
List of APIs API Call Reference<br />
port Port number<br />
autoneg The return pointer where speed will be stored<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_speed_set(int unit, int port, int speed)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of speed will be either 10, 100 or 1000 mbps.<br />
DESCRIPTION Set the speed for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
speed The speed to be set , which can be 10, 100, or 1000 mbps<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_duplex_get(int unit, int port, int *duplex)<br />
Note: Refer note on page 2-40 on auto-negotiation.<br />
DESCRIPTION Gets the mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
2 - 44 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
duplex The return pointer where mode will be stored<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_duplex_set(int unit, int port, int duplex)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of duplex will be either PORT_DUPLEX_HALF or<br />
PORT_DUPLEX_FULL.<br />
DESCRIPTION Sets the mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
mode The mode to be set can be PORT_DUPLEX_HALF - 0 or<br />
PORT_DUPLEX_FULL - 1.<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Note: Refer note on page 2-40 on auto-negotiation.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 45
List of APIs API Call Reference<br />
int bcm_port_pause_get( int unit, int port, int *pause_tx, int *pause_rx)<br />
DESCRIPTION Gets the pause mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
pause_tx The return pointer<br />
pause_rx The return pointer<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of pause_tx and pause_rx can be 0 (disable) or 1 (enable).<br />
int bcm_port_pause_set(int unit, int port, int pause_tx, int pause_rx)<br />
DESCRIPTION Sets the mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
pause_tx enable - 1<br />
disable - 0<br />
pause_rx enable - 1<br />
disable - 0<br />
2 - 46 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_pause_addr_get(int unit, int port, unsigned char* mac_addr)<br />
DESCRIPTION Gets the pause address for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
mac_addr Return pointer for pause frame mac address<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of mac_addr will contain the pause frame mac address.<br />
int bcm_port_pause_addr_set( int unit, int port, unsigned char * mac_addr)<br />
DESCRIPTION Sets the pause address for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
mac_addr Pause frame mac address<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 47
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_loopback_get( int unit, int port, int *loopback)<br />
DESCRIPTION Gets the loopback mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
loopback The return pointer where loopback mode is stored.<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of loopback mode can be the following:<br />
PORT_LOOPBACK_NONE - 0<br />
PORT_LOOPBACK_MAC - 1<br />
PORT_LOOPBACK_PHY - 3<br />
int bcm_port_loopback_set( int unit, int port, int loopback)<br />
DESCRIPTION Sets the loopback mode for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
2 - 48 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
loopback The loopback mode for the port, which can be,<br />
PORT_LOOPBACK_NONE - 0 (loopback disabled).<br />
PORT_LOOPBACK_MAC - 1 (loopback at mac level).<br />
PORT_LOOPBACK_PHY - 3 (loopback at phy chip level).<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_stp_get( int unit, int port, int *state)<br />
Note: Please disable the ARL learning through bcm_port_learn_set()<br />
API for the port when you set the PORT_LOOPBACK_MAC on that<br />
port.<br />
DESCRIPTION Gets the stp state for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
state The stp state for the port<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 49
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of stp state can be:<br />
STG_STP_LISTEN - 1<br />
STG_STP_BLOCK - 2<br />
STG_STP_LEARN - 3<br />
STG_STP_FORWARD - 4<br />
int bcm_port_stp_set( int unit, int port, int state)<br />
DESCRIPTION Sets the stp state for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
state The stp state for the port which can be,<br />
STG_STP_LISTEN - 1 (Accept BPDUs, no learning)<br />
STG_STP_BLOCK - 2 (Accept only BPDUs, no learning)<br />
STG_STP_LEARN - 3 (Packets are learnt, no forwarding)<br />
STG_STP_FORWARD - 4 (Learning as well as forwarding)<br />
2 - 50 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_learn_get( int unit, int port,unsigned int *flags)<br />
DESCRIPTION Get the learning flags for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
flags The return pointer where flags will be set<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
Returns pointer if return value from function is BCM_E_NONE. The values<br />
of learn flags can be:<br />
PORT_LEARN_ARL - 0x01 (Learn SLF address)<br />
PORT_LEARN_CPU - 0x02 (Copy SLF packet to CPU)<br />
PORT_LEARN_FWD - 0x04 (Forward SLF packet)<br />
int bcm_port_learn_set( int unit, int port, unsigned int flags)<br />
DESCRIPTION Sets the learning flags for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 51
List of APIs API Call Reference<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
flags The learning state for the port, which can be,<br />
PORT_LEARN_ARL - 0x01 (Learn SLF address)<br />
PORT_LEARN_CPU - 0x02 (Copy SLF packet to CPU)<br />
PORT_LEARN_FWD - 0x04 (Forward SLF packet)<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_learn_modify( int unit, int port, unsigned int add_flags, unsigned int del_flags)<br />
DESCRIPTION Sets the learning flags for the port<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
port Port number<br />
add_flags The learning flags to be added, which can be,<br />
PORT_LEARN_ARL - 0x01 (Learn SLF address)<br />
PORT_LEARN_CPU - 0x02 (Copy SLF packet to CPU)<br />
PORT_LEARN_FWD - 0x04 (Forward SLF packet)<br />
del_flags The learning flags to be deleted, which can be,<br />
PORT_LEARN_ARL - 0x01 (Learn SLF address)<br />
PORT_LEARN_CPU - 0x02 (Copy SLF packet to CPU)<br />
PORT_LEARN_FWD - 0x04 (Forward SLF packet)<br />
2 - 52 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_shutdown( int unit, unsigned int ports)<br />
DESCRIPTION Shutsdown the ports<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
ports Bitmap of ports eg. 0xFF<br />
flags The return pointer where flags will be set<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_port_bringup( int unit, unsigned int ports)<br />
DESCRIPTION Brings up the ports<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
ports Bitmap of ports i.e 0xff<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 53
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
enum cardtype bcm_check_card_type(int unit);<br />
DESCRIPTION Checks the type of daughter card or RTB<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/port.h<br />
INPUT<br />
unit Unit number<br />
RETURN VALUE<br />
Port Configurations<br />
The API returns FIBER or COPPER depending on the card<br />
The tables below detail the port numbers used in the configuration file:<br />
Table 4: Switch A Settings<br />
Port Number Description<br />
A0 PSB B<br />
A1 PSB A<br />
A2 Connected to switch B<br />
A3-A6 Daughter card ports<br />
A7 MAC connected to switch A<br />
Table 5: Switch B Settings<br />
Port Number Description<br />
B0 RTB<br />
B1 Connected to switch A<br />
B2 RTB<br />
2 - 54 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
Table 5: Switch B Settings<br />
Port Number Description<br />
B3 RTB<br />
B4 MGT PHY<br />
B5 RTB<br />
B6 MGT PHY<br />
B7 MAC connected to switch B<br />
The port settings for a unit 0 bitmap would be as follows:<br />
7<br />
MAC port<br />
For example, DCARD port 3 bitmap is - 0x08.<br />
MAC port bitmap is- 0x80.<br />
PSBA port bitmap is - 0x02.<br />
The port settings for a unit 1 bitmap would be as follows:<br />
7<br />
MAC port<br />
6, 5, 4, 3<br />
DCARD<br />
1<br />
Stacking<br />
2<br />
Stacking<br />
1<br />
PSB A<br />
0<br />
PSB B<br />
The Copper IO-<strong>910</strong> and Fiber Optic IO-<strong>910</strong> daughter card port configurations<br />
are diagrammatically represented in the following figures.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 55<br />
6, 4<br />
PMC<br />
5,3,2,0<br />
RTB
List of APIs API Call Reference<br />
Port Number 3<br />
Port Number 5<br />
Port Number 6<br />
Port Number 4<br />
Figure 3:Copper Daughter Card Port Configuration<br />
Copper<br />
Daughter<br />
Card<br />
ETH1<br />
ETH2<br />
ETH3<br />
ETH4<br />
2 - 56 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
L3 Support APIs<br />
Port Number- 5<br />
Port Number- 3<br />
Port Number- 4<br />
Port Number- 6<br />
Figure 4:Fiber Optic Daughter Card Port Configuration<br />
Fiber Optic<br />
Daughter<br />
Card<br />
ETH1<br />
ETH2<br />
ETH3<br />
ETH4<br />
The <strong>CPCI</strong><strong>910</strong> can also be configured to do L3 forwarding in hardware.<br />
Unlike L2, CPU's role is even more important in L3 forwarding. The CPU's<br />
help will be required to handle the following:<br />
• Running ARP protocol to resolve the IP address and to generate and maintain<br />
ARP table.<br />
• Running RIP, OSPF, NLSP or other protocols to generate and maintain the<br />
Routing tables.<br />
• Setting up the L3INTF, L3 and DEF_IP Table which will be used by BCM<br />
Switch for L3 forwarding.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 57
List of APIs API Call Reference<br />
L3 Configuration<br />
L3 Interface Table Related APIs<br />
The switch is able to do L3 forwarding at line rate when all the L3 tables on<br />
the switch are properly populated.The BCM switch has 3 tables for supporting<br />
L3 functionality, the description of which is given below.<br />
• L3INTF Table: This table is used for creating, updating and destroying the<br />
L3 interface.<br />
• L3 Table: This is the table, in which the search is performed when L3<br />
switching has to be done based on destination IP Address.<br />
• L3 DEF_IP Table: If the search in L3 Table results in a Failure, this table<br />
is used for searching the default entry.<br />
Note: The following description applies to condition that, CPU is not<br />
running the ARP protocol for the switch and also there is no dynamic updation<br />
of L3 tables on the switch by CPU.<br />
• The L3 interface is created using the 'create a L3 interface' API under "L3<br />
Interface test" in bcm_appln utility, which will add the interface's, mac<br />
address and vlan id , to L3INTF table. This also adds the corresponding<br />
entry in the L2 table with L3 bit of that entry set. So the BCM switch<br />
knows that entry belongs to L3 Interface and for this L3 switching needs<br />
to be done.<br />
• Set the entry in the L3 table for the destination IP address by filling the<br />
next hop mac address, interface and outgoing port for the packet.Use<br />
"Add entry to L3 table" under "L3 Table test" in bcm_appln utility for this.<br />
• Set the entry in the L3 DEF_IP table for packets which don't find a match<br />
in the L3 table by filling the. Use "Add entry to default IP table" under<br />
"L3 defip table test" in bcm_appln utility.<br />
Listed below are the L3 support APIs<br />
int bcm_l3_interface_create(int unit, unsigned char* mac_addr, int vid, int add_to_arl)<br />
DESCRIPTION Creates an entry in l3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
2 - 58 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Unit number<br />
mac_addr 802.3 mac address<br />
vid Vlan id<br />
add_to_arl If 1, the entry will be added to ARL table with L3 and static bit set<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_interface_update(int unit, int interface, unsigned char *mac_addr, int vid)<br />
DESCRIPTION Updates an entry in the L3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
interface Interface id<br />
mac_addr 802.3 mac address<br />
vid Vlan id<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_interface_destroy(int unit, int interface)<br />
DESCRIPTION Destroys an entry in l3 interface table.<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 59
List of APIs API Call Reference<br />
INPUT<br />
unit Unit number<br />
interface Interface id<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
extern int bcm_l3_status(int unit, int *free_l3intf, int *free_l3, int *free_defip)<br />
DESCRIPTION Returns the number of free entries in different L3 related table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
L3 Table APIs<br />
unit Unit number<br />
free_l3intf Number of free entries in L3 interface table.<br />
free_l3 Number of free entries in L3 table.<br />
free_defip Number of free entries in defip table.<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_add(int unit, int port, unsigned int ip_addr, unsigned char *mac_addr, int interface, int<br />
hit_set)<br />
DESCRIPTION Creates an entry in l3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
2 - 60 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Unit number<br />
port Outgoing port number<br />
ip_addr IP Address<br />
mac_addr Next hop 802.3 mac address<br />
interface Interface id<br />
hit_set If 1, it will set the hit bit in L3 table.<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_delete(int unit, unsigned int ip_addr)<br />
DESCRIPTION Deletes an entry in l3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_delete_by_prefix(int unit, unsigned int ip_addr, unsigned int mask)<br />
DESCRIPTION Deletes an entry in l3 interface table based on prefix<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 61
List of APIs API Call Reference<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
mask Netmask to be applied<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_delete_by_index(int unit, int index)<br />
DESCRIPTION Deletes an entry in l3 interface table by index<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
index Index number in the table<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_delete_by_interface(int unit, int interface)<br />
DESCRIPTION Delete an entry in l3 interface table by interface ID<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
2 - 62 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
mask Netmask to be applied<br />
RETURN VALUE<br />
int bcm_l3_ip_delete_all(int unit)<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
DESCRIPTION Deletes all entries in l3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_ip_find(int unit, unsigned int ip_addr, int *interface, int *port, int *hit, unsigned char<br />
*mac_addr)<br />
DESCRIPTION Finds an entry in l3 interface table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
port Pointer to outgoing port number<br />
ip_addr IP Address<br />
mac_addr Next hop 802.3 mac address<br />
interface Pointer to interface id<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 63
List of APIs API Call Reference<br />
hit Check if the hit bit is set.<br />
RETURN VALUE<br />
L3 DEFIP Table APIs<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_add(int unit, int port, unsigned int ip_addr, unsigned int mask, unsigned char<br />
*mac_addr, int interface, unsigned int flags)<br />
DESCRIPTION Creates an entry in L3 DEFIP table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
port Outgoing port number<br />
ip_addr IP Address<br />
mac_addr Next hop 802.3 mac address<br />
interface Interface ID<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_delete(int unit, unsigned int ip_addr,unsigned int mask)<br />
DESCRIPTION Deletes an entry in L3 DEFIP table based on prefix<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
2 - 64 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
mask Netmask to be applied<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_delete_by_interface(int unit, int intf)<br />
DESCRIPTION Deletes an entry in l3 DEFIP table based on interface<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
intf Interface id<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_update(int unit, unsigned int ip_addr, unsigned int mask, int interface, int port,<br />
unsigned char *mac_addr, int cpu)<br />
DESCRIPTION Updates an entry in L3 DEFIP table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 65
List of APIs API Call Reference<br />
ip_addr IP Address<br />
mask Netmask<br />
interface Interface id<br />
port Outgoing port number<br />
mac_addr Next hop 802.3 mac address<br />
cpu cpu bit<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_get(int unit, unsigned int ip_addr,unsigned int mask, int *interface,int *port,<br />
unsigned char *mac_addr, int *cpu)<br />
DESCRIPTION Gets an entry from L3 DEFIP table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
mask Netmask<br />
interface Pointer to interface id<br />
port Pointer to outgoing port number<br />
mac_addr Next hop 802.3 mac address<br />
cpu cpu bit<br />
2 - 66 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
int bcm_l3_defip_find_index(int unit, int index, unsigned int *ip_addr,int *masklen, int *interface, int<br />
*port, unsigned char *mac_addr,int *cpu)<br />
DESCRIPTION Finds an entry in L3 DEFIP table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/l3.h<br />
INPUT<br />
unit Unit number<br />
ip_addr IP Address<br />
masklen Length of mask<br />
interface Pointer to interface id<br />
port Pointer to outgoing port number<br />
mac_addr Next hop 802.3 mac address<br />
cpu Pointer to cpu bit<br />
RETURN VALUE<br />
BCM_E_XXX<br />
BCM_E_NONE (Success)<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 67
List of APIs API Call Reference<br />
Multicast Table Management<br />
int bcm_mcast_addr_add(int unit, mcast_addr_t *mcaddr)<br />
The BCM Switch supports L2 Multicasting. All the packets with a multicast<br />
group address will be sent to only members of that group. A multicast group<br />
can be created or destroyed by using the API provided. A port can join or<br />
leave a multicast group at any time. The PFM (Port filtering mode) of the<br />
ingress port should be set to mode B. Please refer to Broadcom5680 product<br />
family register reference.<br />
The supported APIs and data structure for multicast table management is provided<br />
in the following sections.<br />
typedef struct mcast_addr_s {<br />
unsigned charmac[6];/* 802.3 MAC address */<br />
unsigned shortvid;/* VLAN identifier */<br />
unsigned intcos_dst;/* COS based on dst addr */<br />
unsigned intport_bitmap;/* Port bitmap */<br />
unsigned intuntagged_port_bitmap;/* Untag port bitmap */<br />
} mcast_addr_t;<br />
DESCRIPTION Adds an entry in the multicast table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/multicast.h<br />
INPUT<br />
unit Device number<br />
mcaddr Pointer to fully filled-in mcast_addr_t<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (if table write failed)<br />
int bcm_mcast_addr_remove(int unit, unsigned char *mac, int vid)<br />
DESCRIPTION Deletes an entry from the multicast table<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/multicast.h<br />
2 - 68 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
INPUT<br />
unit Device number<br />
mac mac address<br />
vid vlan id<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_XXXX<br />
int bcm_mcast_port_get(int unit, unsigned char *mac, int vid, mcast_addr_t *mcaddr)<br />
DESCRIPTION Gets membership and untagged port bit maps for a MC group<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/multicast.h<br />
INPUT<br />
unit Device number<br />
mac mac address used for lookup<br />
vid vlan id used for lookup<br />
mcaddr Pointer to mcast_addr_t that is fully filled in<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL(chip access Failure)<br />
BCM_E_MCAST_NOT_FOUND(address not found (mcaddr not filled in))<br />
int bcm_mcast_leave(int unit, unsigned char *mcMacAddr, int vlanId, int srcPort)<br />
DESCRIPTION This function removes the given port from the group membership of the given<br />
mcast mac address.<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 69
List of APIs API Call Reference<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/multicast.h<br />
INPUT<br />
unit Device number<br />
mcMacAddr Multicast Address from which the member is to be removed<br />
vlanId Vlan ID<br />
srcPort Port to be removed from the membership of the given multicast address<br />
RETURN VALUE<br />
BCM_MCAST_LEAVE_DELETED (If the entry with the given<br />
mcast addr is deleted from H/W table)<br />
BCM_MCAST_LEAVE_UPDATED (If the mcast address is<br />
found in the table and bitmap is updated)<br />
BCM_MCAST_LEAVE_NOTFOUND (If the mcast address is<br />
not found in the table)<br />
BCM_E_INTERNAL (If L2 mcast table search/insert<br />
fails)<br />
Note: BCM_MCAST_xxx values are non-negative Success codes.<br />
int bcm_mcast_join(int unit, unsigned char *mcMacAddr, int vlanId, int srcPort, mcast_addr_t<br />
*mcaddr, unsigned int *allRouterBmp)<br />
DESCRIPTION This function adds the given port to the membership of the given mcast mac<br />
address<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/multicast.h<br />
INPUT<br />
unit Device number<br />
mcMacAddr Multicast Address to which the new member is to be added<br />
2 - 70 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
vlanId Vlan ID<br />
srcPort Port to be added as a new member of the given multicast address<br />
mcaddr Used for returning updated entry in mcast table with the given mcast mac<br />
address<br />
allRoutersBmp Used for returning the all routers bitmap<br />
RETURN VALUE<br />
Mirror APIs<br />
int bcm_mirror_mode(int unit, int mode)<br />
BCM_MCAST_JOIN_ADDED (If a new entry is created for the given mcast<br />
address)<br />
BCM_MCAST_JOIN_UPDATED (If the mcast address is found in the table<br />
and bitmap is updated)<br />
BCM_E_INTERNAL (If L2 mcast table search/insert fails)<br />
Note: BCM_MCAST_xxx values are non-negative Success codes.<br />
Mirroring is a feature in which the switch the copies the packet to any port,<br />
you specified, apart from the normal action which will be taken on the packet.<br />
This feature can be used in sniffing and analyzing or debugging any problem.<br />
The BCM switch Mirror APIs allow you to mirror packets at ingress or egress<br />
of any ports. You can also set the port to which the packets that are mirrored,<br />
will be sent.<br />
The mirror APIs supported are displayed in the sections below.<br />
DESCRIPTION Enables or disables different modes of mirroring<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 71
List of APIs API Call Reference<br />
mode Either of MIRROR_L2 , MIRROR_L2_L3 or MIRROR_DISABLE<br />
RETURN VALUE<br />
int bcm_mirror_to_set(int unit, int port)<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
DESCRIPTION Sets the mirror-to port for all mirroring<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port The port to mirror all ingress/egress selections<br />
RETURN VALUE<br />
int bcm_mirror_to_get(int unit, int *port)<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL(Chip access Failure)<br />
DESCRIPTION Gets the mirror-to port for all mirroring<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port (OUT) The port to mirror all ingress/egress selections to<br />
2 - 72 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
int bcm_mirror_ingress_set(int unit, int port, int val)<br />
DESCRIPTION Enables or disables mirroring per ingress<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port The port to affect<br />
val Boolean value for on/off<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
Note: Mirroring must also be globally enabled.<br />
int bcm_mirror_ingress_get(int unit, int port, int *val)<br />
DESCRIPTION Gets the mirroring per ingress enabled/disabled status<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port The port to check<br />
val Place to store boolean return value for on/off<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 73
List of APIs API Call Reference<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
int bcm_mirror_egress_set(int unit, int port, int val)<br />
DESCRIPTION Enables or disables mirroring per egress<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port The port to affect<br />
val Boolean value for on/off<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
int bcm_mirror_egress_get(int unit, int port, int *val)<br />
Note: Mirroring must also be globally enabled.<br />
DESCRIPTION Gets the mirroring per egress enabled/disabled status<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/mirror.h<br />
INPUT<br />
unit Device number<br />
port The port to check<br />
val Place to store boolean return value for on/off<br />
2 - 74 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
RETURN VALUE<br />
CoSQ Management APIs<br />
BCM_E_NONE (Success)<br />
int bcm_cosq_config_set(int unit, int numcos)<br />
BCM_E_INTERNAL (Chip access Failure)<br />
The BCM switch has provided APIs to configure the scheduling of packets at<br />
egress ports. The number of CoSQs (Class of Service queues) at each egress<br />
ports can also be configured. The 802.1p priority of the packet can also be<br />
made to map into any of these queues. You can choose the scheduling algorithms<br />
for your packets in these COS queues and additionally, weight and the<br />
latency can be set using the maximum delay.<br />
The supported CoSQ management APIs are described in the sections below.<br />
DESCRIPTION Sets the number of CoS queues<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
INPUT<br />
unit Device number<br />
numcos Number of cosq (1, 2, or 4)<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
int bcm_cosq_config_get(int unit, int *numcos)<br />
BCM_E_INTERNAL (if table write failed)<br />
DESCRIPTION Gets the number of CoS queues<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 75
List of APIs API Call Reference<br />
INPUT<br />
unit Device number<br />
numcos (Output) number of CoS queues<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (if table write failed)<br />
int bcm_cosq_mapping_set(int unit,int priority, int queue)<br />
DESCRIPTION Determines which CoS queue a given priority should fall into<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
INPUT<br />
unit Device number<br />
priority Priority value to map<br />
queue COS queue to map to<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL (if table write failed)<br />
int bcm_cosq_mapping_get(int unit,int priority, int *queue)<br />
DESCRIPTION Determines which CoS queue a given priority currently maps to<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
INPUT<br />
unit Device number<br />
priority Priority value<br />
2 - 76 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
queue (Output) COS queue number<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL<br />
int bcm_cosq_sched_set(int unit,int mode, int weights[], unsigned int delay)<br />
DESCRIPTION Sets up class-of-service policy and corresponding weights and delay<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
INPUT<br />
unit Device number<br />
mode Scheduling mode can be BCM_COSQ_STRICT,<br />
BCM_COSQ_WEIGHTED_ROUND_ROBIN, or<br />
BCM_COSQ_BOUNDED_DELAY<br />
weights Weights for each COS queue<br />
Unused if mode is BCM_COSQ_STRICT.<br />
Indicates number of packets sent before going on to the next COS queue.<br />
delay Maximum delay in microseconds before returning the round-robin to the highest<br />
priority COS queue (Unused if mode other than<br />
BCM_COSQ_BOUNDED_DELAY)<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL<br />
int bcm_cosq_sched_get(int unit,int *mode,int weights[], unsigned int *delay)<br />
DESCRIPTION Retrieves class-of-service policy and corresponding weights and delay<br />
INCLUDE src/tulsi_drivers/bcm_cli_kern/cos.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 77
List of APIs API Call Reference<br />
INPUT<br />
Flash API<br />
unit Device number<br />
mode (output) Scheduling mode i.e. BCM_COSQ_STRICT,<br />
BCM_COSQ_WEIGHTED_ROUND_ROBIN, or<br />
BCM_COSQ_BOUNDED_DELAY<br />
weights (Output) Weights for each CoS queue unused if mode is<br />
BCM_COSQ_STRICT.<br />
delay (Output) Maximum delay in microseconds before returning the round-robin to<br />
the highest priority COS queue, unused if mode other than<br />
BCM_COSQ_BOUNDED_DELAY.<br />
RETURN VALUE<br />
BCM_E_NONE (Success)<br />
BCM_E_INTERNAL<br />
int frc_cpci<strong>910</strong>_flash_read_mac(char *mac_addr, int number, int offset)<br />
DESCRIPTION This API reads flash addresses of various devices on the board<br />
INCLUDE src/tulsi_drivers/flash_burner/include/flash_burner.h<br />
INPUT<br />
number Number of mac addresses to be read<br />
mac_addr Mac address that has been read from the flash<br />
offset Index to the mac address buffer in the flash<br />
RETURN VALUE<br />
2 - 78 <strong>CPCI</strong>-<strong>910</strong>
API Call Reference List of APIs<br />
Watchdog APIs<br />
0 (Success)<br />
-ve (Failure)<br />
Supported APIs The supported watchdog APIs are described in the following sections<br />
int frc_cpci<strong>910</strong>_watchdog_arm_shortdog( void )<br />
DESCRIPTION This arms the shortdog enabling it to RESET the board if not refreshed before<br />
timeout. The board resets if the shortdog is not refreshed periodically once it<br />
is armed.<br />
INDLUDE src/tulsi_drivers/watchdog/watchdog.h<br />
int frc_cpci<strong>910</strong>_watchdog_refresh_shortdog( void )<br />
DESCRIPTION This refreshes the shortdog. The period to refresh should be within 200 ms<br />
once the shortdog is armed or refreshed.<br />
INDLUDE src/tulsi_drivers/watchdog/watchdog.h<br />
int frc_cpci<strong>910</strong>_watchdog_disarm_shortdog( void )<br />
DESCRIPTION This disarms the shortdog. This will disable the shortdog to cause board<br />
RESET .<br />
Once the shortdog is armed, it should be refreshed periodically (around<br />
100ms) so as to not cause a board reset. The Linux timer functions can be used<br />
to call the frc_cpci<strong>910</strong>_watchdog_refresh_shortdog() function.<br />
INDLUDE src/tulsi_drivers/watchdog/watchdog.h<br />
<strong>CPCI</strong>-<strong>910</strong> 2 - 79
List of APIs API Call Reference<br />
2 - 80 <strong>CPCI</strong>-<strong>910</strong>
A<br />
Error Codes
Error Codes Error Codes<br />
Error Codes<br />
The error codes that can be returned by Extended API routines are detailed here. The return values<br />
of each API call description indicates which error codes may be returned by the call.<br />
Certain API calls propagate error codes from the lower level functions for which return codes may<br />
vary. In this case it is not practical to list all of the possible return values. This condition is indicated<br />
by the notation BCM_E_XXX.<br />
Any error code returned by an API call may be turned into a printable string by passing it to<br />
bcm_errmsg ().<br />
Error Code Error Number Cause<br />
BCM_E_AUTOEG_BUSY -6 Auto-negotiation is in progress<br />
BCM_E_AUTONEG_DISABLE -5 Attempted to get rem ote properties, but<br />
auto negotiation is not enabled<br />
BCM_E_AUTONEG_ERROR -7 Auto negotiation error or remote default<br />
BCM_E_DEFIP_TBL_EMPTY -61 Default table empty<br />
BCM_E_DEFIP_TBL_FULL -60 Default IP table is full<br />
BCM_E_DUP_INSERT -48 Duplicated insertion<br />
BCM_E_FILTER_MASK_NOT_<br />
FOUND<br />
BCM_E_FILTER_RULE_NOT_<br />
FOUND<br />
Filter mask not found<br />
Filter rule not found<br />
BCM_E_HANDLER_BUSY -45 Sw packet handler busy<br />
BCM_E_HANDLER_NOT_FO<br />
UND<br />
-44 Sw packet handler not found<br />
BCM_E_INIT -25 Module is not initialized<br />
BCM_E_INTERNAL -3 Unexpected internal error<br />
BCM_E_INVALID_INDEX -47 Invalid module or table index<br />
BCM_E_L2_NOT_FOUND -41 L2 address not found<br />
<strong>CPCI</strong>-<strong>910</strong> A - 3
Error Codes Error Codes<br />
Error Code Error Number Cause<br />
BCM_E_L3_NOT_FOUND -42 L3 address not found<br />
BCM_E_TBL_L3_EMPTY L3 table empty<br />
BCM_E_L3INF_TBL_EMPTY -56 L3 INF Table Empty<br />
BCM_E_L3INF_TBL_FULL -55 L3 INF Table Full<br />
BCM_E_MASK_MAX -43 Maximum number of filter masks already<br />
allocated<br />
BCM_E_MASK_TBL_FULL Mask table full<br />
BCM_E_MCAST_NOT_FOUN<br />
D<br />
-49 Multicast entry not found<br />
BCM_E_MEMORY -9 Internal out of memory<br />
BCM_E_MII_TIMEOUT -2 MII register access time-out<br />
BCM_E_NONE 0 No error ---- operation Successful<br />
BCM_E_NOT_IMPL -4 The requested operation is not implemented,<br />
or is unavailable on this chip<br />
BCM_E_PARAM -26 Illegal or bad parameter detected<br />
BCM_E_PORT -27 Illegal port number<br />
BCM_E_PORT_EXISTS -29 Requested port already exists<br />
BCM_PORT_NOT_FOUND -28 Requested port could not be found<br />
BCM_E_SCHAN_TIMEOUT -1 Internal register or memory access timeout<br />
BCM_E_TBL_FULL Table full<br />
BCM_E_TRUNK_ID -36 Illegal trunk ID.<br />
BCM_E_TRUNK_MAX -37 Trunk already contains maximum number of<br />
ports.<br />
BCM_E_UNIT -13 Requested unit not attached or out of range.<br />
BCM_E_UNTAG_CONFLICT -46 Untagged ports must be subset of ports.<br />
BCM_E_VLAN_EXISTS -32 VLAN ID already exists.<br />
A - 4 <strong>CPCI</strong>-<strong>910</strong>
Error Codes Error Codes<br />
Error Code Error Number Cause<br />
BCM_VLAN_ID VLAN ID is invalid.<br />
BCM_E_VLAN_IF_CONFLICT -35 VLAN contains ports with conflicting ingress<br />
filter modes.<br />
BCM_E_VLAN_MAX -33 Maximum number of VLANs has already been<br />
defined.<br />
BCM_E_VLAN_NOT_FOUND -31 VLAN ID not found.<br />
<strong>CPCI</strong>-<strong>910</strong> A - 5
Error Codes Error Codes<br />
A - 6 <strong>CPCI</strong>-<strong>910</strong>
B<br />
Project Configuration and Example Design
Project Configuration and Example Design Project Configuration and Example Design<br />
Project Configuration and Example Design<br />
This appendix details how to build the project, configure and modify the example design for the<br />
microcode loader.<br />
Note:<br />
• Ensure that you have the Intel ® IXP1200 SDK 2.01.112.Workbench installed.<br />
• It is presumed that you are familiar with using Intel ® IXP1200 SDK 2.01.112.Workbench.<br />
• Refer to the Intel ® IXP1200 <strong>Network</strong> Processor Family Development Tool User’s <strong>Guide</strong> for<br />
information on how to use the Workbench.<br />
Building Project<br />
To build the project, invoke the Intel ® IXP1200 SDK 2.01.112.Workbench. Follow the steps detailed<br />
here to configure the project and modify the example design. To build and configure your project do<br />
the following:<br />
Create a New Project<br />
Insert Assembler Files<br />
Build Setup<br />
Create a New Project<br />
To create a new project follow these steps:<br />
1. Open the Intel ® IXP1200 Developer Workbench.<br />
2. Select File=>New Project. The New Project dialog window opens. Enter the values as<br />
specified here in each of the available fields:<br />
Field (box) Action required<br />
Project name Enter the name of the project.<br />
Location Specify the folder in which you want to store the project. It is suggested you<br />
specify project folder in the following directory:<br />
%ixp1200/microcode/workbench_projects.<br />
If the folder that you specify in the above directory does<br />
not exist, Workbench creates it for you.<br />
Specify chip type Select the IXP1250 with CRC and ECC radio button.<br />
<strong>CPCI</strong>-<strong>910</strong> B - 3
Project Configuration and Example Design Project Configuration and Example Design<br />
3. Click OK to save the new project settings and close the New Project window.<br />
4. Unzip all the source code files from the zip file provided for installation to your project<br />
directory.<br />
Insert Assembler Files<br />
1. From the File menu, select Project=>Insert assembler source files. The Insert Assembler<br />
Source Files into Project window opens.<br />
2. Browse to the project directory and select the following files:<br />
•Ixplib.uc<br />
•Rx_rl_ether1gig.uc<br />
•Tx_rl_ether1gig.uc<br />
3. Click OK to include the selected files for the project.<br />
Build Setup<br />
1. From the File menu, select Build=>Settings. The Build Settings window opens.<br />
2. Click the General tab.<br />
a) Assembler include directories<br />
Type the project directory path name to include all header and source files. You can also use<br />
the browse button provided. In order to display the browse button, double- click in the<br />
“Assembler include directories” box.<br />
b) Specify the range of processor revisions on which you want the linked code to run:<br />
Set:<br />
Minimum revision to “1”<br />
Maximum revision to “no limit”.<br />
3. Click the Assembler tab.<br />
a) Click the [New] button to specify the new output to the .list file. The Insert New List File<br />
into Project dialog box appears.<br />
b) Insert these files:<br />
•rec_f0 list<br />
•rec_f1.list<br />
•xmit_f4.list<br />
B - 4 <strong>CPCI</strong>-<strong>910</strong>
Project Configuration and Example Design Project Configuration and Example Design<br />
c) Associate root files for the corresponding list files:<br />
List File Root File<br />
rec_f0.list rx_rl_ether1gig.uc<br />
rec_f1.list rx_rl_ether1gig.uc<br />
xmit_f4.list tx_rl_ether1gig.uc<br />
d) Select the following Assembler Options:<br />
•Optimize to turn on Assembler optimizations<br />
•Produce debug info to add debug information to the output file. Select this option to open a thread<br />
window in the debug mode.<br />
e) Specify the following in Preprocessor Definitions<br />
List File Preprocessor Definitions<br />
rec_f0.list UENGINE_ID=0<br />
rec_f1.list UENGINE_ID=1<br />
xmit_f4.list UENGINE_ID=4<br />
6. Click the Linker tab.<br />
a) Specify the following:<br />
Microengine Select this List File<br />
Microengine 0 rec_f0.list<br />
Microengine 1 rec_f1.list<br />
Microengine 4 xmit_f4.list<br />
b) Select the check box for Produce Debug Info.<br />
3. Click [OK] to save the Build Settings.<br />
Build Setup is now complete and you can compile the project.<br />
<strong>CPCI</strong>-<strong>910</strong> B - 5
Project Configuration and Example Design Project Configuration and Example Design<br />
Example Design<br />
The Example Design demonstrates the use of the Intel ® IXP Processor on <strong>CPCI</strong>-<strong>910</strong>. The application<br />
is designed to receive and transmit data packets received from the switch. The example design<br />
software consists of initialization code that executes on the Intel StrongARM* core and packet<br />
processing code that executes on three of the six Microengines. The Microengine code is written in<br />
IXP1200 microengine assembly language.<br />
Note:<br />
• It is assumed you are familiar with IXP1200 architecture, features, operation, and Intel<br />
IXP1200 <strong>Network</strong> Processor Development Environment. For more information refer to Intel ®<br />
Gigabit Ethernet Example Design.<br />
• The Gigabit Ethernet Example Design is an example application, designed to send and<br />
receive IP packets to and from Linux TCP/IP stack. It has not been verified for compliance<br />
against the applicable standards (such as TCPIP). Use this as a starting point for application<br />
design since this has been tested only in the hardware environment.<br />
Code snippets from the example design are included in the description. The code snippets<br />
demonstrate implementation of particular features. The Gigabit Ethernet Example Design<br />
demonstrates one method of how such an application may be implemented. The design uses the<br />
features and resources of the IXP1200. The design offers a methodology for designing applications<br />
for high data-rate packet processing.<br />
Modifying Example Design<br />
The example microcode in the present design transfers all the packets received on the IXbus to the<br />
SA core using a linked list data structure. There is no support to handle the port, which is not<br />
connected to the switch.<br />
Note: For further details refer to the Intel ® IXP1200 <strong>Network</strong> Processor Gigabit Ethernet Example<br />
Design Application Note provided with provided with the Intel ® IXP1200 SDK2.01.112.<br />
Receive Processing for Receive Microengine<br />
The example design provided with this release assumes prior knowledge of Gigabit Ethernet<br />
Example as described in Intel ® IXP1200 SDK 2.01.112. The code segments in this section can be<br />
found in rx_rl_ether1gig.uc file.<br />
On reception of the SOP packet the example design places the packet placed in RFIFO in the<br />
SDRAM.<br />
The following code segment does the following:<br />
B - 6 <strong>CPCI</strong>-<strong>910</strong>
Project Configuration and Example Design Project Configuration and Example Design<br />
Line 1: dram_rfifo_read (packet_buf_addr, QWOFFSET0, rfifo_addr, QWOFFSET0,<br />
QWCOUNT8, sig_done);<br />
Line 2: shf_left (output_intf, CORE_STACK_INTF1, 3);<br />
Line1: This piece of code reads the 64 byte packet from RFIFO starting from the element number<br />
given by rfifo_addr and puts the read packet into the SDRAM at an address specified by the GPR<br />
packet_buf_addr.<br />
Line2: This piece of code then indicates that the packet is meant for the SA core.<br />
To transfer the packet to a port other than SA core, modify the code as shown:<br />
shf_left (output_intf, FAST_PORT_LO/FAST_PORT_HI,3);<br />
The output_intf can be either of the FAST PORTS. In this example code, the output_intf is<br />
core port, which is assigned a value of 18. To send packets to a port other than CORE OR<br />
FAST_PORT define NEW_PORT and use it.<br />
Transmitting Packets for Receive Microengine<br />
After the receive thread finishes processing an Ethernet frame, it uses linked list data structure to<br />
pass the packet information to the SA core.<br />
Note: Refer to rx_rl_ether1gig.uc file for more information on code segments.<br />
When the Receive Thread is ready to place the frame onto the transmission queue, it does so by writing<br />
the 2-word descriptor to the queue entry. The following Code Point highlights the instructions<br />
used to place a frame onto the queue.<br />
To transfer the packet to a port other than SA core, modify the code as shown:<br />
.if (output_intf == FAST_PORT_LO_INTF)<br />
sram_write ($desc_buf[0],XMIT_FPORT_DESCRIPTOR_BASE_X, $desc_buf[2], LWCOUNT2,<br />
ctx_swap);<br />
.endif<br />
where:<br />
The output_intf can be defined as either FAST PORT1 or FAST_PORT2.<br />
The circular queue base address (XMIT_FPORT_DESCRIPTOR_BASE_X) can vary for different<br />
ports.<br />
<strong>CPCI</strong>-<strong>910</strong> B - 7
Project Configuration and Example Design Project Configuration and Example Design<br />
Transmitting Packet Details for Transmit Microengine<br />
The SA core inserts an Ethernet frame to a circular transmit queue beginning at a location in SRAM<br />
(XMIT_FPORT_DESCRIPTOR_BASE_1 =0x1000) and increments a Transmit Element Count in<br />
Scratchpad memory. The Scheduler in Microengine 4 reads the counter located at the Scratchpad<br />
address XMIT_FPORT1_ELE_COUNT.<br />
The counter is compared by the Scheduler with an internal counter to determine if a new frame is<br />
ready to be transmitted. The Scheduler maintains the internal counter in the absolute register<br />
@assigned_mpkt_cnt.<br />
The Scheduler modifies this counter when a new frame is on the queue. When a frame contains<br />
multiple Mpackets, the Fill Threads modify the frame.<br />
Assignment registers are used by the Scheduler to communicate to each of the Fill Threads in the<br />
Microengine . There is a set of three absolute registers. Each Fill thread in the Microengine has a<br />
absolute register. The names of the three absolute registers are:<br />
•@assign1<br />
•@assign2<br />
•@assign3.<br />
When the Fill threads get an assignment from the scheduler, they read the circular queue to get the<br />
address of the SDRAM location where the packet has been placed. The macro<br />
tx_packetlink_read_cirq_nik dequeues the packet from the circular queue and sends it on<br />
the IXbus.<br />
The above macro can be found in tx_rl_ether1gig_fill.uc file.<br />
B - 8 <strong>CPCI</strong>-<strong>910</strong>
Index of Functions<br />
F<br />
Functions<br />
enum cardtype bcm_check_card_type() 2-<br />
54<br />
extern int bcm_l3_status() .................. 2-60<br />
int bcm_cosq_config_get() ................. 2-76<br />
int bcm_cosq_config_set() .................. 2-76<br />
int bcm_cosq_mapping_get() ............. 2-77<br />
int bcm_cosq_mapping_set() ............. 2-76<br />
int bcm_cosq_sched_get() .................. 2-78<br />
int bcm_cosq_sched_set() ................... 2-77<br />
int bcm_filter_action_match() ............ 2-18<br />
int bcm_filter_create() ........................ 2-15<br />
int bcm_filter_destroy() ...................... 2-16<br />
int bcm_filter_install() ........................ 2-19<br />
int bcm_filter_qualify_data() ............. 2-18<br />
int bcm_filter_qualify_egress() .......... 2-17<br />
int bcm_filter_qualify_priority() ........ 2-16<br />
int bcm_filter_reinstall() ..................... 2-19<br />
int bcm_filter_remove() ...................... 2-15<br />
int bcm_l2_addr_add() ....................... 2-11<br />
int bcm_l2_addr_remove_by_port() .... 2-9<br />
int bcm_l2_addr_remove_by_trunk() 2-10<br />
int bcm_l2_addr_remove_by_vlan() .. 2-10<br />
int bcm_l3_defip_add() ...................... 2-64<br />
int bcm_l3_defip_delete() ................... 2-64<br />
int bcm_l3_defip_delete_by_interface() .....<br />
................................................. 2-65<br />
int bcm_l3_defip_find_index() ........... 2-67<br />
int bcm_l3_defip_get() ....................... 2-66<br />
int bcm_l3_defip_update() ................. 2-65<br />
int bcm_l3_interface_create() ............. 2-58<br />
int bcm_l3_interface_destroy() ........... 2-59<br />
int bcm_l3_interface_update() ........... 2-59<br />
int bcm_l3_ip_add() ........................... 2-60<br />
int bcm_l3_ip_delete() ........................ 2-61<br />
int bcm_l3_ip_delete_all() .................. 2-63<br />
int bcm_l3_ip_delete_by_index() ....... 2-62<br />
int bcm_l3_ip_delete_by_interface() .. 2-62<br />
int bcm_l3_ip_delete_by_prefix() ...... 2-61<br />
int bcm_l3_ip_find() ...........................2-63<br />
int bcm_mcast_addr_add() .................2-68<br />
int bcm_mcast_addr_remove() ...........2-69<br />
int bcm_mcast_join() ...........................2-71<br />
int bcm_mcast_leave() ........................2-70<br />
int bcm_mcast_port_get() ...................2-69<br />
int bcm_mirror_egress_get() ..............2-75<br />
int bcm_mirror_egress_set() ...............2-74<br />
int bcm_mirror_ingress_get() .............2-74<br />
int bcm_mirror_ingress_set() ..............2-73<br />
int bcm_mirror_mode() ......................2-72<br />
int bcm_mirror_to_get() .....................2-73<br />
int bcm_mirror_to_set() ......................2-72<br />
int bcm_packet_send_async() .............2-39<br />
int bcm_packet_send_sync() ...............2-38<br />
int bcm_port_autoneg_get() ...............2-42<br />
int bcm_port_autoneg_set() ................2-43<br />
int bcm_port_bringup() ......................2-53<br />
int bcm_port_duplex_get() .................2-44<br />
int bcm_port_duplex_set() ..................2-45<br />
int bcm_port_learn_get() ....................2-51<br />
int bcm_port_learn_modify() .............2-52<br />
int bcm_port_learn_set() .....................2-51<br />
int bcm_port_link_status_get() ...........2-42<br />
int bcm_port_linkscan_get() ...............2-40<br />
int bcm_port_linkscan_set() ...............2-41<br />
int bcm_port_loopback_get() ..............2-48<br />
int bcm_port_loopback_set() ..............2-48<br />
int bcm_port_pause_addr_get() .........2-47<br />
int bcm_port_pause_addr_set() ..........2-47<br />
int bcm_port_pause_get() ...................2-46<br />
int bcm_port_pause_set() ...................2-46<br />
int bcm_port_shutdown() ...................2-53<br />
int bcm_port_speed_get() ...................2-43<br />
int bcm_port_speed_set() ...................2-44<br />
int bcm_port_stp_get() .......................2-49<br />
int bcm_port_stp_set() ........................2-50<br />
int bcm_port_vlan_get() .....................2-37<br />
int bcm_stk_init() ................................2-35<br />
int bcm_stk_port_get() ........................2-36<br />
int bcm_stk_port_is_stack() ................2-36<br />
<strong>CPCI</strong>-<strong>910</strong> I - 1
int bcm_trunk_bitmap_expand() ........2-33<br />
int bcm_trunk_broadcast_port_get() ..2-31<br />
int bcm_trunk_create() ........................2-29<br />
int bcm_trunk_destroy() .....................2-32<br />
int bcm_trunk_get() ............................2-33<br />
int bcm_trunk_info_get() ....................2-30<br />
int bcm_trunk_mcast_join() ................2-32<br />
int bcm_trunk_psc_get() .....................2-30<br />
int bcm_trunk_set() .............................2-31<br />
int bcm_trunk_use_tid() .....................2-29<br />
int bcm_vlan_create() ............................2-4<br />
int bcm_vlan_destroy() .........................2-5<br />
int bcm_vlan_destroy_all () ..................2-6<br />
int bcm_vlan_port_add() ......................2-7<br />
int bcm_vlan_port_get() ........................2-8<br />
int bcm_vlan_port_remove() ................2-7<br />
int cmic_pci_getreg() ..........................2-26<br />
int cmic_pci_setreg() ...........................2-26<br />
int cmic_read_miim() ..........................2-23<br />
int cmic_read_reg() .............................2-27<br />
int cmic_write_miim() ........................2-23<br />
int cmic_write_reg() ............................2-28<br />
int filter_dump() .................................2-20<br />
int filter_qualify_ingress() ..................2-17<br />
int frc_cpci<strong>910</strong>_flash_read_mac() .......2-79<br />
int frc_cpci<strong>910</strong>_watchdog_arm_shortdog()<br />
2-79<br />
int<br />
frc_cpci<strong>910</strong>_watchdog_disarm_shortdog()<br />
2-80<br />
int<br />
frc_cpci<strong>910</strong>_watchdog_refresh_shortdog()<br />
2-80<br />
int l2_addr_get() ..................................2-13<br />
int l2_addr_remove() ..........................2-13<br />
int l2-addr_add() .................................2-11<br />
int PCI_config_read() ..........................2-25<br />
int PCI_config_write() .........................2-25<br />
int port_vlan_set() ...............................2-37<br />
unsigned int cmic_irq_disable() .........2-24<br />
unsigned int cmic_irq_enable() ..........2-24<br />
I - 2 <strong>CPCI</strong>-<strong>910</strong>
Product Error Report<br />
Product: Serial No.:<br />
Date Of Purchase: Originator:<br />
Company: Point Of Contact:<br />
Tel.: Ext.:<br />
Address:<br />
Present Date:<br />
Affected Product:<br />
o Hardware o Software o Systems<br />
Error Description:<br />
This Area to Be Completed by Force Computers:<br />
Date:<br />
PR#:<br />
Affected Documentation:<br />
o Hardware o Software o Systems<br />
Responsible Dept.: o Marketing o Production<br />
Engineering ‡ o Board o Systems<br />
+ Send this report to the nearest Force Computers headquarter listed on the address page.