Saturday, May 19, 2012

Thread Safe?


"Every function that uses files in some way. This  includes printf, scanf, getchar, and putchar (unsafe). The functions sprintf and  sscanf are not included (safe)." They (former) need mutex in a certain way to serialize these operations. 

  • Thread(or task) is an entity in multi-tasking and they can share memory (global variable) with mutex mechanism. / threads are under the same application.
  • An application (process) can launch multiple threads.
  • Process is a standalone self-contained application and it "cannot" share the global variables. (They run on the different contexts -  属性 ) They can only communicate thru IPC channel.
  • Multiple processes can run on a CPU.



Friday, May 18, 2012

C String Lib Reference


Vlan setting for Ixia

  • Check Vlan table
#sh vlan 
Codes: * - Default VLAN, G - GVRP VLANs
Q: U - Untagged, T - Tagged
x - Dot1x untagged, X - Dot1x tagged
G - GVRP tagged, M - Vlan-stack
NUM Status Description Q Ports
* 1 Inactive
2 Inactive U Te 5/0,3
3 Inactive U Te 5/1-2
  • Change to L2 mode
#conf
(conf)#int vlan [entry id]
(conf)#int vlan 4
FORMAT: (conf-if-vl-4)#int rang te [slot] /[port] – [port]
(conf-if-vl-4)#int rang te 10/0 - 3
(conf-if-range-te-10/0-3)#no shut
(conf-if-range-te-10/0-3)#sw
03:16:50: %RPM0-P:CP %IFMGR-5-ACTIVE: Changed Vlan interface state to active: Vl 1
(conf-if-range-te-10/0-3)#exit
  • Add a new entry to Vlan table
(conf)#int vlan [id]
(conf)#int vlan 4
(conf-if-vl-4)#untag ten 10/0
03:17:38: %RPM0-P:CP %IFMGR-5-ACTIVE: Changed Vlan interface state to active: Vl 4
(conf-if-vl-4)#untag ten 10/3
(conf-if-vl-4)#exit
  • Show Vlan Table
(conf)#exit
#03:18:07: %RPM0-P:CP %SYS-5-CONFIG_I: Configured from console by console
#sh vlan
Codes: * - Default VLAN, G - GVRP VLANs
Q: U - Untagged, T - Tagged
x - Dot1x untagged, X - Dot1x tagged
G - GVRP tagged, M - Vlan-stack
NUM Status Description Q Ports
* 1 Active U Te 10/1-2
2 Inactive U Te 5/0,3
3 Inactive U Te 5/1-2
4 Active U Te 10/0,3
  • Increase MTU
#conf
FORMAT: (conf)#int range ten  [slot]/[port]  - [port]   // Need space -
(conf)#int range ten 10/0 - 3
(conf-if-range-te-10/0-3)#mtu 9252
(conf-if-range-te-10/0-3)#exit
(conf)#exit
  • Check line rate
#sh int tengiga | grep line-rate|TenGi
#sh int tengiga 10 | grep line-rate|TenGi
TenGigabitEthernet 10/0 is up, line protocol is up
Input 9956.00 Mbits/sec, 248909 packets/sec, 99.90% of line-rate
Output 9956.00 Mbits/sec, 248899 packets/sec, 99.90% of line-rate
TenGigabitEthernet 10/1 is up, line protocol is up
Input 9956.00 Mbits/sec, 248898 packets/sec, 99.90% of line-rate
Output 9956.00 Mbits/sec, 248909 packets/sec, 99.90% of line-rate
TenGigabitEthernet 10/2 is up, line protocol is up
Input 9956.00 Mbits/sec, 248909 packets/sec, 99.90% of line-rate
Output 9956.00 Mbits/sec, 248898 packets/sec, 99.90% of line-rate
TenGigabitEthernet 10/3 is up, line protocol is up
Input 9956.00 Mbits/sec, 248898 packets/sec, 99.90% of line-rate
Output 9956.00 Mbits/sec, 248909 packets/sec, 99.90% of line-rate
  • Delete an entry in Vlan table
#conf
(conf)#no int vlan [id]
(conf)#end

How to change pattern in Ixia







  • Before create statistic view window, do not forget to create Group View to group the ports of interest.
  • May need to clear the “Ownership” of the ports to start traffic



(Menu) Stream Static View
In StatView window
Column B: mouse right click
(Menu) Edit Stream è Pattern (Random/Fix/Repeating), Size (Random/Fix) – (in Frame tab) and Rate (100%) – (in Control tab)
Start/Stop traffic è need to select column
Takes time (5 minutes or so) to reach 100% (99%) line rate

Before create statistic view window, do not forget to create Group View to group the ports of interest.
May need to clear the “Ownership” of the ports to start traffic


SPD spec on Wiki



Check Offset 5: memory type (SDR SDRAM/ DDR SDRAM/ DDR2 SDRAM/ DDR3 SDRAM)
Check # of banks
Check module bank density (512Mb, 1G so on)


DIMM size = module bank density x # of banks

Thursday, May 17, 2012

Where is Driver in NetBsd code base

SW-NetBSD/usr/src/sys/arch/evbppc/moduleName/componentKernelDrivers.c

i.e. i2c.c asicA.c fpgaB.c

  • contain open/close/ioctl calls and HW init function.
  • This level calls real low driver.
  • This level does not implements semaphore.
  • Device address/offset or register address passed thru via caddr_t structure. Format user definable?