Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mb(9r) [osf1 man page]

mb(9r)																	    mb(9r)

NAME
mb - General: Performs a memory barrier SYNOPSIS
void mb( void ); ARGUMENTS
None DESCRIPTION
The Alpha architecture does not guarantee read/write ordering. That is, the memory subsystem is free to complete read and write operations in any order that is optimal, without regard for the order in which they were issued. Read/write ordering is not the same as cache coherency, which is handled separately and is not an issue. The Alpha architecture also contains a write buffer (as do many high-perfor- mance RISC CPUs, including the MIPS R3000). This write buffer can coalesce multiple writes to identical or adjacent addresses into a single write, effectively losing earlier write requests. Similarly, multiple reads to the same identical or adjacent addresses can be coalesced into a single read. This coalescing has implications for multiprocessor systems, as well as systems with off-board I/O or DMA engines that can read or modify memory asynchronously or that can require multiple writes to actually issue multiple data items. The mb (memory barrier) routine guarantees ordering of operations. The mb routine is derived from the MB instruction, which is described in the Alpha Architecture Reference Manual. The mb routine is a superset of the wbflush routine that ULTRIX drivers use. For compatibility, wbflush is aliased to mb on Tru64 UNIX Alpha systems. You call mb in a device driver under the following circumstances: To force a barrier between load/store operations After the CPU has pre- pared a data buffer in memory and before the device driver tries to perform a DMA out of the buffer Before attempting to read any device CSRs after taking a device interrupt Between writes Device drivers and the operating system are the primary users of the mb routine. However, some user programs, such as a graphics program that directly maps the frame buffer and manipulates registers, might need to call mb. The operating system does not provide a C library routine for mb. User programs that require use of mb should use the following asm construct: #include <c_asm.h> asm ("mb"); NOTES
In most situations that would require a cache flush on other CPU architectures, you should call the mb routine on Tru64 UNIX Alpha systems. The reason is not that mb is equivalent to a cache flush (as it is not). Rather, a common reason for doing a cache flush is to make data that the host CPU wrote available in main memory for access by the DMA device or to access from the host CPU data that was put in main mem- ory by a DMA device. In each case, on an Alpha CPU you should use a memory barrier to synchronize with that event. One example of using mb occurs with an Ethernet network controller. Each Ethernet network controller has a unique Ethernet hardware address that is typically contained in a ROM on the Ethernet controller board. The Ethernet hardware address is a multibyte sequence typically con- sisting of at least 10 bytes. This multibyte Ethernet hardware address is frequently read from the controller hardware by the driver's probe routine by issuing a sequence of reads to the same controller register. Each successive read returns the next byte of the Ethernet hardware address. In such instances, a call to mb should be inserted between each of these read operations to ensure that successive read operations are not coalesced into fewer actual reads as seen by the Ethernet controller. RETURN VALUES
None mb(9r)

Check Out this Related Man Page

AE(4)							   BSD Kernel Interfaces Manual 						     AE(4)

NAME
ae -- Attansic/Atheros L2 FastEthernet controller driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device miibus device ae Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): if_ae_load="YES" DESCRIPTION
The ae device driver provides support for Attansic/Atheros L2 PCIe FastEthernet controllers. The controller supports hardware Ethernet checksum processing, hardware VLAN tag stripping/insertion and an interrupt moderation mechanism. Attansic L2 also features a 64-bit multicast hash filter. The ae driver supports the following media types: autoselect Enable autoselection of the media type and options. The user can manually override the autoselected mode by adding media options to rc.conf(5). 10baseT/UTP Select 10Mbps operation. 100baseTX Set 100Mbps (FastEthernet) operation. The ae driver provides support for the following media options: full-duplex Force full duplex operation. half-duplex Force half duplex operation. For more information on configuring this device, see ifconfig(8). HARDWARE
The ae driver supports Attansic/Atheros L2 PCIe FastEthernet controllers, and is known to support the following hardware: o ASUS EeePC 701 o ASUS EeePC 900 Other hardware may or may not work with this driver. LOADER TUNABLES
Tunables can be set at the loader(8) prompt before booting the kernel or stored in loader.conf(5). hw.ae.msi_disable This tunable disables MSI support on the Ethernet hardware. The default value is 0. SYSCTL VARIABLES
The ae driver collects a number of useful MAC counter during the work. The statistics is available via the dev.ae.%d.stats sysctl(8) tree, where %d corresponds to the controller number. DIAGNOSTICS
ae%d: watchdog timeout. The device has stopped responding to the network, or there is a problem with the network connection (cable). ae%d: reset timeout. The card reset operation has been timed out. ae%d: Generating random ethernet address. No valid Ethernet address was found in the controller NVRAM and registers. Random locally admin- istered address with ASUS OUI identifier will be used instead. SEE ALSO
altq(4), arp(4), miibus(4), netintro(4), ng_ether(4), vlan(4), ifconfig(8) BUGS
The Attansic L2 FastEthernet contoller supports DMA but does not use a descriptor based transfer mechanism via scatter-gather DMA. Thus the data should be copied to/from the controller memory on each transmit/receive. Furthermore, a lot of data alignment restrictions apply. This may introduce a high CPU load on systems with heavy network activity. Luckily enough this should not be a problem on modern hardware as L2 does not support speeds faster than 100Mbps. HISTORY
The ae driver and this manual page was written by Stanislav Sedov <stas@FreeBSD.org>. It first appeared in FreeBSD 7.1. BSD
October 4, 2008 BSD
Man Page