@@ -1724,11 +1724,26 @@ static int qeth_bridgeport_makerc(struct qeth_card *card,
1724
1724
return rc ;
1725
1725
}
1726
1726
1727
- static inline int ipa_cmd_sbp (struct qeth_card * card )
1727
+ static struct qeth_cmd_buffer * qeth_sbp_build_cmd (struct qeth_card * card ,
1728
+ enum qeth_ipa_sbp_cmd sbp_cmd ,
1729
+ unsigned int cmd_length )
1728
1730
{
1729
- return (card -> info .type == QETH_CARD_TYPE_IQD ) ?
1730
- IPA_CMD_SETBRIDGEPORT_IQD :
1731
- IPA_CMD_SETBRIDGEPORT_OSA ;
1731
+ enum qeth_ipa_cmds ipa_cmd = (card -> info .type == QETH_CARD_TYPE_IQD ) ?
1732
+ IPA_CMD_SETBRIDGEPORT_IQD :
1733
+ IPA_CMD_SETBRIDGEPORT_OSA ;
1734
+ struct qeth_cmd_buffer * iob ;
1735
+ struct qeth_ipa_cmd * cmd ;
1736
+
1737
+ iob = qeth_get_ipacmd_buffer (card , ipa_cmd , 0 );
1738
+ if (!iob )
1739
+ return iob ;
1740
+ cmd = (struct qeth_ipa_cmd * )(iob -> data + IPA_PDU_HEADER_SIZE );
1741
+ cmd -> data .sbp .hdr .cmdlength = sizeof (struct qeth_ipacmd_sbp_hdr ) +
1742
+ cmd_length ;
1743
+ cmd -> data .sbp .hdr .command_code = sbp_cmd ;
1744
+ cmd -> data .sbp .hdr .used_total = 1 ;
1745
+ cmd -> data .sbp .hdr .seq_no = 1 ;
1746
+ return iob ;
1732
1747
}
1733
1748
1734
1749
static int qeth_bridgeport_query_support_cb (struct qeth_card * card ,
@@ -1758,21 +1773,13 @@ static int qeth_bridgeport_query_support_cb(struct qeth_card *card,
1758
1773
static void qeth_bridgeport_query_support (struct qeth_card * card )
1759
1774
{
1760
1775
struct qeth_cmd_buffer * iob ;
1761
- struct qeth_ipa_cmd * cmd ;
1762
1776
struct _qeth_sbp_cbctl cbctl ;
1763
1777
1764
1778
QETH_CARD_TEXT (card , 2 , "brqsuppo" );
1765
- iob = qeth_get_ipacmd_buffer (card , ipa_cmd_sbp (card ), 0 );
1779
+ iob = qeth_sbp_build_cmd (card , IPA_SBP_QUERY_COMMANDS_SUPPORTED ,
1780
+ sizeof (struct qeth_sbp_query_cmds_supp ));
1766
1781
if (!iob )
1767
1782
return ;
1768
- cmd = (struct qeth_ipa_cmd * )(iob -> data + IPA_PDU_HEADER_SIZE );
1769
- cmd -> data .sbp .hdr .cmdlength =
1770
- sizeof (struct qeth_ipacmd_sbp_hdr ) +
1771
- sizeof (struct qeth_sbp_query_cmds_supp );
1772
- cmd -> data .sbp .hdr .command_code =
1773
- IPA_SBP_QUERY_COMMANDS_SUPPORTED ;
1774
- cmd -> data .sbp .hdr .used_total = 1 ;
1775
- cmd -> data .sbp .hdr .seq_no = 1 ;
1776
1783
if (qeth_send_ipa_cmd (card , iob , qeth_bridgeport_query_support_cb ,
1777
1784
(void * )& cbctl ) ||
1778
1785
qeth_bridgeport_makerc (card , & cbctl ,
@@ -1826,7 +1833,6 @@ int qeth_bridgeport_query_ports(struct qeth_card *card,
1826
1833
{
1827
1834
int rc = 0 ;
1828
1835
struct qeth_cmd_buffer * iob ;
1829
- struct qeth_ipa_cmd * cmd ;
1830
1836
struct _qeth_sbp_cbctl cbctl = {
1831
1837
.data = {
1832
1838
.qports = {
@@ -1839,16 +1845,9 @@ int qeth_bridgeport_query_ports(struct qeth_card *card,
1839
1845
QETH_CARD_TEXT (card , 2 , "brqports" );
1840
1846
if (!(card -> options .sbp .supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS ))
1841
1847
return - EOPNOTSUPP ;
1842
- iob = qeth_get_ipacmd_buffer (card , ipa_cmd_sbp ( card ) , 0 );
1848
+ iob = qeth_sbp_build_cmd (card , IPA_SBP_QUERY_BRIDGE_PORTS , 0 );
1843
1849
if (!iob )
1844
1850
return - ENOMEM ;
1845
- cmd = (struct qeth_ipa_cmd * )(iob -> data + IPA_PDU_HEADER_SIZE );
1846
- cmd -> data .sbp .hdr .cmdlength =
1847
- sizeof (struct qeth_ipacmd_sbp_hdr );
1848
- cmd -> data .sbp .hdr .command_code =
1849
- IPA_SBP_QUERY_BRIDGE_PORTS ;
1850
- cmd -> data .sbp .hdr .used_total = 1 ;
1851
- cmd -> data .sbp .hdr .seq_no = 1 ;
1852
1851
rc = qeth_send_ipa_cmd (card , iob , qeth_bridgeport_query_ports_cb ,
1853
1852
(void * )& cbctl );
1854
1853
if (rc < 0 )
@@ -1880,40 +1879,31 @@ int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role)
1880
1879
int rc = 0 ;
1881
1880
int cmdlength ;
1882
1881
struct qeth_cmd_buffer * iob ;
1883
- struct qeth_ipa_cmd * cmd ;
1884
1882
struct _qeth_sbp_cbctl cbctl ;
1885
1883
enum qeth_ipa_sbp_cmd setcmd ;
1886
1884
1887
1885
QETH_CARD_TEXT (card , 2 , "brsetrol" );
1888
1886
switch (role ) {
1889
1887
case QETH_SBP_ROLE_NONE :
1890
1888
setcmd = IPA_SBP_RESET_BRIDGE_PORT_ROLE ;
1891
- cmdlength = sizeof (struct qeth_ipacmd_sbp_hdr ) +
1892
- sizeof (struct qeth_sbp_reset_role );
1889
+ cmdlength = sizeof (struct qeth_sbp_reset_role );
1893
1890
break ;
1894
1891
case QETH_SBP_ROLE_PRIMARY :
1895
1892
setcmd = IPA_SBP_SET_PRIMARY_BRIDGE_PORT ;
1896
- cmdlength = sizeof (struct qeth_ipacmd_sbp_hdr ) +
1897
- sizeof (struct qeth_sbp_set_primary );
1893
+ cmdlength = sizeof (struct qeth_sbp_set_primary );
1898
1894
break ;
1899
1895
case QETH_SBP_ROLE_SECONDARY :
1900
1896
setcmd = IPA_SBP_SET_SECONDARY_BRIDGE_PORT ;
1901
- cmdlength = sizeof (struct qeth_ipacmd_sbp_hdr ) +
1902
- sizeof (struct qeth_sbp_set_secondary );
1897
+ cmdlength = sizeof (struct qeth_sbp_set_secondary );
1903
1898
break ;
1904
1899
default :
1905
1900
return - EINVAL ;
1906
1901
}
1907
1902
if (!(card -> options .sbp .supported_funcs & setcmd ))
1908
1903
return - EOPNOTSUPP ;
1909
- iob = qeth_get_ipacmd_buffer (card , ipa_cmd_sbp ( card ), 0 );
1904
+ iob = qeth_sbp_build_cmd (card , setcmd , cmdlength );
1910
1905
if (!iob )
1911
1906
return - ENOMEM ;
1912
- cmd = (struct qeth_ipa_cmd * )(iob -> data + IPA_PDU_HEADER_SIZE );
1913
- cmd -> data .sbp .hdr .cmdlength = cmdlength ;
1914
- cmd -> data .sbp .hdr .command_code = setcmd ;
1915
- cmd -> data .sbp .hdr .used_total = 1 ;
1916
- cmd -> data .sbp .hdr .seq_no = 1 ;
1917
1907
rc = qeth_send_ipa_cmd (card , iob , qeth_bridgeport_set_cb ,
1918
1908
(void * )& cbctl );
1919
1909
if (rc < 0 )
0 commit comments