]> err.no Git - linux-2.6/commitdiff
typhoon: trivial endianness annotations
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 23 Aug 2007 04:44:39 +0000 (00:44 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:52:00 +0000 (16:52 -0700)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/typhoon.c
drivers/net/typhoon.h

index 43894e95fcb3c24fc4d0b8c9061d0fc15986ab01..72e5e9be7e995ec51c0bb779ee1699d509e09621 100644 (file)
@@ -300,9 +300,9 @@ struct typhoon {
        const char *            name;
        struct typhoon_shared * shared;
        dma_addr_t              shared_dma;
-       u16                     xcvr_select;
-       u16                     wol_events;
-       u32                     offload;
+       __le16                  xcvr_select;
+       __le16                  wol_events;
+       __le32                  offload;
 
        /* unused stuff (future use) */
        int                     capabilities;
@@ -828,7 +828,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                first_txd->processFlags |=
                    TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY;
                first_txd->processFlags |=
-                   cpu_to_le32(htons(vlan_tx_tag_get(skb)) <<
+                   cpu_to_le32(ntohs(vlan_tx_tag_get(skb)) <<
                                TYPHOON_TX_PF_VLAN_TAG_SHIFT);
        }
 
@@ -920,7 +920,7 @@ typhoon_set_rx_mode(struct net_device *dev)
        struct typhoon *tp = netdev_priv(dev);
        struct cmd_desc xp_cmd;
        u32 mc_filter[2];
-       u16 filter;
+       __le16 filter;
 
        filter = TYPHOON_RX_FILTER_DIRECTED | TYPHOON_RX_FILTER_BROADCAST;
        if(dev->flags & IFF_PROMISC) {
@@ -1131,7 +1131,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct typhoon *tp = netdev_priv(dev);
        struct cmd_desc xp_cmd;
-       int xcvr;
+       __le16 xcvr;
        int err;
 
        err = -EINVAL;
@@ -1536,7 +1536,7 @@ out_timeout:
 
 static u32
 typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
-                       volatile u32 * index)
+                       volatile __le32 * index)
 {
        u32 lastRead = txRing->lastRead;
        struct tx_desc *tx;
@@ -1572,7 +1572,7 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
 
 static void
 typhoon_tx_complete(struct typhoon *tp, struct transmit_ring *txRing,
-                       volatile u32 * index)
+                       volatile __le32 * index)
 {
        u32 lastRead;
        int numDesc = MAX_SKB_FRAGS + 1;
@@ -1662,8 +1662,8 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
 }
 
 static int
-typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile u32 * ready,
-          volatile u32 * cleared, int budget)
+typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * ready,
+          volatile __le32 * cleared, int budget)
 {
        struct rx_desc *rx;
        struct sk_buff *skb, *new_skb;
@@ -1673,7 +1673,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile u32 * ready,
        u32 rxaddr;
        int pkt_len;
        u32 idx;
-       u32 csum_bits;
+       __le32 csum_bits;
        int received;
 
        received = 0;
@@ -1840,7 +1840,7 @@ typhoon_free_rx_rings(struct typhoon *tp)
 }
 
 static int
-typhoon_sleep(struct typhoon *tp, pci_power_t state, u16 events)
+typhoon_sleep(struct typhoon *tp, pci_power_t state, __le16 events)
 {
        struct pci_dev *pdev = tp->pdev;
        void __iomem *ioaddr = tp->ioaddr;
@@ -1928,8 +1928,8 @@ typhoon_start_runtime(struct typhoon *tp)
                goto error_out;
 
        INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_SET_MAC_ADDRESS);
-       xp_cmd.parm1 = cpu_to_le16(ntohs(*(u16 *)&dev->dev_addr[0]));
-       xp_cmd.parm2 = cpu_to_le32(ntohl(*(u32 *)&dev->dev_addr[2]));
+       xp_cmd.parm1 = cpu_to_le16(ntohs(*(__be16 *)&dev->dev_addr[0]));
+       xp_cmd.parm2 = cpu_to_le32(ntohl(*(__be32 *)&dev->dev_addr[2]));
        err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
        if(err < 0)
                goto error_out;
@@ -2229,8 +2229,8 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state)
        }
 
        INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_SET_MAC_ADDRESS);
