Broadcom DQM-based Network Driver

The DQM-based network driver (dqnet) instantiates and manages multiple
network devices. The dqnet driver terminates at the lower level in calls
to the DQM driver (see brcm,dqm binding). The DQM's are used to carry
messages describing network packets between dqnet and the rest of the
system hardware.

The underlying DQM's are grouped into Tx/Rx packet communication "channels".
Each channel can be dedicated to packets for a single device or can be
multiplexed with packets from multiple devices. dqnet will handle the
multiplexing & demultiplexing of packets between the DQM channels and the
network devices. A channel can carry packet messages representing one or
more host endpoint devices or the channel can carry messages representing
exception packets between network devices and a FAP.

The driver provides typical network device management of items such as link
state, statistics, and control via ioctls and tools such as ethtool and
ifconfig.



Required Network Device Node Properties:

- compatible:
    Must be "brcm,dqnet".

- channel:
    phandle to node defining the DQM channel to be used for the network device.

- dev-name:
    Default name to be assigned to the network device interface.

- demux:
    Decribes the method to use to demux packets on the channel to the correct network
    device interface. This must be one of:
    - none:
        The packets on this channel do not require demuxing as they all belong to a
	single network device interface.
    - subid:
        Use the if-if and if-sub-id in the channel's DQM messages to determine the
	assignment between the packet and network device interface.
    - arl:
        Use an ARL table to determine the network device interface from the packet's
	source MAC address.

- link-type:
    Identifies the mechanism by which the network device link state and associated
    parameters are to be determined. Must be one of:
    - switch:
        Link info is determined by calls (and callbacks) to (from) a switch driver.
    - rpc:
        Link info is determined via RPC messages with another CPU (such as the
	cable modem CPU)
    - phy:
        A phylib-based phy device driver provides link info

Optional Network Device Node Properties:

- if-id:
    This is the port ID (Runner) or MAC ID (GFAP) that uniquely identifies the FAP's
    ingress/egress port assigned to this network device interface

- if-sub-id:
    Additional identified to further refine the if-id. This is primarily necessary
    to uniquely identify each port on a switch thjat only has a single IMP interface
    port to the FAP or to uniquely identify each SSID assigned to each WiFi device
    instance.

- brcm-tag:
    Specifies whether the network device interface must have BRCM tags inserted/removed.

- rpc-channel:
    If the link-type is "rpc" then this specifies the phandle of the RPC channel to use.

- mac-handle:
    If the link-type is phy then this can be used to specify the phandle for the UniMAC
    to which the phy is attached. This allows the statistics to be read from the MAC.

- phy-handle:
    If the link-type is phy the this specifies the phandle of the phy node.



Required DQM Channel Properties:

- dev-name:
    String name uniquely identifying the channel.

- #tx-q-cells:
    Specifies the number of columns in the tx-q property. THe columns represent:
    - DQM device:
        The name of the DQM device on which the TX Q resides. This must match the dev-name
	property in the DQM device node.
    - Q #:
        The # (index) of the DQM on the DQM device.
    - Priority:
        The relative priority of the Q amongst the other TX Q's.
    - US/DS:
        Must be:
	- upstream:
	    The destination of the packet is towards the WAN.
	- downstream:
	    The destination of the packet is towards the LAN.

- #rx-q-cells:
    Specifies the number of columns in the rx-q property. THe columns represent:
    - DQM device:
        The name of the DQM device on which the RX Q resides. This must match the dev-name
	property in the DQM device node.
    - Q #:
        The # (index) of the DQM on the DQM device.
    - Priority:
        The relative priority of the Q amongst the other RX Q's.

- tx-q:
- rx-q:
    An array of DQM's to use for egress packets (TX) or ingress packets (RX).

