@@ -86,7 +86,7 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
if (!mac_cb->cpld_vaddr)
return -ENODEV;
- *sfp_prsnt = !dsaf_read_b((u64)mac_cb->cpld_vaddr
+ *sfp_prsnt = !dsaf_read_b((u8 *)mac_cb->cpld_vaddr
+ MAC_SFP_PORT_OFFSET);
return 0;
@@ -43,7 +43,7 @@ struct hns_mac_cb;
#define DSAF_DUMP_REGS_NUM 504
#define DSAF_STATIC_NUM 28
-#define DSAF_STATS_READ(p, offset) (*((u64 *)((u64)(p) + (offset))))
+#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset))))
enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE = 0x0,
@@ -302,7 +302,7 @@ struct dsaf_device {
static inline void *hns_dsaf_dev_priv(const struct dsaf_device *dsaf_dev)
{
- return (void *)((u64)dsaf_dev + sizeof(*dsaf_dev));
+ return (void *)((u8 *)dsaf_dev + sizeof(*dsaf_dev));
}
struct dsaf_drv_tbl_tcam_key {
@@ -191,9 +191,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type)
if (ring_type == RX_RING) {
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_L_REG,
(u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
(u32)(dma >> 32));
-
+#else
+ dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
@@ -203,9 +206,12 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type)
} else {
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_L_REG,
(u32)dma);
+#ifdef CONFIG_64BIT
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
(u32)(dma >> 32));
-
+#else
+ dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG, 0);
+#endif
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
@@ -966,7 +966,15 @@ static inline u32 dsaf_get_reg_field(void *base, u32 reg, u32 mask, u32 shift)
#define dsaf_read_b(addr)\
readb((__iomem unsigned char *)(addr))
+#ifndef readq
+static inline u64 readq(void __iomem *reg)
+{
+ return (((u64)readl(reg + 0x4UL) << 32) |
+ (u64)readl(reg));
+}
+#endif
+
#define hns_mac_reg_read64(drv, offset) \
- readq((__iomem void *)(((u64)(drv)->io_base + 0xc00 + (offset))))
+ readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset))))
#endif /* _DSAF_REG_H */
@@ -31,8 +31,6 @@
#define NIC_TX_CLEAN_MAX_NUM 256
#define NIC_RX_CLEAN_MAX_NUM 64
-#define RCB_ERR_PRINT_CYCLE 1000
-
#define RCB_IRQ_NOT_INITED 0
#define RCB_IRQ_INITED 1
@@ -434,21 +432,12 @@ out_bnum_err:
if (unlikely((!desc->rx.pkt_len) ||
hnae_get_bit(bnum_flag, HNS_RXD_DROP_B))) {
- if (!(ring->stats.err_pkt_len % RCB_ERR_PRINT_CYCLE))
- netdev_dbg(ndev,
- "pkt_len(%u),drop(%u),%#llx,%#llx\n",
- le16_to_cpu(desc->rx.pkt_len),
- hnae_get_bit(bnum_flag, HNS_RXD_DROP_B),
- ((u64 *)desc)[0], ((u64 *)desc)[1]);
ring->stats.err_pkt_len++;
dev_kfree_skb_any(skb);
return -EFAULT;
}
if (unlikely(hnae_get_bit(bnum_flag, HNS_RXD_L2E_B))) {
- if (!(ring->stats.l2_err % RCB_ERR_PRINT_CYCLE))
- netdev_dbg(ndev, "L2 check err,%#llx,%#llx\n",
- ((u64 *)desc)[0], ((u64 *)desc)[1]);
ring->stats.l2_err++;
dev_kfree_skb_any(skb);
return -EFAULT;
@@ -459,12 +448,6 @@ out_bnum_err:
if (unlikely(hnae_get_bit(bnum_flag, HNS_RXD_L3E_B) ||
hnae_get_bit(bnum_flag, HNS_RXD_L4E_B))) {
- if (!(ring->stats.l3l4_csum_err % RCB_ERR_PRINT_CYCLE))
- netdev_dbg(ndev,
- "check err(%#x),%#llx,%#llx\n",
- hnae_get_bit(bnum_flag, HNS_RXD_L3E_B) |
- hnae_get_bit(bnum_flag, HNS_RXD_L4E_B),
- ((u64 *)desc)[0], ((u64 *)desc)[1]);
ring->stats.l3l4_csum_err++;
return 0;
}