-       xp_cmd.parm1 = cpu_to_le16(ntohs(*(u16 *)&dev->dev_addr[0]));
-       xp_cmd.parm2 = cpu_to_le32(ntohl(*(u32 *)&dev->dev_addr[2]));
+       xp_cmd.parm1 = cpu_to_le16(ntohs(*(__be16 *)&dev->dev_addr[0]));
+       xp_cmd.parm2 = cpu_to_le32(ntohl(*(__be32 *)&dev->dev_addr[2]));
        if(typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL) < 0) {
                printk(KERN_ERR "%s: unable to set mac address in suspend\n",
                                dev->name);
@@ -2465,8 +2465,8 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto error_out_reset;
        }
 
-       *(u16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
-       *(u32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
+       *(__be16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
+       *(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
 
        if(!is_valid_ether_addr(dev->dev_addr)) {
                printk(ERR_PFX "%s: Could not obtain valid ethernet address, "
index 2f14a050051ba639054cdd18f36c51c773de18bf..19df20889b820a14c6a4039928d96fa2386db44a 100644 (file)
@@ -64,19 +64,19 @@ struct transmit_ring {
  */
 struct typhoon_indexes {
        /* The first four are written by the host, and read by the NIC */
-       volatile u32 rxHiCleared;
-       volatile u32 rxLoCleared;
-       volatile u32 rxBuffReady;
-       volatile u32 respCleared;
+       volatile __le32 rxHiCleared;
+       volatile __le32 rxLoCleared;
+       volatile __le32 rxBuffReady;
+       volatile __le32 respCleared;
 
        /* The remaining are written by the NIC, and read by the host */
-       volatile u32 txLoCleared;
-       volatile u32 txHiCleared;
-       volatile u32 rxLoReady;
-       volatile u32 rxBuffCleared;
-       volatile u32 cmdCleared;
-       volatile u32 respReady;
-       volatile u32 rxHiReady;
+       volatile __le32 txLoCleared;
+       volatile __le32 txHiCleared;
+       volatile __le32 rxLoReady;
+       volatile __u32 rxBuffCleared;   /* AV: really? */
+       volatile __le32 cmdCleared;
+       volatile __le32 respReady;
+       volatile __le32 rxHiReady;
 } __attribute__ ((packed));
 
 /* The host<->Typhoon interface
@@ -100,31 +100,31 @@ struct typhoon_indexes {
  * be zero.
  */
 struct typhoon_interface {
-       u32 ringIndex;
-       u32 ringIndexHi;
-       u32 txLoAddr;
-       u32 txLoAddrHi;
-       u32 txLoSize;
-       u32 txHiAddr;
-       u32 txHiAddrHi;
-       u32 txHiSize;
-       u32 rxLoAddr;
-       u32 rxLoAddrHi;
-       u32 rxLoSize;
-       u32 rxBuffAddr;
-       u32 rxBuffAddrHi;
-       u32 rxBuffSize;
-       u32 cmdAddr;
-       u32 cmdAddrHi;
-       u32 cmdSize;
-       u32 respAddr;
-       u32 respAddrHi;
-       u32 respSize;
-       u32 zeroAddr;
-       u32 zeroAddrHi;
-       u32 rxHiAddr;
-       u32 rxHiAddrHi;
-       u32 rxHiSize;
+       __le32 ringIndex;
+       __le32 ringIndexHi;
+       __le32 txLoAddr;
+       __le32 txLoAddrHi;
+       __le32 txLoSize;
+       __le32 txHiAddr;
+       __le32 txHiAddrHi;
+       __le32 txHiSize;
+       __le32 rxLoAddr;
+       __le32 rxLoAddrHi;
+       __le32 rxLoSize;
+       __le32 rxBuffAddr;
+       __le32 rxBuffAddrHi;
+       __le32 rxBuffSize;
+       __le32 cmdAddr;
+       __le32 cmdAddrHi;
+       __le32 cmdSize;
+       __le32 respAddr;
+       __le32 respAddrHi;
+       __le32 respSize;
+       __le32 zeroAddr;
+       __le32 zeroAddrHi;
+       __le32 rxHiAddr;
+       __le32 rxHiAddrHi;
+       __le32 rxHiSize;
 } __attribute__ ((packed));
 
 /* The Typhoon transmit/fragment descriptor
@@ -165,10 +165,10 @@ struct tx_desc {
 #define TYPHOON_RX_ERROR       0x40
 #define TYPHOON_DESC_VALID     0x80
        u8  numDesc;
-       u16 len;
+       __le16 len;
        u32 addr;
        u32 addrHi;
-       u32 processFlags;
+       __le32 processFlags;
 #define TYPHOON_TX_PF_NO_CRC           __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_TX_PF_IP_CHKSUM                __constant_cpu_to_le32(0x00000002)
 #define TYPHOON_TX_PF_TCP_CHKSUM       __constant_cpu_to_le32(0x00000004)
@@ -197,12 +197,12 @@ struct tx_desc {
 struct tcpopt_desc {
        u8  flags;
        u8  numDesc;
-       u16 mss_flags;
+       __le16 mss_flags;
 #define TYPHOON_TSO_FIRST              __constant_cpu_to_le16(0x1000)
 #define TYPHOON_TSO_LAST               __constant_cpu_to_le16(0x2000)
-       u32 respAddrLo;
-       u32 bytesTx;
-       u32 status;
+       __le32 respAddrLo;
+       __le32 bytesTx;
+       __le32 status;
 } __attribute__ ((packed));
 
 /* The IPSEC Offload descriptor
@@ -216,12 +216,12 @@ struct tcpopt_desc {
 struct ipsec_desc {
        u8  flags;
        u8  numDesc;
-       u16 ipsecFlags;
+       __le16 ipsecFlags;
 #define TYPHOON_IPSEC_GEN_IV   __constant_cpu_to_le16(0x0000)
 #define TYPHOON_IPSEC_USE_IV   __constant_cpu_to_le16(0x0001)
-       u32 sa1;
-       u32 sa2;
-       u32 reserved;
+       __le32 sa1;
+       __le32 sa2;
+       __le32 reserved;
 } __attribute__ ((packed));
 
 /* The Typhoon receive descriptor (Updated by NIC)
@@ -239,10 +239,10 @@ struct ipsec_desc {
 struct rx_desc {
        u8  flags;
        u8  numDesc;
-       u16 frameLen;
+       __le16 frameLen;
        u32 addr;
        u32 addrHi;
-       u32 rxStatus;
+       __le32 rxStatus;
 #define TYPHOON_RX_ERR_INTERNAL                __constant_cpu_to_le32(0x00000000)
 #define TYPHOON_RX_ERR_FIFO_UNDERRUN   __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_RX_ERR_BAD_SSD         __constant_cpu_to_le32(0x00000002)
@@ -264,10 +264,10 @@ struct rx_desc {
 #define TYPHOON_RX_IP_CHK_GOOD         __constant_cpu_to_le32(0x00000100)
 #define TYPHOON_RX_TCP_CHK_GOOD                __constant_cpu_to_le32(0x00000200)
 #define TYPHOON_RX_UDP_CHK_GOOD                __constant_cpu_to_le32(0x00000400)
-       u16 filterResults;
+       __le16 filterResults;
 #define TYPHOON_RX_FILTER_MASK         __constant_cpu_to_le16(0x7fff)
 #define TYPHOON_RX_FILTERED            __constant_cpu_to_le16(0x8000)
-       u16 ipsecResults;
+       __le16 ipsecResults;
 #define TYPHOON_RX_OUTER_AH_GOOD       __constant_cpu_to_le16(0x0001)
 #define TYPHOON_RX_OUTER_ESP_GOOD      __constant_cpu_to_le16(0x0002)
 #define TYPHOON_RX_INNER_AH_GOOD       __constant_cpu_to_le16(0x0004)
@@ -278,7 +278,7 @@ struct rx_desc {
 #define TYPHOON_RX_INNER_ESP_FAIL      __constant_cpu_to_le16(0x0080)
 #define TYPHOON_RX_UNKNOWN_SA          __constant_cpu_to_le16(0x0100)
 #define TYPHOON_RX_ESP_FORMAT_ERR      __constant_cpu_to_le16(0x0200)
-       u32 vlanTag;
+       __be32 vlanTag;
 } __attribute__ ((packed));
 
 /* The Typhoon free buffer descriptor, used to give a buffer to the NIC
@@ -292,8 +292,8 @@ struct rx_desc {
  * from the NIC
  */
 struct rx_free {
-       u32 physAddr;
-       u32 physAddrHi;
+       __le32 physAddr;
+       __le32 physAddrHi;
        u32 virtAddr;
        u32 virtAddrHi;
 } __attribute__ ((packed));
@@ -312,7 +312,7 @@ struct rx_free {
 struct cmd_desc {
        u8  flags;
        u8  numDesc;
-       u16 cmd;
+       __le16 cmd;
 #define TYPHOON_CMD_TX_ENABLE          __constant_cpu_to_le16(0x0001)
 #define TYPHOON_CMD_TX_DISABLE         __constant_cpu_to_le16(0x0002)
 #define TYPHOON_CMD_RX_ENABLE          __constant_cpu_to_le16(0x0003)
@@ -339,9 +339,9 @@ struct cmd_desc {
 #define TYPHOON_CMD_GET_IPSEC_ENABLE   __constant_cpu_to_le16(0x0067)
 #define TYPHOON_CMD_GET_CMD_LVL                __constant_cpu_to_le16(0x0069)
        u16 seqNo;
-       u16 parm1;
-       u32 parm2;
-       u32 parm3;
+       __le16 parm1;
+       __le32 parm2;
+       __le32 parm3;
 } __attribute__ ((packed));
 
 /* The Typhoon response descriptor, see command descriptor for details
@@ -349,11 +349,11 @@ struct cmd_desc {
 struct resp_desc {
        u8  flags;
        u8  numDesc;
-       u16 cmd;
-       u16 seqNo;
-       u16 parm1;
-       u32 parm2;
-       u32 parm3;
+       __le16 cmd;
+       __le16 seqNo;
+       __le16 parm1;
+       __le32 parm2;
+       __le32 parm3;
 } __attribute__ ((packed));
 
 #define INIT_COMMAND_NO_RESPONSE(x, command)                           \
@@ -386,31 +386,31 @@ struct resp_desc {
 struct stats_resp {
        u8  flags;
        u8  numDesc;
-       u16 cmd;
-       u16 seqNo;
-       u16 unused;
-       u32 txPackets;
-       u64 txBytes;
-       u32 txDeferred;
-       u32 txLateCollisions;
-       u32 txCollisions;
-       u32 txCarrierLost;
-       u32 txMultipleCollisions;
-       u32 txExcessiveCollisions;
-       u32 txFifoUnderruns;
-       u32 txMulticastTxOverflows;
-       u32 txFiltered;
-       u32 rxPacketsGood;
-       u64 rxBytesGood;
-       u32 rxFifoOverruns;
-       u32 BadSSD;
-       u32 rxCrcErrors;
-       u32 rxOversized;
-       u32 rxBroadcast;
-       u32 rxMulticast;
-       u32 rxOverflow;
-       u32 rxFiltered;
-       u32 linkStatus;
+       __le16 cmd;
+       __le16 seqNo;
+       __le16 unused;
+       __le32 txPackets;
+       __le64 txBytes;
+       __le32 txDeferred;
+       __le32 txLateCollisions;
+       __le32 txCollisions;
+       __le32 txCarrierLost;
+       __le32 txMultipleCollisions;
+       __le32 txExcessiveCollisions;
+       __le32 txFifoUnderruns;
+       __le32 txMulticastTxOverflows;
+       __le32 txFiltered;
+       __le32 rxPacketsGood;
+       __le64 rxBytesGood;
+       __le32 rxFifoOverruns;
+       __le32 BadSSD;
+       __le32 rxCrcErrors;
+       __le32 rxOversized;
+       __le32 rxBroadcast;
+       __le32 rxMulticast;
+       __le32 rxOverflow;
+       __le32 rxFiltered;
+       __le32 linkStatus;
 #define TYPHOON_LINK_STAT_MASK         __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_LINK_GOOD              __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_LINK_BAD               __constant_cpu_to_le32(0x00000000)
@@ -420,8 +420,8 @@ struct stats_resp {
 #define TYPHOON_LINK_DUPLEX_MASK       __constant_cpu_to_le32(0x00000004)
 #define TYPHOON_LINK_FULL_DUPLEX       __constant_cpu_to_le32(0x00000004)
 #define TYPHOON_LINK_HALF_DUPLEX       __constant_cpu_to_le32(0x00000000)
-       u32 unused2;
-       u32 unused3;
+       __le32 unused2;
+       __le32 unused3;
 } __attribute__ ((packed));
 
 /* TYPHOON_CMD_XCVR_SELECT xcvr values (resp.parm1)
@@ -509,17 +509,17 @@ struct sa_descriptor {
  */
 struct typhoon_file_header {
        u8  tag[8];
-       u32 version;
-       u32 numSections;
-       u32 startAddr;
-       u32 hmacDigest[5];
+       __le32 version;
+       __le32 numSections;
+       __le32 startAddr;
+       __le32 hmacDigest[5];
 } __attribute__ ((packed));
 
 struct typhoon_section_header {
-       u32 len;
+       __le32 len;
        u16 checksum;
        u16 reserved;
-       u32 startAddr;
+       __le32 startAddr;
 } __attribute__ ((packed));
 
 /* The Typhoon Register offsets