- type:
    Specifies how the channel is used. Must be one of:
    - fap-exception:
        The channel carries packets that the FAP could not automatically route/switch/bridge
	from ingress port to egress port. THe FAP is sending these packets to Linux for
	routing/bridging.
    - fap-host:
        The channel carries packets for a host endpoint. dqnet is not assisting the FAP with
	routing/bridging of these packets, but rather it is providing a host endpoint interface.
	The channels used for WiFi packets are an example of this.
    - point-to-point:
        This channel does not interface with a FAP, but rather interfaces with another CPU. In
	this case each CPU represents a host endpoint.

- q-msg-fmt:
    Must be one of:
    - runner:
        The DQM messages conform to the Runner format.
    - gfap:
        The DQM messages conform to the GFAP format.


Example:

	eth0: ethernet0 {
		compatible = "brcm,dqnet";
		channel = <&qchan0>;
		dev-name = "eth0";
		if-id = <2>;		/* rdpa_if_lan0 */
		if-sub-id = <0>;	/* if-sub-id must match the first column in phy-port node */
		demux = "subid";
		link-type = "switch";
		brcm-tag = <1>;
	};

	eth1: ethernet1 {
		compatible = "brcm,dqnet";
		channel = <&qchan0>;
		dev-name = "eth1";
		if-id = <3>;		/* rdpa_if_lan1 */
		if-sub-id = <1>;	/* if-sub-id must match the first column in phy-port node */
		demux = "subid";
		link-type = "switch";
		brcm-tag = <1>;
	};

	eth2: ethernet2 {
		compatible = "brcm,dqnet";
		channel = <&qchan0>;
		dev-name = "eth2";
		if-id = <4>;		/* rdpa_if_lan2 */
		if-sub-id = <2>;	/* if-sub-id must match the first column in phy-port node */
		demux = "subid";
		link-type = "switch";
		brcm-tag = <1>;
	};

	eth3: ethernet3 {
		compatible = "brcm,dqnet";
		channel = <&qchan0>;
		dev-name = "eth3";
		if-id = <5>;		/* rdpa_if_lan3 */
		if-sub-id = <3>;	/* if-sub-id must match the first column in phy-port node */
		demux = "subid";
		link-type = "switch";
		brcm-tag = <1>;
	};

	cm0 {
		compatible = "brcm,dqnet";
		channel = <&qchan0>;
		dev-name = "cm0";
		if-id = <0>;		/* rdpa_if_wan0 */
		demux = "subid";
		link-type = "rpc";
		rpc-channel = <&rpcrgcm>;
	};

	priv0 { /* RG <--> CM private */
		compatible = "brcm,dqnet";
		channel = <&qchan1>;
		dev-name = "priv0";
		demux = "none";
		link-type = "rpc";
		rpc-channel = <&rpcrgcm>;
	};

	qchan0: q-channel0 {
		dev-name = "fap-exception";

		#tx-q-cells = <4>;
		/*	DQM device,  	Q#,	Priority	US/DS					*/
		tx-q =	"cpucomm",	"35",	"0",		"upstream",	/* RG upstream egress	*/
			"cpucomm",	"34",	"0",		"downstream";	/* RG downstream egress	*/
		#rx-q-cells = <3>;
		/*	DQM device,	Q#,	Priority						*/
		rx-q =	"cpucomm",	"48",	"0";				/* Runner-->RG 0	*/

		type = "fap-exception";
		q-msg-fmt = "runner";
	};

	qchan1: q-channel1 {
		dev-name = "cm-private";

		#tx-q-cells = <3>;
		/*	DQM device,	Q#,	Priority	US/DS   			*/
		tx-q =	"cpucomm",	"14",	"0";				/* RG-->CM	*/
		#rx-q-cells = <3>;
		/*	DQM device,	Q#,	Priority					*/
		rx-q =	"cpucomm",	"15",	"0";				/* CM-->RG	*/

		type = "point-to-point";
		q-msg-fmt = "gfap";
	};

	rpcrgcm: rpcrgcm {
		compatible = "brcm,itc-rpc";
		dev-name = "rg-cm";
		dqm = "cpucomm";
		tx-q = <2>;
		rx-q = <3>;
	};
