lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <E1eXXjK-0002DS-Jh@ZenIV.linux.org.uk>
Date:   Fri, 05 Jan 2018 19:32:38 +0000
From:   Al Viro <viro@....linux.org.uk>
To:     netdev@...r.kernel.org
Cc:     <rasesh.mody@...ium.com>, Mody@....linux.org.uk,
        Rasesh@....linux.org.uk
Subject: Subject: [RFC][PATCH 08/11] bna: (partial) endianness annotations


Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 drivers/net/ethernet/brocade/bna/bfa_ioc.c     | 26 +++----
 drivers/net/ethernet/brocade/bna/bfa_ioc.h     |  4 +-
 drivers/net/ethernet/brocade/bna/bfi.h         | 94 ++++++++++++-------------
 drivers/net/ethernet/brocade/bna/bfi_enet.h    | 96 +++++++++++++-------------
 drivers/net/ethernet/brocade/bna/bna.h         |  2 +-
 drivers/net/ethernet/brocade/bna/bna_enet.c    |  6 +-
 drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 34 ++++-----
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c   |  2 +-
 8 files changed, 132 insertions(+), 132 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index a36e38676640..4f673c56a40b 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -93,7 +93,7 @@ static void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc *ioc,
 static void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc *ioc,
 						char *manufacturer);
 static void bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model);
-static u64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc);
+static __be64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc);
 
 /* IOC state machine definitions/declarations */
 enum ioc_event {
@@ -1904,7 +1904,7 @@ bfa_nw_ioc_timeout(struct bfa_ioc *ioc)
 static void
 bfa_ioc_mbox_send(struct bfa_ioc *ioc, void *ioc_msg, int len)
 {
-	u32 *msgp = (u32 *) ioc_msg;
+	__le32 *msgp = (__le32 *) ioc_msg;
 	u32 i;
 
 	BUG_ON(!(len <= BFI_IOC_MSGLEN_MAX));
@@ -1913,7 +1913,7 @@ bfa_ioc_mbox_send(struct bfa_ioc *ioc, void *ioc_msg, int len)
 	 * first write msg to mailbox registers
 	 */
 	for (i = 0; i < len / sizeof(u32); i++)
-		writel(cpu_to_le32(msgp[i]),
+		writel(le32_to_cpu(msgp[i]),
 			      ioc->ioc_regs.hfn_mbox + i * sizeof(u32));
 
 	for (; i < BFI_IOC_MSGLEN_MAX / sizeof(u32); i++)
@@ -1936,7 +1936,7 @@ bfa_ioc_send_enable(struct bfa_ioc *ioc)
 	enable_req.clscode = htons(ioc->clscode);
 	enable_req.rsvd = htons(0);
 	/* overflow in 2106 */
-	enable_req.tv_sec = ntohl(ktime_get_real_seconds());
+	enable_req.tv_sec = htonl(ktime_get_real_seconds());
 	bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req));
 }
 
@@ -1950,7 +1950,7 @@ bfa_ioc_send_disable(struct bfa_ioc *ioc)
 	disable_req.clscode = htons(ioc->clscode);
 	disable_req.rsvd = htons(0);
 	/* overflow in 2106 */
-	disable_req.tv_sec = ntohl(ktime_get_real_seconds());
+	disable_req.tv_sec = htonl(ktime_get_real_seconds());
 	bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req));
 }
 
@@ -2417,7 +2417,7 @@ bfa_nw_ioc_auto_recover(bool auto_recover)
 static bool
 bfa_ioc_msgget(struct bfa_ioc *ioc, void *mbmsg)
 {
-	u32	*msgp = mbmsg;
+	__be32	*msgp = mbmsg;
 	u32	r32;
 	int		i;
 
@@ -2924,7 +2924,7 @@ bfa_nw_ioc_get_attr(struct bfa_ioc *ioc, struct bfa_ioc_attr *ioc_attr)
 }
 
 /* WWN public */
