Skip to contentSkip to conversation

FDDI: Reformat <linux/if_fddi.h> for 8-character tabs

PATCH Superseded Maciej W. Rozycki 3 participants 6 messages Apr 8, 2014 – Apr 11, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 FDDI: Reformat <linux/if_fddi.h> for 8-character tabs

Some of our FDDI support code has been apparently written with an assumption that tabs are 4-character wide. In preparation to the next change this update reformats <linux/if_fddi.h> so that it stays within 79 columns and otherwise renders correctly with 8-character tabs. No functional change.

---
Dave,

Please apply or otherwise let me know if you have issues with this
change.

Thanks,

Maciej

linux-if_fddi-format.patch

include/uapi/linux/if_fddi.h +46 -44
Index: linux/include/uapi/linux/if_fddi.h
===================================================================
@@ -30,74 +30,76 @@
  *  Define max and min legal sizes.  The frame sizes do not include
  *  4 byte FCS/CRC (frame check sequence).
  */
-#define FDDI_K_ALEN			6		/* Octets in one FDDI address */
-#define FDDI_K_8022_HLEN	16		/* Total octets in 802.2 header */
-#define FDDI_K_SNAP_HLEN	21		/* Total octets in 802.2 SNAP header */
-#define FDDI_K_8022_ZLEN	16		/* Min octets in 802.2 frame sans FCS */
-#define FDDI_K_SNAP_ZLEN	21		/* Min octets in 802.2 SNAP frame sans FCS */
+#define FDDI_K_ALEN		6	/* Octets in one FDDI address */
+#define FDDI_K_8022_HLEN	16	/* Total octets in 802.2 header */
+#define FDDI_K_SNAP_HLEN	21	/* Total octets in 802.2 SNAP header */
+#define FDDI_K_8022_ZLEN	16	/* Min octets in 802.2 frame sans
+					   FCS */
+#define FDDI_K_SNAP_ZLEN	21	/* Min octets in 802.2 SNAP frame sans
+					   FCS */
 #define FDDI_K_8022_DLEN	4475	/* Max octets in 802.2 payload */
 #define FDDI_K_SNAP_DLEN	4470	/* Max octets in 802.2 SNAP payload */
-#define FDDI_K_LLC_ZLEN		13		/* Min octets in LLC frame sans FCS */
+#define FDDI_K_LLC_ZLEN		13	/* Min octets in LLC frame sans FCS */
 #define FDDI_K_LLC_LEN		4491	/* Max octets in LLC frame sans FCS */
+#define FDDI_K_OUI_LEN		3	/* Octets in OUI in 802.2 SNAP
+					   header */
 
 /* Define FDDI Frame Control (FC) Byte values */
-#define FDDI_FC_K_VOID					0x00	
-#define FDDI_FC_K_NON_RESTRICTED_TOKEN	0x80	
-#define FDDI_FC_K_RESTRICTED_TOKEN		0xC0	
-#define FDDI_FC_K_SMT_MIN				0x41
-#define FDDI_FC_K_SMT_MAX		   		0x4F
-#define FDDI_FC_K_MAC_MIN				0xC1
-#define FDDI_FC_K_MAC_MAX		  		0xCF	
-#define FDDI_FC_K_ASYNC_LLC_MIN			0x50
-#define FDDI_FC_K_ASYNC_LLC_DEF			0x54
-#define FDDI_FC_K_ASYNC_LLC_MAX			0x5F
-#define FDDI_FC_K_SYNC_LLC_MIN			0xD0
-#define FDDI_FC_K_SYNC_LLC_MAX			0xD7
-#define FDDI_FC_K_IMPLEMENTOR_MIN		0x60
-#define FDDI_FC_K_IMPLEMENTOR_MAX  		0x6F
-#define FDDI_FC_K_RESERVED_MIN			0x70
-#define FDDI_FC_K_RESERVED_MAX			0x7F
+#define FDDI_FC_K_VOID			0x00
+#define FDDI_FC_K_NON_RESTRICTED_TOKEN	0x80
+#define FDDI_FC_K_RESTRICTED_TOKEN	0xC0
+#define FDDI_FC_K_SMT_MIN		0x41
+#define FDDI_FC_K_SMT_MAX		0x4F
+#define FDDI_FC_K_MAC_MIN		0xC1
+#define FDDI_FC_K_MAC_MAX		0xCF
+#define FDDI_FC_K_ASYNC_LLC_MIN		0x50
+#define FDDI_FC_K_ASYNC_LLC_DEF		0x54
+#define FDDI_FC_K_ASYNC_LLC_MAX		0x5F
+#define FDDI_FC_K_SYNC_LLC_MIN		0xD0
+#define FDDI_FC_K_SYNC_LLC_MAX		0xD7
+#define FDDI_FC_K_IMPLEMENTOR_MIN	0x60
+#define FDDI_FC_K_IMPLEMENTOR_MAX	0x6F
+#define FDDI_FC_K_RESERVED_MIN		0x70
+#define FDDI_FC_K_RESERVED_MAX		0x7F
 
 /* Define LLC and SNAP constants */
