Skip to content

Commit 60eea6c

Browse files
author
Paul Gortmaker
committed
atm: remove the coupling to token ring support
The token ring support is going away, so decouple the atm support from it in advance. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
1 parent 1abd229 commit 60eea6c

File tree

3 files changed

+8
-138
lines changed

3 files changed

+8
-138
lines changed

include/linux/atmlec.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
/* Maximum number of LEC interfaces (tweakable) */
2222
#define MAX_LEC_ITF 48
2323

24-
/*
25-
* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
26-
* E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
27-
* Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
28-
*/
29-
#define NUM_TR_DEVS 8
30-
3124
typedef enum {
3225
l_set_mac_addr,
3326
l_del_mac_addr,

net/atm/lec.c

Lines changed: 8 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
#include <linux/spinlock.h>
2727
#include <linux/seq_file.h>
2828

29-
/* TokenRing if needed */
30-
#ifdef CONFIG_TR
31-
#include <linux/trdevice.h>
32-
#endif
33-
3429
/* And atm device */
3530
#include <linux/atmdev.h>
3631
#include <linux/atmlec.h>
@@ -162,50 +157,6 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
162157
}
163158
#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
164159

165-
/*
166-
* Modelled after tr_type_trans
167-
* All multicast and ARE or STE frames go to BUS.
168-
* Non source routed frames go by destination address.
169-
* Last hop source routed frames go by destination address.
170-
* Not last hop source routed frames go by _next_ route descriptor.
171-
* Returns pointer to destination MAC address or fills in rdesc
172-
* and returns NULL.
173-
*/
174-
#ifdef CONFIG_TR
175-
static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
176-
{
177-
struct trh_hdr *trh;
178-
unsigned int riflen, num_rdsc;
179-
180-
trh = (struct trh_hdr *)packet;
181-
if (trh->daddr[0] & (uint8_t) 0x80)
182-
return bus_mac; /* multicast */
183-
184-
if (trh->saddr[0] & TR_RII) {
185-
riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
186-
if ((ntohs(trh->rcf) >> 13) != 0)
187-
return bus_mac; /* ARE or STE */
188-
} else
189-
return trh->daddr; /* not source routed */
190-
191-
if (riflen < 6)
192-
return trh->daddr; /* last hop, source routed */
193-
194-
/* riflen is 6 or more, packet has more than one route descriptor */
195-
num_rdsc = (riflen / 2) - 1;
196-
memset(rdesc, 0, ETH_ALEN);
197-
/* offset 4 comes from LAN destination field in LE control frames */
198-
if (trh->rcf & htons((uint16_t) TR_RCF_DIR_BIT))
199-
memcpy(&rdesc[4], &trh->rseg[num_rdsc - 2], sizeof(__be16));
200-
else {
201-
memcpy(&rdesc[4], &trh->rseg[1], sizeof(__be16));
202-
rdesc[5] = ((ntohs(trh->rseg[0]) & 0x000f) | (rdesc[5] & 0xf0));
203-
}
204-
205-
return NULL;
206-
}
207-
#endif /* CONFIG_TR */
208-
209160
/*
210161
* Open/initialize the netdevice. This is called (in the current kernel)
211162
* sometime after booting when the 'ifconfig' program is run.
@@ -257,9 +208,6 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
257208
struct lec_arp_table *entry;
258209
unsigned char *dst;
259210
int min_frame_size;
260-
#ifdef CONFIG_TR
261-
unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */
262-
#endif
263211
int is_rdesc;
264212

265213
pr_debug("called\n");
@@ -290,24 +238,10 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
290238
}
291239
skb_push(skb, 2);
292240

293-
/* Put le header to place, works for TokenRing too */
241+
/* Put le header to place */
294242
lec_h = (struct lecdatahdr_8023 *)skb->data;
295243
lec_h->le_header = htons(priv->lecid);
296244

297-
#ifdef CONFIG_TR
298-
/*
299-
* Ugly. Use this to realign Token Ring packets for
300-
* e.g. PCA-200E driver.
301-
*/
302-
if (priv->is_trdev) {
303-
skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN);
304-
kfree_skb(skb);
305-
if (skb2 == NULL)
306-
return NETDEV_TX_OK;
307-
skb = skb2;
308-
}
309-
#endif
310-
311245
#if DUMP_PACKETS >= 2
312246
#define MAX_DUMP_SKB 99
313247
#elif DUMP_PACKETS >= 1
@@ -321,12 +255,7 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
321255
#endif /* DUMP_PACKETS >= 1 */
322256