-static u64
+static __be64
 bfa_ioc_get_pwwn(struct bfa_ioc *ioc)
 {
 	return ioc->attr->pwwn;
@@ -3072,12 +3072,12 @@ bfa_flash_write_send(struct bfa_flash *flash)
 			(struct bfi_flash_write_req *) flash->mb.msg;
 	u32	len;
 
-	msg->type = be32_to_cpu(flash->type);
+	msg->type = cpu_to_be32(flash->type);
 	msg->instance = flash->instance;
-	msg->offset = be32_to_cpu(flash->addr_off + flash->offset);
+	msg->offset = cpu_to_be32(flash->addr_off + flash->offset);
 	len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ?
 	       flash->residue : BFA_FLASH_DMA_BUF_SZ;
-	msg->length = be32_to_cpu(len);
+	msg->length = cpu_to_be32(len);
 
 	/* indicate if it's the last msg of the whole write operation */
 	msg->last = (len == flash->residue) ? 1 : 0;
@@ -3105,12 +3105,12 @@ bfa_flash_read_send(void *cbarg)
 			(struct bfi_flash_read_req *) flash->mb.msg;
 	u32	len;
 
-	msg->type = be32_to_cpu(flash->type);
+	msg->type = cpu_to_be32(flash->type);
 	msg->instance = flash->instance;
-	msg->offset = be32_to_cpu(flash->addr_off + flash->offset);
+	msg->offset = cpu_to_be32(flash->addr_off + flash->offset);
 	len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ?
 	       flash->residue : BFA_FLASH_DMA_BUF_SZ;
-	msg->length = be32_to_cpu(len);
+	msg->length = cpu_to_be32(len);
 	bfi_h2i_set(msg->mh, BFI_MC_FLASH, BFI_FLASH_H2I_READ_REQ,
 		    bfa_ioc_portid(flash->ioc));
 	bfa_alen_set(&msg->alen, len, flash->dbuf_pa);
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
index 2c0b4c076355..3ecb26c05728 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
@@ -60,8 +60,8 @@ struct bfa_dma {
 static inline void
 __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
 {
-	dma_addr->a32.addr_lo = (u32) htonl(pa);
-	dma_addr->a32.addr_hi = (u32) htonl(upper_32_bits(pa));
+	dma_addr->a32.addr_lo = htonl(pa);
+	dma_addr->a32.addr_hi = htonl(upper_32_bits(pa));
 }
 
 #define bfa_alen_set(__alen, __len, __pa)	\
diff --git a/drivers/net/ethernet/brocade/bna/bfi.h b/drivers/net/ethernet/brocade/bna/bfi.h
index 81e59ea8b4f2..ce81adeabf11 100644
--- a/drivers/net/ethernet/brocade/bna/bfi.h
+++ b/drivers/net/ethernet/brocade/bna/bfi.h
@@ -35,7 +35,7 @@ struct bfi_mhdr {
 			u8	qid;
 			u8	fn_lpu;	/*!< msg destination		    */
 		} __packed h2i;
-		u16	i2htok;	/*!< token in msgs to host	    */
+		__be16	i2htok;	/*!< token in msgs to host	    */
 	} __packed mtag;
 } __packed;
 
