# Token Ring WIFI



## jorgealdobr (Apr 20, 2010)

Hello !

My first post in this forum.

I was thinking about a new mode for WIFI : Token Ring.

While im no kernel hacker, i think such a project would raise interest and get help from more experienced programmers.

I dont know where to start...

My plan is to implement some kind of "ring passing" access method for wireless, in order to decrease collisions in higly congested outdoor networks.

Currently RTS/CTS tries to solve the "hidden node" problem, but, from field experience we see that this is not enough.

I have some schematics how a WIFI token ring would work.

If anyone is interested i can share my thoughts about how to acomplish that.

Thank you in advance,
J. Aldo.


----------



## SirDice (Apr 20, 2010)

jorgealdobr said:
			
		

> My plan is to implement some kind of "ring passing" access method for wireless, in order to decrease collisions in higly congested outdoor networks.


And how are you going to do that? Remember that WiFi is a shared medium similar to the old coax networks. One client sends and all others listen. How are you going to define where the ring starts and where it ends? What if a client in the middle shuts down?


----------



## trasz@ (Apr 20, 2010)

Disclaimer: I know absolutely nothing about WiFi.

"Lost token" problem was there in the Token Ring.  IIRC the network devices just had a timer that was  reset after receiving a token, an when the timer expired, it was assumed that the token has been lost.


----------



## SirDice (Apr 20, 2010)

Yes, but token ring had an incoming and outgoing cable. A signal went in, processed, and send out. You can't do that with wireless. Wireless uses CSMA/CD, similar to ethernet.


----------



## jorgealdobr (Apr 20, 2010)

By "token ring" i just mean the ring passing.

The idea is the following :

1 - Theres an AP that coordinates ring passing.
2 - There are clients.

Using a combination of CTS packets, ACKs, etc (borrowed from CSMA/CA mode) you get a "token ring like" mode that shares the medium without collisions (only time where collisions are possible is the association time).

You can setup QoS by having the possibility of one client receiving the token N times during the iteration

something like :
client1 -> client2 -> client1 again -> client 3 

client1 has 50% of transmission time, while client2 and client3 have only 25%

IF you pass the token using CTS packets, all stations will go to "inhibited transmission" mode automatically.

Something like


```
AP-> DATAPACKET TO xx:xx:xx:xx:xx:xx
AP-> CTS xx:xx:xx:xx:xx:xx <timeframe>

Now station xx:xx:xx:xx:xx:xx transmits a packet or NACK back to the AP

AP sends ACK saying that it understood the message and goes to the next client

after serving all clients it sends CTS to broadcast adress (inviting new stations) and stops, waiting for someone to try to associate. after 
some milliseconds, go back to the iteration thru clients.
```
... thats it, all done using standard 802.11 packets.

by using CTS packets, stations unaware of the ring passing will be inhibited continually...


----------



## SirDice (Apr 21, 2010)

Suppose client1 sends a token. All other clients receive this token. How do you decide which client is the next one to send the token?


----------



## robbak (Apr 21, 2010)

client x is sent a token. client x happens to have briefly moved behind a copper pipe and doesn't get the token. The entire network stops dead until some timeout lapses. Rinse and repeat - constantly.
Add that the network fills up its allocated channel with useless token-passing, tying up unlicensed spectrum that is running really short these days.

Token passing on a wireless network sounds like the kind if idea that you only hear of on April the First.


----------



## jorgealdobr (Apr 21, 2010)

"client x happens to have briefly moved behind a copper pipe and doesn't get the token."

Token has expiration time, and timer granularity on Atheros devices is in the microseconds.

You can use three messages handshake :

AP: CTS <client> <microseconds of token>
Client: Ack
Client: Data
AP: Ack

You must understand how an Wireless ISP works in order to make assumptions,

for one : We dont serve mobile clients, only fixed ones.

Clients dont move around.

Client stations use hermetic boxes with an AP inside, on top of a big metal tube rising above obstacles.

Well done instalations have near 0% packet loss.

But our (And i talk from direct experience here) major problem is CSMA/CD behaviour when a lot of stations are online.

RTS/CTS did not solve the hidden node problem either.

Well, to answer your unpolished remark :



> Token passing on a wireless network sounds like the kind if idea that you only hear of on April the First.



Please educate yourself here:

http://escholarship.org/uc/item/21f8k3vh


----------



## SirDice (Apr 21, 2010)

jorgealdobr said:
			
		

> But our (And i talk from direct experience here) major problem is CSMA/CD behaviour when a lot of stations are online.


You can fix this in exactly the same manner as with ethernet. Make your broadcast domains smaller.


----------



## jorgealdobr (Apr 21, 2010)

Not economically feasible.

Ethernet over copper can do this easily with cheapo switchs.

I would have to install another TOWER + Four 90 degress Panels + PC or Routerboard with Four Wireless Cards

Total R$5000 or more.

Would be easier setting up TokenRing mode on a atheros card and upgrading software on the clients.

If i ask ring passing mode, thats because it IS usefull.

I have a tower with four panels and ~400 clients online... and nowhere nearby a place to setup yet another tower (with 2.4ghz frequency usage limitations - only four true channels in Brazil domain).

I know what i am talking about. CSMA/CA becomes ugly in this usage.


----------



## SirDice (Apr 21, 2010)

I'm not saying it could _never_ work. If a station can only send if it has the token and all the others are listening there will never be a collision. As long as you keep strict control over the order in which clients should respond it could work. But wireless is still somewhat unreliable and you don't want to end up with all stations thinking they have a token and can send.


----------



## jorgealdobr (Apr 22, 2010)

is there a way to access wireless board directly, without OS intervention, from userland ?

a kind of socket or tun/tap like device ?


----------



## trasz@ (Apr 23, 2010)

You can run tcpdump(8) on WiFi interfaces, so I guess bpf(4) works as usual for them.


----------



## trasz@ (Apr 23, 2010)

Btw, there is a pluggable rate control framework (http://www.freebsd.org/news/status/report-2010-01-2010-03.html, search for "net80211 rate control framework"); this looks related to what you're trying to do.


----------

