Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * i2o_lan.h I2O LAN Class definitions |
| 3 | * |
| 4 | * I2O LAN CLASS OSM May 26th 2000 |
| 5 | * |
| 6 | * (C) Copyright 1999, 2000 University of Helsinki, |
| 7 | * Department of Computer Science |
| 8 | * |
| 9 | * This code is still under development / test. |
| 10 | * |
| 11 | * Author: Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> |
| 12 | * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI> |
| 13 | * Taneli Vähäkangas <Taneli.Vahakangas@cs.Helsinki.FI> |
| 14 | */ |
| 15 | |
| 16 | #ifndef _I2O_LAN_H |
| 17 | #define _I2O_LAN_H |
| 18 | |
| 19 | /* Default values for tunable parameters first */ |
| 20 | |
| 21 | #define I2O_LAN_MAX_BUCKETS_OUT 96 |
| 22 | #define I2O_LAN_BUCKET_THRESH 18 /* 9 buckets in one message */ |
| 23 | #define I2O_LAN_RX_COPYBREAK 200 |
| 24 | #define I2O_LAN_TX_TIMEOUT (1*HZ) |
| 25 | #define I2O_LAN_TX_BATCH_MODE 2 /* 2=automatic, 1=on, 0=off */ |
| 26 | #define I2O_LAN_EVENT_MASK 0 /* 0=None, 0xFFC00002=All */ |
| 27 | |
| 28 | /* LAN types */ |
| 29 | #define I2O_LAN_ETHERNET 0x0030 |
| 30 | #define I2O_LAN_100VG 0x0040 |
| 31 | #define I2O_LAN_TR 0x0050 |
| 32 | #define I2O_LAN_FDDI 0x0060 |
| 33 | #define I2O_LAN_FIBRE_CHANNEL 0x0070 |
| 34 | #define I2O_LAN_UNKNOWN 0x00000000 |
| 35 | |
| 36 | /* Connector types */ |
| 37 | |
| 38 | /* Ethernet */ |
| 39 | #define I2O_LAN_AUI (I2O_LAN_ETHERNET << 4) + 0x00000001 |
| 40 | #define I2O_LAN_10BASE5 (I2O_LAN_ETHERNET << 4) + 0x00000002 |
| 41 | #define I2O_LAN_FIORL (I2O_LAN_ETHERNET << 4) + 0x00000003 |
| 42 | #define I2O_LAN_10BASE2 (I2O_LAN_ETHERNET << 4) + 0x00000004 |
| 43 | #define I2O_LAN_10BROAD36 (I2O_LAN_ETHERNET << 4) + 0x00000005 |
| 44 | #define I2O_LAN_10BASE_T (I2O_LAN_ETHERNET << 4) + 0x00000006 |
| 45 | #define I2O_LAN_10BASE_FP (I2O_LAN_ETHERNET << 4) + 0x00000007 |
| 46 | #define I2O_LAN_10BASE_FB (I2O_LAN_ETHERNET << 4) + 0x00000008 |
| 47 | #define I2O_LAN_10BASE_FL (I2O_LAN_ETHERNET << 4) + 0x00000009 |
| 48 | #define I2O_LAN_100BASE_TX (I2O_LAN_ETHERNET << 4) + 0x0000000A |
| 49 | #define I2O_LAN_100BASE_FX (I2O_LAN_ETHERNET << 4) + 0x0000000B |
| 50 | #define I2O_LAN_100BASE_T4 (I2O_LAN_ETHERNET << 4) + 0x0000000C |
| 51 | #define I2O_LAN_1000BASE_SX (I2O_LAN_ETHERNET << 4) + 0x0000000D |
| 52 | #define I2O_LAN_1000BASE_LX (I2O_LAN_ETHERNET << 4) + 0x0000000E |
| 53 | #define I2O_LAN_1000BASE_CX (I2O_LAN_ETHERNET << 4) + 0x0000000F |
| 54 | #define I2O_LAN_1000BASE_T (I2O_LAN_ETHERNET << 4) + 0x00000010 |
| 55 | |
| 56 | /* AnyLAN */ |
| 57 | #define I2O_LAN_100VG_ETHERNET (I2O_LAN_100VG << 4) + 0x00000001 |
| 58 | #define I2O_LAN_100VG_TR (I2O_LAN_100VG << 4) + 0x00000002 |
| 59 | |
| 60 | /* Token Ring */ |
| 61 | #define I2O_LAN_4MBIT (I2O_LAN_TR << 4) + 0x00000001 |
| 62 | #define I2O_LAN_16MBIT (I2O_LAN_TR << 4) + 0x00000002 |
| 63 | |
| 64 | /* FDDI */ |
| 65 | #define I2O_LAN_125MBAUD (I2O_LAN_FDDI << 4) + 0x00000001 |
| 66 | |
| 67 | /* Fibre Channel */ |
| 68 | #define I2O_LAN_POINT_POINT (I2O_LAN_FIBRE_CHANNEL << 4) + 0x00000001 |
| 69 | #define I2O_LAN_ARB_LOOP (I2O_LAN_FIBRE_CHANNEL << 4) + 0x00000002 |
| 70 | #define I2O_LAN_PUBLIC_LOOP (I2O_LAN_FIBRE_CHANNEL << 4) + 0x00000003 |
| 71 | #define I2O_LAN_FABRIC (I2O_LAN_FIBRE_CHANNEL << 4) + 0x00000004 |
| 72 | |
| 73 | #define I2O_LAN_EMULATION 0x00000F00 |
| 74 | #define I2O_LAN_OTHER 0x00000F01 |
| 75 | #define I2O_LAN_DEFAULT 0xFFFFFFFF |
| 76 | |
| 77 | /* LAN class functions */ |
| 78 | |
| 79 | #define LAN_PACKET_SEND 0x3B |
| 80 | #define LAN_SDU_SEND 0x3D |
| 81 | #define LAN_RECEIVE_POST 0x3E |
| 82 | #define LAN_RESET 0x35 |
| 83 | #define LAN_SUSPEND 0x37 |
| 84 | |
| 85 | /* LAN DetailedStatusCode defines */ |
| 86 | #define I2O_LAN_DSC_SUCCESS 0x00 |
| 87 | #define I2O_LAN_DSC_DEVICE_FAILURE 0x01 |
| 88 | #define I2O_LAN_DSC_DESTINATION_NOT_FOUND 0x02 |
| 89 | #define I2O_LAN_DSC_TRANSMIT_ERROR 0x03 |
| 90 | #define I2O_LAN_DSC_TRANSMIT_ABORTED 0x04 |
| 91 | #define I2O_LAN_DSC_RECEIVE_ERROR 0x05 |
| 92 | #define I2O_LAN_DSC_RECEIVE_ABORTED 0x06 |
| 93 | #define I2O_LAN_DSC_DMA_ERROR 0x07 |
| 94 | #define I2O_LAN_DSC_BAD_PACKET_DETECTED 0x08 |
| 95 | #define I2O_LAN_DSC_OUT_OF_MEMORY 0x09 |
| 96 | #define I2O_LAN_DSC_BUCKET_OVERRUN 0x0A |
| 97 | #define I2O_LAN_DSC_IOP_INTERNAL_ERROR 0x0B |
| 98 | #define I2O_LAN_DSC_CANCELED 0x0C |
| 99 | #define I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT 0x0D |
| 100 | #define I2O_LAN_DSC_DEST_ADDRESS_DETECTED 0x0E |
| 101 | #define I2O_LAN_DSC_DEST_ADDRESS_OMITTED 0x0F |
| 102 | #define I2O_LAN_DSC_PARTIAL_PACKET_RETURNED 0x10 |
| 103 | #define I2O_LAN_DSC_SUSPENDED 0x11 |
| 104 | |
| 105 | struct i2o_packet_info { |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 106 | u32 offset:24; |
| 107 | u32 flags:8; |
| 108 | u32 len:24; |
| 109 | u32 status:8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | struct i2o_bucket_descriptor { |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 113 | u32 context; /* FIXME: 64bit support */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | struct i2o_packet_info packet_info[1]; |
| 115 | }; |
| 116 | |
| 117 | /* Event Indicator Mask Flags for LAN OSM */ |
| 118 | |
| 119 | #define I2O_LAN_EVT_LINK_DOWN 0x01 |
| 120 | #define I2O_LAN_EVT_LINK_UP 0x02 |
| 121 | #define I2O_LAN_EVT_MEDIA_CHANGE 0x04 |
| 122 | |
| 123 | #include <linux/netdevice.h> |
| 124 | #include <linux/fddidevice.h> |
| 125 | |
| 126 | struct i2o_lan_local { |
| 127 | u8 unit; |
| 128 | struct i2o_device *i2o_dev; |
| 129 | |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 130 | struct fddi_statistics stats; /* see also struct net_device_stats */ |
| 131 | unsigned short (*type_trans) (struct sk_buff *, struct net_device *); |
| 132 | atomic_t buckets_out; /* nbr of unused buckets on DDM */ |
| 133 | atomic_t tx_out; /* outstanding TXes */ |
| 134 | u8 tx_count; /* packets in one TX message frame */ |
| 135 | u16 tx_max_out; /* DDM's Tx queue len */ |
| 136 | u8 sgl_max; /* max SGLs in one message frame */ |
| 137 | u32 m; /* IOP address of the batch msg frame */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | |
| 139 | struct work_struct i2o_batch_send_task; |
| 140 | int send_active; |
| 141 | struct sk_buff **i2o_fbl; /* Free bucket list (to reuse skbs) */ |
| 142 | int i2o_fbl_tail; |
| 143 | spinlock_t fbl_lock; |
| 144 | |
| 145 | spinlock_t tx_lock; |
| 146 | |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 147 | u32 max_size_mc_table; /* max number of multicast addresses */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | |
| 149 | /* LAN OSM configurable parameters are here: */ |
| 150 | |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 151 | u16 max_buckets_out; /* max nbr of buckets to send to DDM */ |
| 152 | u16 bucket_thresh; /* send more when this many used */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | u16 rx_copybreak; |
| 154 | |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 155 | u8 tx_batch_mode; /* Set when using batch mode sends */ |
| 156 | u32 i2o_event_mask; /* To turn on interesting event flags */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | }; |
| 158 | |
Markus Lidel | 524e3b6 | 2006-01-06 00:19:34 -0800 | [diff] [blame] | 159 | #endif /* _I2O_LAN_H */ |