323257
/* Minimum ethernet-frame size */
324-
#ifdef CONFIG_TR
325-
if (priv->is_trdev)
326-
min_frame_size = LEC_MINIMUM_8025_SIZE;
327-
else
328-
#endif
329-
min_frame_size = LEC_MINIMUM_8023_SIZE;
258+
min_frame_size = LEC_MINIMUM_8023_SIZE;
330259
if (skb->len < min_frame_size) {
331260
if ((skb->len + skb_tailroom(skb)) < min_frame_size) {
332261
skb2 = skb_copy_expand(skb, 0,
@@ -345,15 +274,6 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
345274
/* Send to right vcc */
346275
is_rdesc = 0;
347276
dst = lec_h->h_dest;
348-
#ifdef CONFIG_TR
349-
if (priv->is_trdev) {
350-
dst = get_tr_dst(skb->data + 2, rdesc);
351-
if (dst == NULL) {
352-
dst = rdesc;
353-
is_rdesc = 1;
354-
}
355-
}
356-
#endif
357277
entry = NULL;
358278
vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
359279
pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n",
@@ -710,29 +630,15 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
710630
dev_kfree_skb(skb);
711631
return;
712632
}
713-
#ifdef CONFIG_TR
714-
if (priv->is_trdev)
715-
dst = ((struct lecdatahdr_8025 *)skb->data)->h_dest;
716-
else
717-
#endif
718-
dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest;
633+
dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest;
719634

720635
/*
721636
* If this is a Data Direct VCC, and the VCC does not match
722637
* the LE_ARP cache entry, delete the LE_ARP cache entry.
723638
*/
724639
spin_lock_irqsave(&priv->lec_arp_lock, flags);
725640
if (lec_is_data_direct(vcc)) {
726-
#ifdef CONFIG_TR
727-
if (priv->is_trdev)
728-
src =
729-
((struct lecdatahdr_8025 *)skb->data)->
730-
h_source;
731-
else
732-
#endif
733-
src =
734-
((struct lecdatahdr_8023 *)skb->data)->
735-
h_source;
641+
src = ((struct lecdatahdr_8023 *)skb->data)->h_source;
736642
entry = lec_arp_find(priv, src);
737643
if (entry && entry->vcc != vcc) {
738644
lec_arp_remove(priv, entry);
@@ -750,12 +656,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
750656
if (!hlist_empty(&priv->lec_arp_empty_ones))
751657
lec_arp_check_empties(priv, vcc, skb);
752658
skb_pull(skb, 2); /* skip lec_id */
753-
#ifdef CONFIG_TR
754-
if (priv->is_trdev)
755-
skb->protocol = tr_type_trans(skb, dev);
756-
else
757-
#endif
758-
skb->protocol = eth_type_trans(skb, dev);
659+
skb->protocol = eth_type_trans(skb, dev);
759660
dev->stats.rx_packets++;
760661
dev->stats.rx_bytes += skb->len;
761662
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
@@ -827,27 +728,13 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
827728
i = 0;
828729
else
829730
i = arg;
830-
#ifdef CONFIG_TR
831731
if (arg >= MAX_LEC_ITF)
832732
return -EINVAL;
833-
#else /* Reserve the top NUM_TR_DEVS for TR */
834-
if (arg >= (MAX_LEC_ITF - NUM_TR_DEVS))
835-
return -EINVAL;
836-
#endif
837733
if (!dev_lec[i]) {
838-
int is_trdev, size;
839-
840-
is_trdev = 0;
841-
if (i >= (MAX_LEC_ITF - NUM_TR_DEVS))
842-
is_trdev = 1;
734+
int size;
843735

844736
size = sizeof(struct lec_priv);
845-
#ifdef CONFIG_TR
846-
if (is_trdev)
847-
dev_lec[i] = alloc_trdev(size);
848-
else
849-
#endif
850-
dev_lec[i] = alloc_etherdev(size);
737+
dev_lec[i] = alloc_etherdev(size);
851738
if (!dev_lec[i])
852739
return -ENOMEM;
853740
dev_lec[i]->netdev_ops = &lec_netdev_ops;
@@ -858,7 +745,6 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
858745
}
859746

860747
priv = netdev_priv(dev_lec[i]);
861-
priv->is_trdev = is_trdev;
862748
} else {
863749
priv = netdev_priv(dev_lec[i]);
864750
if (priv->lecd)
@@ -2372,15 +2258,7 @@ lec_arp_check_empties(struct lec_priv *priv,
23722258
struct hlist_node *node, *next;
23732259
struct lec_arp_table *entry, *tmp;
23742260
struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data;
2375-
unsigned char *src;
2376-
#ifdef CONFIG_TR
2377-
struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data;
2378-
2379-
if (priv->is_trdev)
2380-
src = tr_hdr->h_source;
2381-
else
2382-
#endif
2383-
src = hdr->h_source;
2261+
unsigned char *src = hdr->h_source;
23842262

23852263
spin_lock_irqsave(&priv->lec_arp_lock, flags);
23862264
hlist_for_each_entry_safe(entry, node, next,

net/atm/lec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ struct lec_priv {
142142
int itfnum; /* e.g. 2 for lec2, 5 for lec5 */
143143
struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */
144144
int is_proxy; /* bridge between ATM and Ethernet */
145-
int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */
146145
};
147146

148147
struct lec_vcc_priv {

0 commit comments

Comments
 (0)