Commit 63507592 authored by Shahed Shaikh's avatar Shahed Shaikh Committed by David S. Miller

qlcnic: fix sparse check endian warnings

Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarSony Chacko <sony.chacko@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82167cb8
......@@ -280,16 +280,16 @@ struct status_desc {
#define QLCNIC_UNI_FIRMWARE_IDX_OFF 29
struct uni_table_desc{
u32 findex;
u32 num_entries;
u32 entry_size;
u32 reserved[5];
__le32 findex;
__le32 num_entries;
__le32 entry_size;
__le32 reserved[5];
};
struct uni_data_desc{
u32 findex;
u32 size;
u32 reserved[5];
__le32 findex;
__le32 size;
__le32 reserved[5];
};
/* Flash Defines and Structures */
......@@ -416,19 +416,19 @@ struct qlcnic_nic_intr_coalesce {
};
struct qlcnic_dump_template_hdr {
__le32 type;
__le32 offset;
__le32 size;
__le32 cap_mask;
__le32 num_entries;
__le32 version;
__le32 timestamp;
__le32 checksum;
__le32 drv_cap_mask;
__le32 sys_info[3];
__le32 saved_state[16];
__le32 cap_sizes[8];
__le32 rsvd[0];
u32 type;
u32 offset;
u32 size;
u32 cap_mask;
u32 num_entries;
u32 version;
u32 timestamp;
u32 checksum;
u32 drv_cap_mask;
u32 sys_info[3];
u32 saved_state[16];
u32 cap_sizes[8];
u32 rsvd[0];
};
struct qlcnic_fw_dump {
......@@ -1065,16 +1065,16 @@ struct qlcnic_adapter {
spinlock_t tx_clean_lock;
spinlock_t mac_learn_lock;
__le32 file_prd_off; /*File fw product offset*/
u32 file_prd_off; /*File fw product offset*/
u32 fw_version;
const struct firmware *fw;
};
struct qlcnic_info {
struct qlcnic_info_le {
__le16 pci_func;
__le16 op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */
__le16 op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */
__le16 phys_port;
__le16 switch_mode; /* 0 = disabled, 1 = int, 2 = ext */
__le16 switch_mode; /* 0 = disabled, 1 = int, 2 = ext */
__le32 capabilities;
u8 max_mac_filters;
......@@ -1088,13 +1088,28 @@ struct qlcnic_info {
u8 reserved2[104];
} __packed;
struct qlcnic_pci_info {
__le16 id; /* pci function id */
__le16 active; /* 1 = Enabled */
__le16 type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */
__le16 default_port; /* default port number */
struct qlcnic_info {
u16 pci_func;
u16 op_mode;
u16 phys_port;
u16 switch_mode;
u32 capabilities;
u8 max_mac_filters;
u8 reserved1;
u16 max_mtu;
u16 max_tx_ques;
u16 max_rx_ques;
u16 min_tx_bw;
u16 max_tx_bw;
};
__le16 tx_min_bw; /* Multiple of 100mbpc */
struct qlcnic_pci_info_le {
__le16 id; /* pci function id */
__le16 active; /* 1 = Enabled */
__le16 type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */
__le16 default_port; /* default port number */
__le16 tx_min_bw; /* Multiple of 100mbpc */
__le16 tx_max_bw;
__le16 reserved1[2];
......@@ -1102,6 +1117,16 @@ struct qlcnic_pci_info {
u8 reserved2[106];
} __packed;
struct qlcnic_pci_info {
u16 id;
u16 active;
u16 type;
u16 default_port;
u16 tx_min_bw;
u16 tx_max_bw;
u8 mac[ETH_ALEN];
};
struct qlcnic_npar_info {
u16 pvid;
u16 min_bw;
......@@ -1208,7 +1233,7 @@ do { \
(VAL1) += (VAL2); \
} while (0)
struct qlcnic_mac_statistics{
struct qlcnic_mac_statistics_le {
__le64 mac_tx_frames;
__le64 mac_tx_bytes;
__le64 mac_tx_mcast_pkts;
......@@ -1248,7 +1273,45 @@ struct qlcnic_mac_statistics{
__le64 mac_align_error;
} __packed;
struct __qlcnic_esw_statistics {
struct qlcnic_mac_statistics {
u64 mac_tx_frames;
u64 mac_tx_bytes;
u64 mac_tx_mcast_pkts;
u64 mac_tx_bcast_pkts;
u64 mac_tx_pause_cnt;
u64 mac_tx_ctrl_pkt;
u64 mac_tx_lt_64b_pkts;
u64 mac_tx_lt_127b_pkts;
u64 mac_tx_lt_255b_pkts;
u64 mac_tx_lt_511b_pkts;
u64 mac_tx_lt_1023b_pkts;
u64 mac_tx_lt_1518b_pkts;
u64 mac_tx_gt_1518b_pkts;
u64 rsvd1[3];
u64 mac_rx_frames;
u64 mac_rx_bytes;
u64 mac_rx_mcast_pkts;
u64 mac_rx_bcast_pkts;
u64 mac_rx_pause_cnt;
u64 mac_rx_ctrl_pkt;
u64 mac_rx_lt_64b_pkts;
u64 mac_rx_lt_127b_pkts;
u64 mac_rx_lt_255b_pkts;
u64 mac_rx_lt_511b_pkts;
u64 mac_rx_lt_1023b_pkts;
u64 mac_rx_lt_1518b_pkts;
u64 mac_rx_gt_1518b_pkts;
u64 rsvd2[3];
u64 mac_rx_length_error;
u64 mac_rx_length_small;
u64 mac_rx_length_large;
u64 mac_rx_jabber;
u64 mac_rx_dropped;
u64 mac_rx_crc_error;
u64 mac_align_error;
};
struct qlcnic_esw_stats_le {
__le16 context_id;
__le16 version;
__le16 size;
......@@ -1263,54 +1326,69 @@ struct __qlcnic_esw_statistics {
__le64 rsvd[3];
} __packed;
struct __qlcnic_esw_statistics {
u16 context_id;
u16 version;
u16 size;
u16 unused;
u64 unicast_frames;
u64 multicast_frames;
u64 broadcast_frames;
u64 dropped_frames;
u64 errors;
u64 local_frames;
u64 numbytes;
u64 rsvd[3];
};
struct qlcnic_esw_statistics {
struct __qlcnic_esw_statistics rx;
struct __qlcnic_esw_statistics tx;
};
struct qlcnic_common_entry_hdr {
__le32 type;
__le32 offset;
__le32 cap_size;
u32 type;
u32 offset;
u32 cap_size;
u8 mask;
u8 rsvd[2];
u8 flags;
} __packed;
struct __crb {
__le32 addr;
u32 addr;
u8 stride;
u8 rsvd1[3];
__le32 data_size;
__le32 no_ops;
__le32 rsvd2[4];
u32 data_size;
u32 no_ops;
u32 rsvd2[4];
} __packed;
struct __ctrl {
__le32 addr;
u32 addr;
u8 stride;
u8 index_a;
__le16 timeout;
__le32 data_size;
__le32 no_ops;
u16 timeout;
u32 data_size;
u32 no_ops;
u8 opcode;
u8 index_v;
u8 shl_val;
u8 shr_val;
__le32 val1;
__le32 val2;
__le32 val3;
u32 val1;
u32 val2;
u32 val3;
} __packed;
struct __cache {
__le32 addr;
__le16 stride;
__le16 init_tag_val;
__le32 size;
__le32 no_ops;
__le32 ctrl_addr;
__le32 ctrl_val;
__le32 read_addr;
u32 addr;
u16 stride;
u16 init_tag_val;
u32 size;
u32 no_ops;
u32 ctrl_addr;
u32 ctrl_val;
u32 read_addr;
u8 read_addr_stride;
u8 read_addr_num;
u8 rsvd1[2];
......@@ -1318,38 +1396,38 @@ struct __cache {
struct __ocm {
u8 rsvd[8];
__le32 size;
__le32 no_ops;
u32 size;
u32 no_ops;
u8 rsvd1[8];
__le32 read_addr;
__le32 read_addr_stride;
u32 read_addr;
u32 read_addr_stride;
} __packed;
struct __mem {
u8 rsvd[24];
__le32 addr;
__le32 size;
u32 addr;
u32 size;
} __packed;
struct __mux {
__le32 addr;
u32 addr;
u8 rsvd[4];
__le32 size;
__le32 no_ops;
__le32 val;
__le32 val_stride;
__le32 read_addr;
u32 size;
u32 no_ops;
u32 val;
u32 val_stride;
u32 read_addr;
u8 rsvd2[4];
} __packed;
struct __queue {
__le32 sel_addr;
__le16 stride;
u32 sel_addr;
u16 stride;
u8 rsvd[2];
__le32 size;
__le32 no_ops;
u32 size;
u32 no_ops;
u8 rsvd2[8];
__le32 read_addr;
u32 read_addr;
u8 read_addr_stride;
u8 read_addr_cnt;
u8 rsvd3[2];
......@@ -1413,8 +1491,8 @@ enum op_codes {
struct qlcnic_dump_operations {
enum op_codes opcode;
u32 (*handler)(struct qlcnic_adapter *,
struct qlcnic_dump_entry *, u32 *);
u32 (*handler)(struct qlcnic_adapter *, struct qlcnic_dump_entry *,
__le32 *);
};
struct _cdrp_cmd {
......
......@@ -103,7 +103,7 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd)
}
static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u16 temp_size)
static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u32 temp_size)
{
uint64_t sum = 0;
int count = temp_size / sizeof(uint32_t);
......@@ -117,9 +117,9 @@ static uint32_t qlcnic_temp_checksum(uint32_t *temp_buffer, u16 temp_size)
int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter)
{
int err, i;
u16 temp_size;
void *tmp_addr;
u32 version, csum, *template, *tmp_buf;
u32 temp_size, version, csum, *template;
__le32 *tmp_buf;
struct qlcnic_cmd_args cmd;
struct qlcnic_hardware_context *ahw;
struct qlcnic_dump_template_hdr *tmpl_hdr, *tmp_tmpl;
......@@ -163,13 +163,6 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter)
goto error;
}
tmp_tmpl = tmp_addr;
csum = qlcnic_temp_checksum((uint32_t *) tmp_addr, temp_size);
if (csum) {
dev_err(&adapter->pdev->dev,
"Template header checksum validation failed\n");
err = -EIO;
goto error;
}
ahw->fw_dump.tmpl_hdr = vzalloc(temp_size);
if (!ahw->fw_dump.tmpl_hdr) {
err = -EIO;
......@@ -180,6 +173,14 @@ int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter)
for (i = 0; i < temp_size/sizeof(u32); i++)
*template++ = __le32_to_cpu(*tmp_buf++);
csum = qlcnic_temp_checksum((u32 *)ahw->fw_dump.tmpl_hdr, temp_size);
if (csum) {
dev_err(&adapter->pdev->dev,
"Template header checksum validation failed\n");
err = -EIO;
goto error;
}
tmpl_hdr = ahw->fw_dump.tmpl_hdr;
tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF;
ahw->fw_dump.enable = 1;
......@@ -231,6 +232,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
size_t rq_size, rsp_size;
u32 cap, reg, val, reg2;
int err;
u16 temp;
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
......@@ -267,8 +269,8 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP)
cap |= QLCNIC_CAP0_LRO_MSS;
prq->valid_field_offset = offsetof(struct qlcnic_hostrq_rx_ctx,
msix_handler);
temp = offsetof(struct qlcnic_hostrq_rx_ctx, msix_handler);
prq->valid_field_offset = cpu_to_le16(temp);
prq->txrx_sds_binding = nsds_rings - 1;
prq->capabilities[0] = cpu_to_le32(cap);
......@@ -687,10 +689,10 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter,
{
int err;
dma_addr_t nic_dma_t;
struct qlcnic_info *nic_info;
struct qlcnic_info_le *nic_info;
void *nic_info_addr;
struct qlcnic_cmd_args cmd;
size_t nic_size = sizeof(struct qlcnic_info);
size_t nic_size = sizeof(struct qlcnic_info_le);
nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
&nic_dma_t, GFP_KERNEL);
......@@ -745,8 +747,8 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic)
dma_addr_t nic_dma_t;
void *nic_info_addr;
struct qlcnic_cmd_args cmd;
struct qlcnic_info *nic_info;
size_t nic_size = sizeof(struct qlcnic_info);
struct qlcnic_info_le *nic_info;
size_t nic_size = sizeof(struct qlcnic_info_le);
if (adapter->op_mode != QLCNIC_MGMT_FUNC)
return err;
......@@ -796,9 +798,9 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter,
int err = 0, i;
struct qlcnic_cmd_args cmd;
dma_addr_t pci_info_dma_t;
struct qlcnic_pci_info *npar;
struct qlcnic_pci_info_le *npar;
void *pci_info_addr;
size_t npar_size = sizeof(struct qlcnic_pci_info);
size_t npar_size = sizeof(struct qlcnic_pci_info_le);
size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC;
pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size,
......@@ -877,8 +879,8 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
const u8 rx_tx, struct __qlcnic_esw_statistics *esw_stats) {
size_t stats_size = sizeof(struct __qlcnic_esw_statistics);
struct __qlcnic_esw_statistics *stats;
size_t stats_size = sizeof(struct qlcnic_esw_stats_le);
struct qlcnic_esw_stats_le *stats;
dma_addr_t stats_dma_t;
void *stats_addr;
u32 arg1;
......@@ -939,9 +941,9 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter,
struct qlcnic_mac_statistics *mac_stats)
{
struct qlcnic_mac_statistics *stats;
struct qlcnic_mac_statistics_le *stats;
struct qlcnic_cmd_args cmd;
size_t stats_size = sizeof(struct qlcnic_mac_statistics);
size_t stats_size = sizeof(struct qlcnic_mac_statistics_le);
dma_addr_t stats_dma_t;
void *stats_addr;
int err;
......
......@@ -1247,7 +1247,8 @@ qlcnic_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
void *buffer)
{
int i, copy_sz;
u32 *hdr_ptr, *data;
u32 *hdr_ptr;
__le32 *data;
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump;
......
......@@ -1349,9 +1349,8 @@ int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate)
}
/* FW dump related functions */
static u32
qlcnic_dump_crb(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
u32 *buffer)
static u32 qlcnic_dump_crb(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i;
u32 addr, data;
......@@ -1369,9 +1368,8 @@ qlcnic_dump_crb(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
return crb->no_ops * 2 * sizeof(u32);
}
static u32
qlcnic_dump_ctrl(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, u32 *buffer)
static u32 qlcnic_dump_ctrl(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i, k, timeout = 0;
void __iomem *base = adapter->ahw->pci_base0;
......@@ -1457,9 +1455,8 @@ qlcnic_dump_ctrl(struct qlcnic_adapter *adapter,
return 0;
}
static u32
qlcnic_dump_mux(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
u32 *buffer)
static u32 qlcnic_dump_mux(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int loop;
u32 val, data = 0;
......@@ -1477,9 +1474,8 @@ qlcnic_dump_mux(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
return 2 * mux->no_ops * sizeof(u32);
}
static u32
qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
u32 *buffer)
static u32 qlcnic_dump_que(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i, loop;
u32 cnt, addr, data, que_id = 0;
......@@ -1502,9 +1498,8 @@ qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
return que->no_ops * cnt * sizeof(u32);
}
static u32
qlcnic_dump_ocm(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
u32 *buffer)
static u32 qlcnic_dump_ocm(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i;
u32 data;
......@@ -1520,9 +1515,8 @@ qlcnic_dump_ocm(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
return ocm->no_ops * sizeof(u32);
}
static u32
qlcnic_read_rom(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
u32 *buffer)
static u32 qlcnic_read_rom(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i, count = 0;
u32 fl_addr, size, val, lck_val, addr;
......@@ -1551,9 +1545,8 @@ qlcnic_read_rom(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
return rom->size;
}
static u32
qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, u32 *buffer)
static u32 qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i;
u32 cnt, val, data, addr;
......@@ -1578,9 +1571,8 @@ qlcnic_dump_l1_cache(struct qlcnic_adapter *adapter,
return l1->no_ops * l1->read_addr_num * sizeof(u32);
}
static u32
qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, u32 *buffer)
static u32 qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
int i;
u32 cnt, val, data, addr;
......@@ -1627,9 +1619,8 @@ qlcnic_dump_l2_cache(struct qlcnic_adapter *adapter,
return l2->no_ops * l2->read_addr_num * sizeof(u32);
}
static u32
qlcnic_read_memory(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, u32 *buffer)
static u32 qlcnic_read_memory(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
u32 addr, data, test, ret = 0;
int i, reg_read;
......@@ -1681,9 +1672,8 @@ qlcnic_read_memory(struct qlcnic_adapter *adapter,
return mem->size;
}
static u32
qlcnic_dump_nop(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, u32 *buffer)
static u32 qlcnic_dump_nop(struct qlcnic_adapter *adapter,
struct qlcnic_dump_entry *entry, __le32 *buffer)
{
entry->hdr.flags |= QLCNIC_DUMP_SKIP;
return 0;
......@@ -1730,7 +1720,7 @@ qlcnic_valid_dump_entry(struct device *dev, struct qlcnic_dump_entry *entry,
int qlcnic_dump_fw(struct qlcnic_adapter *adapter)
{
u32 *buffer;
__le32 *buffer;
char mesg[64];
char *msg[] = {mesg, NULL};
int i, k, ops_cnt, ops_index, dump_size = 0;
......
......@@ -2030,7 +2030,7 @@ qlcnic_tx_pkt(struct qlcnic_adapter *adapter,
if (protocol == ETH_P_8021Q) {
vh = (struct vlan_ethhdr *)skb->data;
flags = FLAGS_VLAN_TAGGED;
vlan_tci = vh->h_vlan_TCI;
vlan_tci = ntohs(vh->h_vlan_TCI);
protocol = ntohs(vh->h_vlan_encapsulated_proto);
} else if (vlan_tx_tag_present(skb)) {
flags = FLAGS_VLAN_OOB;
......@@ -4520,7 +4520,7 @@ static void
qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event)
{ }
#endif
static const struct pci_error_handlers qlcnic_err_handler = {
static struct pci_error_handlers qlcnic_err_handler = {
.error_detected = qlcnic_io_error_detected,
.slot_reset = qlcnic_io_slot_reset,
.resume = qlcnic_io_resume,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment