From: Gil Hamilton on 9 Dec 2009 09:24 "Mark" <mark_cruzNOTFORSPAM(a)hotmail.com> wrote in news:hfnboj$rio$1(a)aioe.org: > "Grant Edwards" <invalid(a)invalid.invalid> wrote in message > news:hfna18$pat$1(a)reader1.panix.com... >>> In my original post I was talking about a hardware switch. >> >> Then the question doesn't make any sense. The kernel doesn't >> "treat it" as anything. The kernel neither knows nor cares of >> its existence. > > Well, I think it's obvious I was talking about Layer2 switch > implemented in ASIC. And many such chips have Linux ported on them > (example - Realtek). A "layer 2" switch does not have any MAC addresses. It has ports that are attached to various other devices (routers, hosts, etc.). Those other devices typically have MAC addresses. The switch keeps track of the correspondence between MAC address xyz and port N. This is what a switch does. If a packet shows up destined for MAC address xyz and the switch doesn't know which port it should go to, it "floods" the packet to all its ports (likewise, if the MAC address is a broadcast MAC address). The switch learns which MAC addresses should go to which ports by watching packets flow through over time and maintaining a table in memory. Once it sees packets coming from port N with a given source MAC address, it then knows that it can route packets *destined to* that MAC address via that port. Now many modern switches tend to be more than just a 'layer 2' switch. They may also have significant internal configuration, do routing and a host of other things. In this case, they typically have MAC addresses (and IP addresses) themselves. (Otherwise, there is no way to "address" the box in order to configure it.) GH
From: Grant Edwards on 9 Dec 2009 10:43 On 2009-12-09, Mark <mark_cruzNOTFORSPAM(a)hotmail.com> wrote: > > "Grant Edwards" <invalid(a)invalid.invalid> wrote in message > news:hfna18$pat$1(a)reader1.panix.com... >>> In my original post I was talking about a hardware switch. >> >> Then the question doesn't make any sense. The kernel doesn't >> "treat it" as anything. The kernel neither knows nor cares of >> its existence. > > Well, I think it's obvious I was talking about Layer2 switch > implemented in ASIC. Apparently nobody else thought it was obvious. :) > And many such chips have Linux ported on them (example - > Realtek). I'm still don't know what you're asking, but I'll take another guess at an answer: Some switch chips will add tags to incoming packets to indicate which port they came in on. They also support tags in outbound packets which control which port they are sent from. That allows the CPU in the same 'box' as the switch to do things like split the switch up into VLANs and support spanning tree algorithms. -- Grant Edwards grante Yow! My uncle Murray at conquered Egypt in 53 B.C. visi.com And I can prove it too!!
From: Mark on 9 Dec 2009 23:51 "Gil Hamilton" <gil_hamilton(a)hotmail.com> wrote in message news:Xns9CDC5FAAD33B1gilhamiltonhotmailco(a)85.214.113.135... > A "layer 2" switch does not have any MAC addresses. It has ports that > are attached to various other devices (routers, hosts, etc.). I think you're mistaken. Here is what the standard 802.1d says: 7.12.2 Bridge Ports The individual MAC Entity associated with each Bridge Port shall have a separate individual MAC Address. This address is used for any MAC procedures required by the particular MAC. .... It's true that the bridge does not need a MAC to _forward frames_, but unique addresses must be provided to allow some low-level protocols to function properly, for instance Full-duplex PAUSE, link aggregation control protocol and such. And I was not asking about the principles of the switch operations. I would like to undestand what a switch's device driver looks alike from the point of view of the kernel. Therefore was my analogy with computer's network card, which is a one port device (consider the simpliest case). I'm familiar with the way network drivers are implemented in Linux, but not enough to understand how the switch, being a more complex hardware, is treated by the kernel. I hope at this time I have made my question clear :-) -- Mark
From: Mark on 10 Dec 2009 00:11 "Philip Paeps" <philip+usenet(a)paeps.cx> wrote in message news:slrnhhs829.1a12.philip+usenet(a)rincewind.paeps.cx... > It depends on the hardware. Most multiport Ethernet NICs I've seen, have > a > MAC and a PHY per port. In this case, the kernel creates a network > interface > device per port (eth0, eth1, eth2, eth3). If you bridge those all > together, > the bridge will either use a randomly generated MAC address, or the > address of > the first port you add to the bridge. It looks reasonable: one MAC -> one interface exposed to the user. Should the same apply to VLANs, i.e. should every distinct VLAN be represented with a single interface? -- Mark
From: Mark on 10 Dec 2009 00:30
"David Schwartz" <davids(a)webmaster.com> wrote in message news:eb82b8d3-9b43-4c31-a38c-84e1cf2b160d(a)z3g2000prd.googlegroups.com... On Dec 8, 4:21 pm, "Mark" <mark_cruzNOTFORS...(a)hotmail.com> wrote: > Typically, hardware switches present to Linux as two bits: > 1) They present a network interface that connects to a virtual port on > the switch. > 2) They present the switch itself, with the ability to configure > whatever configurable parameters each port has. Ok, let's consider a simple example - 4-port switch with a MAC per each port. One port will connect a control CPU running all the software, 3 ports remain for LAN. Consider that the switch is memory mapped, so we might want to: 1) grab the memory region with request_mem_region() 2) fill in the fields of 'net_device' instance, including open/close interface hooks, interrupt handler 3) register IRQ handlers with request_irq() etc. Somewhere deep in the kernel this new network device will be registered. So will it be done for every port, and upon calling 'ifconfig -a' we will have 3(4?) interfaces listed ? -- Mark |