diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-12-22 18:56:23 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:10:30 -0800 |
commit | 05e5c1165393a2d6044b01288f089d2e74a49d58 (patch) | |
tree | bab583a44c814d4daf3cd2e617a1f3a52ee1c7a9 /drivers/net/cxgb3 | |
parent | ac390c60a833192e87fb09ed8d67f5d1a84306c8 (diff) | |
download | op-kernel-dev-05e5c1165393a2d6044b01288f089d2e74a49d58.zip op-kernel-dev-05e5c1165393a2d6044b01288f089d2e74a49d58.tar.gz |
annotate cxgb3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r-- | drivers/net/cxgb3/common.h | 4 | ||||
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 11 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 4 | ||||
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 31 |
4 files changed, 26 insertions, 24 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h index 99c75d30..91ee727 100644 --- a/drivers/net/cxgb3/common.h +++ b/drivers/net/cxgb3/common.h @@ -681,8 +681,8 @@ int t3_phy_intr_handler(struct adapter *adapter); void t3_link_changed(struct adapter *adapter, int port_id); int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); const struct adapter_info *t3_get_adapter_info(unsigned int board_id); -int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); -int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data); +int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data); +int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data); int t3_seeprom_wp(struct adapter *adapter, int enable); int t3_get_tp_version(struct adapter *adapter, u32 *vers); int t3_check_tpsram_version(struct adapter *adapter, int *must_load); diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 0e3dcbf..fd2e05b 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c @@ -1642,7 +1642,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e, e->magic = EEPROM_MAGIC; for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4) - err = t3_seeprom_read(adapter, i, (u32 *) & buf[i]); + err = t3_seeprom_read(adapter, i, (__le32 *) & buf[i]); if (!err) memcpy(data, buf + e->offset, e->len); @@ -1655,7 +1655,8 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; - u32 aligned_offset, aligned_len, *p; + u32 aligned_offset, aligned_len; + __le32 *p; u8 *buf; int err; @@ -1669,11 +1670,11 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, buf = kmalloc(aligned_len, GFP_KERNEL); if (!buf) return -ENOMEM; - err = t3_seeprom_read(adapter, aligned_offset, (u32 *) buf); + err = t3_seeprom_read(adapter, aligned_offset, (__le32 *) buf); if (!err && aligned_len > 4) err = t3_seeprom_read(adapter, aligned_offset + aligned_len - 4, - (u32 *) & buf[aligned_len - 4]); + (__le32 *) & buf[aligned_len - 4]); if (err) goto out; memcpy(buf + (eeprom->offset & 3), data, eeprom->len); @@ -1684,7 +1685,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, if (err) goto out; - for (p = (u32 *) buf; !err && aligned_len; aligned_len -= 4, p++) { + for (p = (__le32 *) buf; !err && aligned_len; aligned_len -= 4, p++) { err = t3_seeprom_write(adapter, aligned_offset, *p); aligned_offset += 4; } diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 6367cee..cb684d3 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c @@ -1814,7 +1814,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, skb->protocol = eth_type_trans(skb, adap->port[p->iff]); skb->dev->last_rx = jiffies; pi = netdev_priv(skb->dev); - if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && + if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0xffff) && !p->fragment) { rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1961,7 +1961,7 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs, int eth, ethpad = 2; struct sk_buff *skb = NULL; u32 len, flags = ntohl(r->flags); - u32 rss_hi = *(const u32 *)r, rss_lo = r->rss_hdr.rss_hash_val; + __be32 rss_hi = *(const __be32 *)r, rss_lo = r->rss_hdr.rss_hash_val; eth = r->rss_hdr.opcode == CPL_RX_PKT; diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 6e5b499..7469935 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c @@ -537,10 +537,11 @@ struct t3_vpd { * addres is written to the control register. The hardware device will * set the flag to 1 when 4 bytes have been read into the data register. */ -int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) +int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data) { u16 val; int attempts = EEPROM_MAX_POLL; + u32 v; unsigned int base = adapter->params.pci.vpd_cap_addr; if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr & 3)) @@ -556,8 +557,8 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) CH_ERR(adapter, "reading EEPROM address 0x%x failed\n", addr); return -EIO; } - pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, data); - *data = le32_to_cpu(*data); + pci_read_config_dword(adapter->pdev, base + PCI_VPD_DATA, &v); + *data = cpu_to_le32(v); return 0; } @@ -570,7 +571,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data) * Write a 32-bit word to a location in VPD EEPROM using the card's PCI * VPD ROM capability. */ -int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) +int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data) { u16 val; int attempts = EEPROM_MAX_POLL; @@ -580,7 +581,7 @@ int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data) return -EINVAL; pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA, - cpu_to_le32(data)); + le32_to_cpu(data)); pci_write_config_word(adapter->pdev,base + PCI_VPD_ADDR, addr | PCI_VPD_ADDR_F); do { @@ -631,14 +632,14 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) * Card information is normally at VPD_BASE but some early cards had * it at 0. */ - ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)&vpd); + ret = t3_seeprom_read(adapter, VPD_BASE, (__le32 *)&vpd); if (ret) return ret; addr = vpd.id_tag == 0x82 ? VPD_BASE : 0; for (i = 0; i < sizeof(vpd); i += 4) { ret = t3_seeprom_read(adapter, addr + i, - (u32 *)((u8 *)&vpd + i)); + (__le32 *)((u8 *)&vpd + i)); if (ret) return ret; } @@ -926,7 +927,7 @@ int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size) { u32 csum; unsigned int i; - const u32 *p = (const u32 *)tp_sram; + const __be32 *p = (const __be32 *)tp_sram; /* Verify checksum */ for (csum = 0, i = 0; i < size / sizeof(csum); i++) @@ -1040,7 +1041,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size) { u32 csum; unsigned int i; - const u32 *p = (const u32 *)fw_data; + const __be32 *p = (const __be32 *)fw_data; int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; if ((size & 3) || size < FW_MIN_SIZE) @@ -2877,14 +2878,14 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p) int t3_set_proto_sram(struct adapter *adap, u8 *data) { int i; - u32 *buf = (u32 *)data; + __be32 *buf = (__be32 *)data; for (i = 0; i < PROTO_SRAM_LINES; i++) { - t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++)); - t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++)); - t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++)); - t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++)); - t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++)); + t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, be32_to_cpu(*buf++)); + t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, be32_to_cpu(*buf++)); + t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, be32_to_cpu(*buf++)); + t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, be32_to_cpu(*buf++)); + t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, be32_to_cpu(*buf++)); t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) |