Browse Source

[golan] Fix building with GCC 6

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
08230599ef
2 changed files with 21 additions and 6 deletions
  1. 14
    6
      src/drivers/infiniband/golan.c
  2. 7
    0
      src/drivers/infiniband/golan.h

+ 14
- 6
src/drivers/infiniband/golan.c View File

@@ -843,6 +843,7 @@ err_create_eq_eqe_alloc:
843 843
 static void golan_destory_eq(struct golan *golan)
844 844
 {
845 845
 	struct golan_cmd_layout	*cmd;
846
+	struct golan_destroy_eq_mbox_in *in;
846 847
 	uint8_t eqn = golan->eq.eqn;
847 848
 	int rc;
848 849
 
@@ -853,7 +854,8 @@ static void golan_destory_eq(struct golan *golan)
853 854
 					sizeof(struct golan_destroy_eq_mbox_in),
854 855
 					sizeof(struct golan_destroy_eq_mbox_out));
855 856
 
856
-	((struct golan_destroy_eq_mbox_in *)(cmd->in))->eqn = eqn;
857
+	in = GOLAN_MBOX_IN ( cmd, in );
858
+	in->eqn = eqn;
857 859
 	rc = send_command_and_wait(golan, DEF_CMD_IDX, NO_MBOX, NO_MBOX, __FUNCTION__);
858 860
 	GOLAN_PRINT_RC_AND_CMD_STATUS;
859 861
 
@@ -1630,6 +1632,7 @@ static int golan_post_recv(struct ib_device *ibdev,
1630 1632
 static int golan_query_vport_context ( struct ib_device *ibdev ) {
1631 1633
 	struct golan *golan = ib_get_drvdata ( ibdev );
1632 1634
 	struct golan_cmd_layout	*cmd;
1635
+	struct golan_query_hca_vport_context_inbox *in;
1633 1636
 	struct golan_query_hca_vport_context_data *context_data;
1634 1637
 	int rc;
1635 1638
 
@@ -1638,7 +1641,8 @@ static int golan_query_vport_context ( struct ib_device *ibdev ) {
1638 1641
 			sizeof(struct golan_query_hca_vport_context_inbox),
1639 1642
 			sizeof(struct golan_query_hca_vport_context_outbox) );
1640 1643
 
1641
-	((struct golan_query_hca_vport_context_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1644
+	in = GOLAN_MBOX_IN ( cmd, in );
1645
+	in->port_num = (u8)ibdev->port;
1642 1646
 
1643 1647
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1644 1648
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_context_cmd );
@@ -1662,6 +1666,7 @@ err_query_vport_context_cmd:
1662 1666
 static int golan_query_vport_gid ( struct ib_device *ibdev ) {
1663 1667
 	struct golan *golan = ib_get_drvdata( ibdev );
1664 1668
 	struct golan_cmd_layout	*cmd;
1669
+	struct golan_query_hca_vport_gid_inbox *in;
1665 1670
 	union ib_gid *ib_gid;
1666 1671
 	int rc;
1667 1672
 
@@ -1670,8 +1675,9 @@ static int golan_query_vport_gid ( struct ib_device *ibdev ) {
1670 1675
 			sizeof(struct golan_query_hca_vport_gid_inbox),
1671 1676
 			sizeof(struct golan_query_hca_vport_gid_outbox) );
1672 1677
 
1673
-	((struct golan_query_hca_vport_gid_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1674
-	((struct golan_query_hca_vport_gid_inbox *)(cmd->in))->gid_index = 0;
1678
+	in = GOLAN_MBOX_IN ( cmd, in );
1679
+	in->port_num = (u8)ibdev->port;
1680
+	in->gid_index = 0;
1675 1681
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1676 1682
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_gid_cmd );
1677 1683
 
@@ -1688,6 +1694,7 @@ err_query_vport_gid_cmd:
1688 1694
 static int golan_query_vport_pkey ( struct ib_device *ibdev ) {
1689 1695
 	struct golan *golan = ib_get_drvdata ( ibdev );
1690 1696
 	struct golan_cmd_layout	*cmd;
1697
+	struct golan_query_hca_vport_pkey_inbox *in;
1691 1698
 	//struct golan_query_hca_vport_pkey_data *pkey_table;
1692 1699
 	int pkey_table_size_in_entries = (1 << (7 + golan->caps.pkey_table_size));
1693 1700
 	int rc;
@@ -1698,8 +1705,9 @@ static int golan_query_vport_pkey ( struct ib_device *ibdev ) {
1698 1705
 			sizeof(struct golan_outbox_hdr) + 8 +
1699 1706
 			sizeof(struct golan_query_hca_vport_pkey_data) * pkey_table_size_in_entries );
1700 1707
 
1701
-	((struct golan_query_hca_vport_pkey_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1702
-	((struct golan_query_hca_vport_pkey_inbox *)(cmd->in))->pkey_index = 0xffff;
1708
+	in = GOLAN_MBOX_IN ( cmd, in );
1709
+	in->port_num = (u8)ibdev->port;
1710
+	in->pkey_index = 0xffff;
1703 1711
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1704 1712
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_pkey_cmd );
1705 1713
 

+ 7
- 0
src/drivers/infiniband/golan.h View File

@@ -74,6 +74,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
74 74
 #define GET_INBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.inbox))[idx]))
75 75
 #define GET_OUTBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.outbox))[idx]))
76 76
 
77
+#define GOLAN_MBOX_IN( cmd_ptr, in_ptr ) ( {				  \
78
+	union {								  \
79
+		__be32 raw[4];						  \
80
+		typeof ( *(in_ptr) ) cooked;				  \
81
+	} *u = container_of ( &(cmd_ptr)->in[0], typeof ( *u ), raw[0] ); \
82
+	&u->cooked; } )
83
+
77 84
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
78 85
 
79 86
 /* Fw status fields */

Loading…
Cancel
Save