@@ -71,15 +71,15 @@ struct bfi_mhdr {
 /* DMA addresses */
 union bfi_addr_u {
 	struct {
-		u32	addr_lo;
-		u32	addr_hi;
+		__be32	addr_lo;
+		__be32	addr_hi;
 	} __packed a32;
 } __packed;
 
 /* Generic DMA addr-len pair. */
 struct bfi_alen {
 	union bfi_addr_u	al_addr;	/* DMA addr of buffer	*/
-	u32			al_len;		/* length of buffer */
+	__be32			al_len;		/* length of buffer */
 } __packed;
 
 /*
@@ -93,7 +93,7 @@ struct bfi_alen {
 #define BFI_MBMSG_SZ		7
 struct bfi_mbmsg {
 	struct bfi_mhdr mh;
-	u32		pl[BFI_MBMSG_SZ];
+	__be32		pl[BFI_MBMSG_SZ];
 } __packed;
 
 /* Supported PCI function class codes (personality) */
@@ -185,30 +185,30 @@ struct bfi_ioc_getattr_req {
 } __packed;
 
 struct bfi_ioc_attr {
-	u64		mfg_pwwn;	/*!< Mfg port wwn	   */
-	u64		mfg_nwwn;	/*!< Mfg node wwn	   */
+	__be64		mfg_pwwn;	/*!< Mfg port wwn	   */
+	__be64		mfg_nwwn;	/*!< Mfg node wwn	   */
 	u8		mfg_mac[ETH_ALEN]; /*!< Mfg mac		   */
 	u8		port_mode;	/* enum bfi_port_mode	   */
 	u8		rsvd_a;
-	u64		pwwn;
-	u64		nwwn;
+	__be64		pwwn;
+	__be64		nwwn;
 	u8		mac[ETH_ALEN];	/*!< PBC or Mfg mac	   */
-	u16	rsvd_b;
+	__be16	rsvd_b;
 	u8		fcoe_mac[ETH_ALEN];
-	u16	rsvd_c;
+	__be16	rsvd_c;
 	char		brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
 	u8		pcie_gen;
 	u8		pcie_lanes_orig;
 	u8		pcie_lanes;
 	u8		rx_bbcredit;	/*!< receive buffer credits */
-	u32	adapter_prop;	/*!< adapter properties     */
-	u16	maxfrsize;	/*!< max receive frame size */
+	__be32	adapter_prop;	/*!< adapter properties     */
+	__be16	maxfrsize;	/*!< max receive frame size */
 	char		asic_rev;
 	u8		rsvd_d;
 	char		fw_version[BFA_VERSION_LEN];
 	char		optrom_version[BFA_VERSION_LEN];
 	struct bfa_mfg_vpd vpd;
-	u32	card_type;	/*!< card type			*/
+	__be32	card_type;	/*!< card type			*/
 } __packed;
 
 /* BFI_IOC_I2H_GETATTR_REPLY message */
@@ -257,16 +257,16 @@ struct bfi_ioc_fwver {
 } __packed;
 
 struct bfi_ioc_image_hdr {
-	u32	signature;	/*!< constant signature */
+	__be32	signature;	/*!< constant signature */
 	u8	asic_gen;	/*!< asic generation */
 	u8	asic_mode;
 	u8	port0_mode;	/*!< device mode for port 0 */
 	u8	port1_mode;	/*!< device mode for port 1 */
-	u32	exec;		/*!< exec vector	*/
-	u32	bootenv;	/*!< firmware boot env */
-	u32	rsvd_b[2];
+	__be32	exec;		/*!< exec vector	*/
+	__be32	bootenv;	/*!< firmware boot env */
+	__be32	rsvd_b[2];
 	struct bfi_ioc_fwver fwver;
-	u32	md5sum[BFI_IOC_MD5SUM_SZ];
+	__be32	md5sum[BFI_IOC_MD5SUM_SZ];
 } __packed;
 
 enum bfi_ioc_img_ver_cmp {
@@ -298,7 +298,7 @@ enum bfi_port_mode {
 
 struct bfi_ioc_hbeat {
 	struct bfi_mhdr mh;		/*!< common msg header		*/
-	u32	   hb_count;	/*!< current heart beat count	*/
+	__be32	   hb_count;	/*!< current heart beat count	*/
 } __packed;
 
 /* IOC hardware/firmware state */
@@ -340,9 +340,9 @@ enum {
 /* BFI_IOC_H2I_ENABLE_REQ & BFI_IOC_H2I_DISABLE_REQ messages */
 struct bfi_ioc_ctrl_req {
 	struct bfi_mhdr mh;
-	u16			clscode;
-	u16			rsvd;
-	u32		tv_sec;
+	__be16			clscode;
+	__be16			rsvd;
+	__be32		tv_sec;
 } __packed;
 
 /* BFI_IOC_I2H_ENABLE_REPLY & BFI_IOC_I2H_DISABLE_REPLY messages */
@@ -361,14 +361,14 @@ union bfi_ioc_h2i_msg_u {
 	struct bfi_ioc_ctrl_req enable_req;
 	struct bfi_ioc_ctrl_req disable_req;
 	struct bfi_ioc_getattr_req getattr_req;
-	u32			mboxmsg[BFI_IOC_MSGSZ];
+	__be32			mboxmsg[BFI_IOC_MSGSZ];
 } __packed;
 
 /* I2H Messages */
 union bfi_ioc_i2h_msg_u {
 	struct bfi_mhdr mh;
 	struct bfi_ioc_ctrl_reply fw_event;
-	u32			mboxmsg[BFI_IOC_MSGSZ];
+	__be32			mboxmsg[BFI_IOC_MSGSZ];
 } __packed;
 
 /*----------------------------------------------------------------------
@@ -394,8 +394,8 @@ enum bfi_msgq_i2h_msgs {
 struct bfi_msgq_mhdr {
 	u8	msg_class;
 	u8	msg_id;
-	u16	msg_token;
-	u16	num_entries;
+	__be16	msg_token;
+	__be16	num_entries;
 	u8	enet_id;
 	u8	rsvd[1];
 } __packed;
@@ -418,7 +418,7 @@ struct bfi_msgq_mhdr {
 
 struct bfi_msgq {
 	union bfi_addr_u addr;
-	u16 q_depth;     /* Total num of entries in the queue */
+	__be16 q_depth;     /* Total num of entries in the queue */
 	u8 rsvd[2];
 } __packed;
 
@@ -440,8 +440,8 @@ struct bfi_msgq_cfg_rsp {
 struct bfi_msgq_h2i_db {
 	struct bfi_mhdr mh;
 	union {
-		u16 cmdq_pi;
-		u16 rspq_ci;
+		__be16 cmdq_pi;
+		__be16 rspq_ci;
 	} __packed idx;
 } __packed;
 
@@ -449,8 +449,8 @@ struct bfi_msgq_h2i_db {
 struct bfi_msgq_i2h_db {
 	struct bfi_mhdr mh;
 	union {
-		u16 rspq_pi;
-		u16 cmdq_ci;
+		__be16 rspq_pi;
+		__be16 cmdq_ci;
 	} __packed idx;
 } __packed;
 
@@ -465,8 +465,8 @@ struct bfi_msgq_h2i_cmdq_copy_rsp {
 /* BFI_MSGQ_I2H_CMD_COPY_REQ */
 struct bfi_msgq_i2h_cmdq_copy_req {
 	struct bfi_mhdr mh;
-	u16     offset;
-	u16     len;
+	__be16     offset;
+	__be16     len;
 } __packed;
 
 /*
@@ -503,12 +503,12 @@ struct bfi_flash_query_req {
 struct bfi_flash_write_req {
 	struct bfi_mhdr mh;	/* Common msg header */
 	struct bfi_alen alen;
-	u32	type;   /* partition type */
+	__be32	type;   /* partition type */
 	u8	instance; /* partition instance */
 	u8	last;
 	u8	rsv[2];
-	u32	offset;
-	u32	length;
+	__be32	offset;
+	__be32	length;
 } __packed;
 
 /*
@@ -516,11 +516,11 @@ struct bfi_flash_write_req {
  */
 struct bfi_flash_read_req {
 	struct bfi_mhdr mh;	/* Common msg header */
-	u32	type;		/* partition type */
+	__be32	type;		/* partition type */
 	u8	instance;	/* partition instance */
 	u8	rsv[3];
-	u32	offset;
-	u32	length;
+	__be32	offset;
+	__be32	length;
 	struct bfi_alen alen;
 } __packed;
 
@@ -529,7 +529,7 @@ struct bfi_flash_read_req {
  */
 struct bfi_flash_query_rsp {
 	struct bfi_mhdr mh;	/* Common msg header */
-	u32	status;
+	__be32	status;
 } __packed;
 
 /*
@@ -537,11 +537,11 @@ struct bfi_flash_query_rsp {
  */
 struct bfi_flash_read_rsp {
 	struct bfi_mhdr mh;	/* Common msg header */
-	u32	type;		/* partition type */
+	__be32	type;		/* partition type */
 	u8	instance;	/* partition instance */
 	u8	rsv[3];
-	u32	status;
-	u32	length;
+	__be32	status;
+	__be32	length;
 } __packed;
 
 /*
@@ -549,11 +549,11 @@ struct bfi_flash_read_rsp {
  */
 struct bfi_flash_write_rsp {
 	struct bfi_mhdr mh;	/* Common msg header */
-	u32	type;		/* partition type */
+	__be32	type;		/* partition type */
 	u8	instance;	/* partition instance */
 	u8	rsv[3];
-	u32	status;
-	u32	length;
+	__be32	status;
+	__be32	length;
 } __packed;
 
 #endif /* __BFI_H__ */
diff --git a/drivers/net/ethernet/brocade/bna/bfi_enet.h b/drivers/net/ethernet/brocade/bna/bfi_enet.h
index d7be7ea8c7f5..157e2a296ffa 100644
--- a/drivers/net/ethernet/brocade/bna/bfi_enet.h
+++ b/drivers/net/ethernet/brocade/bna/bfi_enet.h
@@ -55,8 +55,8 @@
 
 union bfi_addr_be_u {
 	struct {
-		u32	addr_hi;	/* Most Significant 32-bits */
-		u32	addr_lo;	/* Least Significant 32-Bits */
+		__be32	addr_hi;	/* Most Significant 32-bits */
+		__be32	addr_lo;	/* Least Significant 32-Bits */
 	} __packed a32;
 } __packed;
 
@@ -79,24 +79,24 @@ union bfi_addr_be_u {
 struct bfi_enet_txq_wi_base {
 	u8			reserved;
 	u8			num_vectors;	/* number of vectors present */
-	u16			opcode;
+	__be16			opcode;
 			/* BFI_ENET_TXQ_WI_SEND or BFI_ENET_TXQ_WI_SEND_LSO */
-	u16			flags;		/* OR of all the flags */
-	u16			l4_hdr_size_n_offset;
-	u16			vlan_tag;
-	u16			lso_mss;	/* Only 14 LSB are valid */
-	u32			frame_length;	/* Only 24 LSB are valid */
+	__be16			flags;		/* OR of all the flags */
+	__be16			l4_hdr_size_n_offset;
+	__be16			vlan_tag;
+	__be16			lso_mss;	/* Only 14 LSB are valid */
+	__be32			frame_length;	/* Only 24 LSB are valid */
 } __packed;
 
 struct bfi_enet_txq_wi_ext {
-	u16			reserved;
-	u16			opcode;		/* BFI_ENET_TXQ_WI_EXTENSION */
-	u32			reserved2[3];
+	__be16			reserved;
+	__be16			opcode;		/* BFI_ENET_TXQ_WI_EXTENSION */
+	__be32			reserved2[3];
 } __packed;
 
 struct bfi_enet_txq_wi_vector {			/* Tx Buffer Descriptor */
-	u16			reserved;
-	u16			length;		/* Only 14 LSB are valid */
+	__be16			reserved;
+	__be16			length;		/* Only 14 LSB are valid */
 	union bfi_addr_be_u	addr;
 } __packed;
 
@@ -151,10 +151,10 @@ struct bfi_enet_rxq_entry {
 
 /* CQ Entry Structure */
 struct bfi_enet_cq_entry {
-	u32 flags;
-	u16	vlan_tag;
-	u16	length;
-	u32	rss_hash;
+	__be32 flags;
+	__be16	vlan_tag;
+	__be16	length;
+	__be32	rss_hash;
 	u8	valid;
 	u8	reserved1;
 	u8	reserved2;
@@ -165,8 +165,8 @@ struct bfi_enet_cq_entry {
 struct bfi_enet_q {
 	union bfi_addr_u	pg_tbl;
 	union bfi_addr_u	first_entry;
-	u16		pages;	/* # of pages */
-	u16		page_sz;
+	__be16		pages;	/* # of pages */
+	__be16		page_sz;
 } __packed;
 
 struct bfi_enet_txq {
@@ -177,8 +177,8 @@ struct bfi_enet_txq {
 
 struct bfi_enet_rxq {
 	struct bfi_enet_q	q;
-	u16		rx_buffer_size;
-	u16		rsvd;
+	__be16		rx_buffer_size;
+	__be16		rsvd;
 } __packed;
 
 struct bfi_enet_cq {
@@ -192,8 +192,8 @@ struct bfi_enet_ib_cfg {
 	u8		continuous_coalescing;
 	u8		msix;
 	u8		rsvd[3];
-	u32	coalescing_timeout;
-	u32	inter_pkt_timeout;
+	__be32	coalescing_timeout;
+	__be32	inter_pkt_timeout;
 	u8		inter_pkt_count;
 	u8		rsvd1[3];
 } __packed;
@@ -201,10 +201,10 @@ struct bfi_enet_ib_cfg {
 struct bfi_enet_ib {
 	union bfi_addr_u	index_addr;
 	union {
-		u16	msix_index;
-		u16	intx_bitmask;
+		__be16	msix_index;
+		__be16	intx_bitmask;
 	} __packed intr;
-	u16		rsvd;
+	__be16		rsvd;
 } __packed;
 
 /* ENET command messages */
@@ -375,7 +375,7 @@ struct bfi_enet_rsp {
 	struct bfi_msgq_mhdr mh;
 	u8		error;		/*!< if error see cmd_offset */
 	u8		rsvd;
-	u16		cmd_offset;	/*!< offset to invalid parameter */
+	__be16		cmd_offset;	/*!< offset to invalid parameter */
 } __packed;
 
 /* GLOBAL CONFIGURATION */
@@ -394,10 +394,10 @@ struct bfi_enet_attr_rsp {
 	struct bfi_msgq_mhdr mh;
 	u8		error;		/*!< if error see cmd_offset */
 	u8		rsvd;
-	u16		cmd_offset;	/*!< offset to invalid parameter */
-	u32		max_cfg;
-	u32		max_ucmac;
-	u32		rit_size;
+	__be16		cmd_offset;	/*!< offset to invalid parameter */
+	__be32		max_cfg;
+	__be32		max_ucmac;
+	__be32		rit_size;
 } __packed;
 
 /* Tx Configuration
@@ -414,7 +414,7 @@ enum bfi_enet_tx_vlan_mode {
 struct bfi_enet_tx_cfg {
 	u8		vlan_mode;	/*!< processing mode */
 	u8		rsvd;
-	u16		vlan_id;
+	__be16		vlan_id;
 	u8		admit_tagged_frame;
 	u8		apply_vlan_filter;
 	u8		add_to_vswitch;
@@ -442,8 +442,8 @@ struct bfi_enet_tx_cfg_rsp {
 	u8		hw_id;		/* For debugging */
 	u8		rsvd[2];
 	struct {
-		u32	q_dbell;	/* PCI base address offset */
-		u32	i_dbell;	/* PCI base address offset */
+		__be32	q_dbell;	/* PCI base address offset */
+		__be32	i_dbell;	/* PCI base address offset */
 		u8	hw_qid;		/* For debugging */
 		u8	rsvd[3];
 	} __packed q_handles[BFI_ENET_TXQ_PRIO_MAX];
@@ -472,7 +472,7 @@ enum bfi_enet_hds_type {
 struct bfi_enet_rx_cfg {
 	u8		rxq_type;
 	u8		rsvd[1];
-	u16		frame_size;
+	__be16		frame_size;
 
 	struct {
 		u8			max_header_size;
@@ -515,9 +515,9 @@ struct bfi_enet_rx_cfg_rsp {
 	u8		hw_id;	 /* For debugging */
 	u8		rsvd[2];
 	struct {
-		u32	ql_dbell; /* PCI base address offset */
-		u32	qs_dbell; /* PCI base address offset */
-		u32	i_dbell;  /* PCI base address offset */
+		__be32	ql_dbell; /* PCI base address offset */
+		__be32	qs_dbell; /* PCI base address offset */
+		__be32	i_dbell;  /* PCI base address offset */
 		u8		hw_lqid;  /* For debugging */
 		u8		hw_sqid;  /* For debugging */
 		u8		hw_cqid;  /* For debugging */
@@ -532,7 +532,7 @@ struct bfi_enet_rx_cfg_rsp {
  */
 struct bfi_enet_rit_req {
 	struct	bfi_msgq_mhdr mh;
-	u16	size;			/* number of table-entries used */
+	__be16	size;			/* number of table-entries used */
 	u8	rsvd[2];
 	u8	table[BFI_ENET_RSS_RIT_MAX];
 } __packed;
@@ -553,7 +553,7 @@ struct bfi_enet_rss_cfg {
 	u8	type;
 	u8	mask;
 	u8	rsvd[2];
-	u32	key[BFI_ENET_RSS_KEY_LEN];
+	__be32	key[BFI_ENET_RSS_KEY_LEN];
 } __packed;
 
 struct bfi_enet_rss_cfg_req {
@@ -578,7 +578,7 @@ struct bfi_enet_ucast_req {
 /* MAC Unicast + VLAN */
 struct bfi_enet_mac_n_vlan_req {
 	struct bfi_msgq_mhdr	mh;
-	u16			vlan_id;
+	__be16			vlan_id;
 	u8			mac_addr[ETH_ALEN];
 } __packed;
 
@@ -600,8 +600,8 @@ struct bfi_enet_mcast_add_rsp {
 	struct bfi_msgq_mhdr	mh;
 	u8			error;
 	u8			rsvd;
-	u16			cmd_offset;
-	u16			handle;
+	__be16			cmd_offset;
+	__be16			handle;
 	u8			rsvd1[2];
 } __packed;
 
@@ -610,7 +610,7 @@ struct bfi_enet_mcast_add_rsp {
  */
 struct bfi_enet_mcast_del_req {
 	struct bfi_msgq_mhdr	mh;
-	u16			handle;
+	__be16			handle;
 	u8			rsvd[2];
 } __packed;
 
@@ -623,7 +623,7 @@ struct bfi_enet_rx_vlan_req {
 	struct bfi_msgq_mhdr	mh;
 	u8			block_idx;
 	u8			rsvd[3];
-	u32			bit_mask[BFI_ENET_VLAN_WORDS_MAX];
+	__be32			bit_mask[BFI_ENET_VLAN_WORDS_MAX];
 } __packed;
 
 /* PAUSE
@@ -664,10 +664,10 @@ enum {
  */
 struct bfi_enet_stats_req {
 	struct bfi_msgq_mhdr	mh;
-	u16			stats_mask;
+	__be16			stats_mask;
 	u8			rsvd[2];
-	u32			rx_enet_mask;
-	u32			tx_enet_mask;
+	__be32			rx_enet_mask;
+	__be32			tx_enet_mask;
 	union bfi_addr_u	host_buffer;
 } __packed;
 
diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h
index 006dcad9a260..2b5189ef6809 100644
--- a/drivers/net/ethernet/brocade/bna/bna.h
+++ b/drivers/net/ethernet/brocade/bna/bna.h
@@ -36,7 +36,7 @@ extern const u32 bna_napi_dim_vector[][BNA_BIAS_T_MAX];
  */
 #define BNA_SET_DMA_ADDR(_addr, _bna_dma_addr)				\
 do {									\
-	u64 tmp_addr =						\
+	__be64 tmp_addr =						\
 	cpu_to_be64((u64)(_addr));				\
 	(_bna_dma_addr)->msb = ((struct bna_dma_addr *)&tmp_addr)->msb; \
 	(_bna_dma_addr)->lsb = ((struct bna_dma_addr *)&tmp_addr)->lsb; \
diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c
index bba81735ce87..a6606622764b 100644
--- a/drivers/net/ethernet/brocade/bna/bna_enet.c
+++ b/drivers/net/ethernet/brocade/bna/bna_enet.c
@@ -70,7 +70,7 @@ enum bna_ioceth_event {
 #define bna_stats_copy(_name, _type)					\
 do {									\
 	count = sizeof(struct bfi_enet_stats_ ## _type) / sizeof(u64);	\
-	stats_src = (u64 *)&bna->stats.hw_stats_kva->_name ## _stats;	\
+	stats_src = (__be64 *)&bna->stats.hw_stats_kva->_name ## _stats;	\
 	stats_dst = (u64 *)&bna->stats.hw_stats._name ## _stats;	\
 	for (i = 0; i < count; i++)					\
 		stats_dst[i] = be64_to_cpu(stats_src[i]);		\
@@ -187,7 +187,7 @@ static void
 bna_bfi_stats_get_rsp(struct bna *bna, struct bfi_msgq_mhdr *msghdr)
 {
 	struct bfi_enet_stats_req *stats_req = &bna->stats_mod.stats_get;
-	u64 *stats_src;
+	__be64 *stats_src;
 	u64 *stats_dst;
 	u32 tx_enet_mask = ntohl(stats_req->tx_enet_mask);
 	u32 rx_enet_mask = ntohl(stats_req->rx_enet_mask);
@@ -201,7 +201,7 @@ bna_bfi_stats_get_rsp(struct bna *bna, struct bfi_msgq_mhdr *msghdr)
 	bna_stats_copy(fc_rx, fc_rx);
 	bna_stats_copy(fc_tx, fc_tx);
 
-	stats_src = (u64 *)&(bna->stats.hw_stats_kva->rxf_stats[0]);
+	stats_src = (__be64 *)&(bna->stats.hw_stats_kva->rxf_stats[0]);
 
 	/* Copy Rxf stats to SW area, scatter them while copying */
 	for (i = 0; i < BFI_ENET_CFG_MAX; i++) {
diff --git a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
index 52b45c9935aa..a8bcd4927f8f 100644
--- a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
@@ -351,13 +351,13 @@ struct bna_reg {
 
 /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
 struct bna_dma_addr {
-	u32		msb;
-	u32		lsb;
+	__be32		msb;
+	__be32		lsb;
 };
 
 struct bna_txq_wi_vector {
-	u16		reserved;
-	u16		length;		/* Only 14 LSB are valid */
+	__be16		reserved;
+	__be16		length;		/* Only 14 LSB are valid */
 	struct bna_dma_addr host_addr; /* Tx-Buf DMA addr */
 };
 
@@ -370,21 +370,21 @@ struct bna_txq_entry {
 		struct {
 			u8 reserved;
 			u8 num_vectors;	/* number of vectors present */
-			u16 opcode; /* Either */
+			__be16 opcode; /* Either */
 						    /* BNA_TXQ_WI_SEND or */
 						    /* BNA_TXQ_WI_SEND_LSO */
-			u16 flags; /* OR of all the flags */
-			u16 l4_hdr_size_n_offset;
-			u16 vlan_tag;
-			u16 lso_mss;	/* Only 14 LSB are valid */
-			u32 frame_length;	/* Only 24 LSB are valid */
+			__be16 flags; /* OR of all the flags */
+			__be16 l4_hdr_size_n_offset;
+			__be16 vlan_tag;
+			__be16 lso_mss;	/* Only 14 LSB are valid */
+			__be32 frame_length;	/* Only 24 LSB are valid */
 		} wi;
 
 		struct {
-			u16 reserved;
-			u16 opcode; /* Must be */
+			__be16 reserved;
+			__be16 opcode; /* Must be */
 						    /* BNA_TXQ_WI_EXTENSION */
-			u32 reserved2[3];	/* Place holder for */
+			__be32 reserved2[3];	/* Place holder for */
 						/* removed vector (12 bytes) */
 		} wi_ext;
 	} hdr;
@@ -398,10 +398,10 @@ struct bna_rxq_entry {		/* Rx-Buffer */
 
 /* CQ Entry Structure */
 struct bna_cq_entry {
-	u32 flags;
-	u16 vlan_tag;
-	u16 length;
-	u32 rss_hash;
+	__be32 flags;
+	__be16 vlan_tag;
+	__be16 length;
+	__be32 rss_hash;
 	u8 valid;
 	u8 reserved1;
 	u8 reserved2;
diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 95bc470ae441..f5b9e1f1708f 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -278,7 +278,7 @@ bna_bfi_rx_vlan_filter_set(struct bna_rxf *rxf, u8 block_idx)
 			req->bit_mask[i] =
 				htonl(rxf->vlan_filter_table[j]);
 		else
-			req->bit_mask[i] = 0xFFFFFFFF;
+			req->bit_mask[i] = htonl(0xFFFFFFFF);
 	}
 	bfa_msgq_cmd_set(&rxf->msgq_cmd, NULL, NULL,
 		sizeof(struct bfi_enet_rx_vlan_req), &req->mh);
-- 
2.11.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