-#define FDDI_EXTENDED_SAP	0xAA
+#define FDDI_EXTENDED_SAP		0xAA
 #define FDDI_UI_CMD			0x03
 
 /* Define 802.2 Type 1 header */
 struct fddi_8022_1_hdr {
-	__u8	dsap;					/* destination service access point */
-	__u8	ssap;					/* source service access point */
-	__u8	ctrl;					/* control byte #1 */
+	__u8	dsap;			/* destination service access point */
+	__u8	ssap;			/* source service access point */
+	__u8	ctrl;			/* control byte #1 */
 } __attribute__((packed));
 
 /* Define 802.2 Type 2 header */
 struct fddi_8022_2_hdr {
-	__u8	dsap;					/* destination service access point */
-	__u8	ssap;					/* source service access point */
-	__u8	ctrl_1;					/* control byte #1 */
-	__u8	ctrl_2;					/* control byte #2 */
+	__u8	dsap;			/* destination service access point */
+	__u8	ssap;			/* source service access point */
+	__u8	ctrl_1;			/* control byte #1 */
+	__u8	ctrl_2;			/* control byte #2 */
 } __attribute__((packed));
 
 /* Define 802.2 SNAP header */
-#define FDDI_K_OUI_LEN	3
 struct fddi_snap_hdr {
-	__u8	dsap;					/* always 0xAA */
-	__u8	ssap;					/* always 0xAA */
-	__u8	ctrl;					/* always 0x03 */
+	__u8	dsap;			/* always 0xAA */
+	__u8	ssap;			/* always 0xAA */
+	__u8	ctrl;			/* always 0x03 */
 	__u8	oui[FDDI_K_OUI_LEN];	/* organizational universal id */
-	__be16	ethertype;				/* packet type ID field */
+	__be16	ethertype;		/* packet type ID field */
 } __attribute__((packed));
 
 /* Define FDDI LLC frame header */
 struct fddihdr {
-	__u8	fc;						/* frame control */
-	__u8	daddr[FDDI_K_ALEN];		/* destination address */
-	__u8	saddr[FDDI_K_ALEN];		/* source address */
-	union
-		{
-		struct fddi_8022_1_hdr		llc_8022_1;
-		struct fddi_8022_2_hdr		llc_8022_2;
-		struct fddi_snap_hdr		llc_snap;
-		} hdr;
+	__u8	fc;			/* frame control */
+	__u8	daddr[FDDI_K_ALEN];	/* destination address */
+	__u8	saddr[FDDI_K_ALEN];	/* source address */
+	union {
+		struct fddi_8022_1_hdr	llc_8022_1;
+		struct fddi_8022_2_hdr	llc_8022_2;
+		struct fddi_snap_hdr	llc_snap;
+	} hdr;
 } __attribute__((packed));
 
 
#1 lore raw

PATCH 2/2 FDDI: DEC FDDIcontroller 700 TURBOchannel card support

This adds support for the DEC FDDIcontroller 700 (DEFZA), DEC's first-generation FDDI network interface adapter, made for TURBOchannel and based on a discrete version of what eventually became Motorola's widely used CAMEL chipset. The CAMEL chipset is present for example in the DEC FDDIcontroller TURBOchannel, EISA and PCI adapters (DEFTA/DEFEA/DEFPA) that we support with the defxx driver, however the host bus interface logic and the firmware API are different in the DEFZA and hence a separate driver is required.

There isn't much to say about the driver except that it works, but there is one peculiarity to mention. The adapter implements two Tx/Rx queue pairs. Of these one pair is used by hardware to exchange frames with the ring. The other pair is used for SMT frames only, any SMT frame received by hardware on the Rx queue must be queued back by the driver to the SMT Rx queue for the firmware to process. Likewise the SMT Tx queue presents the driver with SMT frames produced by the firmware that must be queued back to the Tx queue for hardware to put on the ring. This solution was chosen because the designers ran out of PCB space and could not squeeze in more logic to handle this SMT frame traffic without the need to involve the driver as with the later DEFTA/DEFEA/DEFPA adapters.

For this reason the driver has frames in the transmit path that it wants to present to network taps (e.g. `tcpdump') but not the normal receive queue. This in turn requires that ptype_all and dev_queue_xmit_nit symbols are exported.

Finally the driver does some Frame Control byte decoding so to avoid magic numbers some macros are added to <linux/if_fddi.h>.

---
Dave,

Please apply. I hope the way I hooked to ptype_all and
dev_queue_xmit_nit is fine; let me know if you prefer to use EXPORT_SYMBOL_GPL instead.

This driver could benefit from some improvement, in particular the
interrupt handler should be split and use a thread rather than doing all the stuff in the hardirq, but let's not make better the enemy of good. I've been sitting on this driver for too long already.

There are some warnings with this driver and checkpatch.pl; I consider
them all noise and deliberately ignored, but please let me know if you'd rather see any of them silenced.

Thanks,

Maciej

linux-defza-1.1.3.patch

Documentation/networking/00-INDEX +2 -0
Index: net-20140407-4maxp64/Documentation/networking/00-INDEX
===================================================================
@@ -58,6 +58,8 @@ de4x5.txt
 	- the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver
 decnet.txt
 	- info on using the DECnet networking layer in Linux.
+defza.txt
+	- the DEC FDDIcontroller 700 (DEFZA-xx) TURBOchannel FDDI driver
 dl2k.txt
 	- README for D-Link DL2000-based Gigabit Ethernet Adapters (dl2k.ko).
 dm9000.txt
Documentation/networking/defza.txt new file +53 -0

53 lines not on this page · raw message

MAINTAINERS +5 -0
Index: net-20140407-4maxp64/MAINTAINERS
===================================================================
@@ -2663,6 +2663,11 @@ M:	"Maciej W. Rozycki" <macro@linux-mips
 S:	Maintained
 F:	drivers/net/fddi/defxx.*
 
+DEFZA FDDI NETWORK DRIVER
+M:	"Maciej W. Rozycki" <[email protected]>
+S:	Maintained
+F:	drivers/net/fddi/defza.*
+
 DELL LAPTOP DRIVER
 M:	Matthew Garrett <[email protected]>
 L:	[email protected]
drivers/net/fddi/Kconfig +11 -0
Index: net-20140407-4maxp64/drivers/net/fddi/Kconfig
===================================================================
@@ -15,6 +15,17 @@ config FDDI
 
 if FDDI
 
+config DEFZA
+	tristate "DEC FDDIcontroller 700/700C (DEFZA-xx) support"
+	depends on FDDI && TC
+	---help---
+	  This is support for the DEC FDDIcontroller 700 (DEFZA-AA, fiber)
+	  and 700C (DEFZA-CA, copper) TURBOchannel network cards which can
+	  connect you to a local FDDI network.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called defza.  If unsure, say N.
+
 config DEFXX
 	tristate "Digital DEFTA/DEFEA/DEFPA adapter support"
 	depends on FDDI && (PCI || EISA || TC)
drivers/net/fddi/Makefile +1 -0
Index: net-20140407-4maxp64/drivers/net/fddi/Makefile
===================================================================
@@ -3,4 +3,5 @@
 #
 
 obj-$(CONFIG_DEFXX) += defxx.o
+obj-$(CONFIG_DEFZA) += defza.o
 obj-$(CONFIG_SKFP) += skfp/
drivers/net/fddi/defza.c new file +1639 -0

1,639 lines not on this page · raw message

drivers/net/fddi/defza.h new file +764 -0

764 lines not on this page · raw message

include/linux/netdevice.h +2 -0
Index: net-20140407-4maxp64/include/linux/netdevice.h
===================================================================
@@ -1887,6 +1887,7 @@ netdev_notifier_info_to_dev(const struct
 int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
 
 
+extern struct list_head			ptype_all;		/* Taps */
 extern rwlock_t				dev_base_lock;		/* Device list lock */
 
 #define for_each_netdev(net, d)		\
@@ -2631,6 +2632,7 @@ int dev_set_mac_address(struct net_devic
 int dev_change_carrier(struct net_device *, bool new_carrier);
 int dev_get_phys_port_id(struct net_device *dev,
 			 struct netdev_phys_port_id *ppid);
+void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 			struct netdev_queue *txq);
 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
include/uapi/linux/if_fddi.h +18 -3
Index: net-20140407-4maxp64/include/uapi/linux/if_fddi.h
===================================================================
@@ -5,9 +5,10 @@
  *
  *		Global definitions for the ANSI FDDI interface.
  *
- * Version:	@(#)if_fddi.h	1.0.2	Sep 29 2004
+ * Version:	@(#)if_fddi.h	1.0.3	Apr  5 2014
  *
- * Author:	Lawrence V. Stefani, <[email protected]>
+ * Author:	Lawrence V. Stefani, <[email protected]>
+ * Maintainer:	Maciej W. Rozycki, <[email protected]>
  *
  *		if_fddi.h is based on previous if_ether.h and if_tr.h work by
  *			Fred N. van Kempen, <[email protected]>
@@ -44,7 +45,21 @@
 #define FDDI_K_OUI_LEN		3	/* Octets in OUI in 802.2 SNAP
 					   header */
 
-/* Define FDDI Frame Control (FC) Byte values */
+/* Define FDDI Frame Control (FC) Byte masks */
+#define FDDI_FC_K_CLASS_MASK		0x80	/* class bit */
+#define FDDI_FC_K_CLASS_SYNC		0x80
+#define FDDI_FC_K_CLASS_ASYNC		0x00
+#define FDDI_FC_K_ALEN_MASK		0x40	/* address length bit */
+#define FDDI_FC_K_ALEN_48		0x40
+#define FDDI_FC_K_ALEN_16		0x00
+#define FDDI_FC_K_FORMAT_MASK		0x30	/* format bits */
+#define FDDI_FC_K_FORMAT_FUTURE		0x30
+#define FDDI_FC_K_FORMAT_IMPLEMENTOR	0x20
+#define FDDI_FC_K_FORMAT_LLC		0x10
+#define FDDI_FC_K_FORMAT_MANAGEMENT	0x00
+#define FDDI_FC_K_CONTROL_MASK		0x0f	/* control bits */
+
+/* Define FDDI Frame Control (FC) Byte specific values */
 #define FDDI_FC_K_VOID			0x00
 #define FDDI_FC_K_NON_RESTRICTED_TOKEN	0x80
 #define FDDI_FC_K_RESTRICTED_TOKEN	0xC0
net/core/dev.c +4 -2
Index: net-20140407-4maxp64/net/core/dev.c
===================================================================
@@ -144,7 +144,8 @@
 static DEFINE_SPINLOCK(ptype_lock);
 static DEFINE_SPINLOCK(offload_lock);
 struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
-struct list_head ptype_all __read_mostly;	/* Taps */
+struct list_head ptype_all __read_mostly;		/* Taps */
+EXPORT_SYMBOL(ptype_all);
 static struct list_head offload_base __read_mostly;
 
 static int netif_rx_internal(struct sk_buff *skb);
@@ -1730,7 +1731,7 @@ static inline bool skb_loop_sk(struct pa
  *	taps currently in use.
  */
 
-static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
+void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct packet_type *ptype;
 	struct sk_buff *skb2 = NULL;
@@ -1778,6 +1779,7 @@ static void dev_queue_xmit_nit(struct sk
 		pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
 	rcu_read_unlock();
 }
+EXPORT_SYMBOL(dev_queue_xmit_nit);
 
 /**
  * netif_setup_tc - Handle tc mappings on real_num_tx_queues change
maintainer
#2 lore raw
In reply to Maciej W. Rozycki

From: "Maciej W. Rozycki" <[email protected]>
Date: Tue, 8 Apr 2014 13:19:28 +0100 (BST)

Quoted 6 lines

Some of our FDDI support code has been apparently written with an assumption that tabs are 4-character wide. In preparation to the next change this update reformats <linux/if_fddi.h> so that it stays within 79 columns and otherwise renders correctly with 8-character tabs. No functional change.

Quoted 6 lines

---
Dave,

Please apply or otherwise let me know if you have issues with this
change.

Such cleanups are only appropriate for the net-next tree, which is not open at this time.

Please resubmit this change when the net-next tree is openned back up for submissions.

Thank you.

#3 lore raw
Quoted 5 lines · David Miller

Such cleanups are only appropriate for the net-next tree, which is not open at this time.

Please resubmit this change when the net-next tree is openned back up for submissions.

OK, where can I find the status of the tree, I wasn't able to track down
one before I posted these changes?

Maciej

#4 lore raw

From: "Maciej W. Rozycki" <[email protected]>
Date: Tue, 8 Apr 2014 18:56:51 +0100 (BST)

Quoted 10 lines · David Miller
Quoted 6 lines

Such cleanups are only appropriate for the net-next tree, which is not open at this time.

Please resubmit this change when the net-next tree is openned back up for submissions.

OK, where can I find the status of the tree, I wasn't able to track down
one before I posted these changes?

The net-next tree openning will be clearly announced on the netdev mailing list.

Every developer working on networking changes should closely follow that list.

#5 lore raw
Quoted 8 lines · David Miller
Quoted 2 lines

OK, where can I find the status of the tree, I wasn't able to track down
one before I posted these changes?

The net-next tree openning will be clearly announced on the netdev mailing list.

Every developer working on networking changes should closely follow that list.

OK, I've tracked down your announcements now so I know what to look for;
obviously I missed the acceptance window by a week, sigh...

Thanks for your guidance, have a good weekend!

Maciej