@@ -1601,6 +1601,46 @@ fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16)
1601
1601
return caps32 ;
1602
1602
}
1603
1603
1604
+ /**
1605
+ * fwcaps32_to_caps16 - convert 32-bit Port Capabilities to 16-bits
1606
+ * @caps32: a 32-bit Port Capabilities value
1607
+ *
1608
+ * Returns the equivalent 16-bit Port Capabilities value. Note that
1609
+ * not all 32-bit Port Capabilities can be represented in the 16-bit
1610
+ * Port Capabilities and some fields/values may not make it.
1611
+ */
1612
+ fw_port_cap16_t fwcaps32_to_caps16 (fw_port_cap32_t caps32 )
1613
+ {
1614
+ fw_port_cap16_t caps16 = 0 ;
1615
+
1616
+ #define CAP32_TO_CAP16 (__cap ) \
1617
+ do { \
1618
+ if (caps32 & FW_PORT_CAP32_##__cap) \
1619
+ caps16 |= FW_PORT_CAP_##__cap; \
1620
+ } while (0)
1621
+
1622
+ CAP32_TO_CAP16 (SPEED_100M );
1623
+ CAP32_TO_CAP16 (SPEED_1G );
1624
+ CAP32_TO_CAP16 (SPEED_10G );
1625
+ CAP32_TO_CAP16 (SPEED_25G );
1626
+ CAP32_TO_CAP16 (SPEED_40G );
1627
+ CAP32_TO_CAP16 (SPEED_100G );
1628
+ CAP32_TO_CAP16 (FC_RX );
1629
+ CAP32_TO_CAP16 (FC_TX );
1630
+ CAP32_TO_CAP16 (802 _3_PAUSE );
1631
+ CAP32_TO_CAP16 (802 _3_ASM_DIR );
1632
+ CAP32_TO_CAP16 (ANEG );
1633
+ CAP32_TO_CAP16 (FORCE_PAUSE );
1634
+ CAP32_TO_CAP16 (MDIAUTO );
1635
+ CAP32_TO_CAP16 (MDISTRAIGHT );
1636
+ CAP32_TO_CAP16 (FEC_RS );
1637
+ CAP32_TO_CAP16 (FEC_BASER_RS );
1638
+
1639
+ #undef CAP32_TO_CAP16
1640
+
1641
+ return caps16 ;
1642
+ }
1643
+
1604
1644
/**
1605
1645
* lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities
1606
1646
* @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value
@@ -1759,7 +1799,7 @@ csio_enable_ports(struct csio_hw *hw)
1759
1799
val = 1 ;
1760
1800
1761
1801
csio_mb_params (hw , mbp , CSIO_MB_DEFAULT_TMO ,
1762
- hw -> pfn , 0 , 1 , & param , & val , false ,
1802
+ hw -> pfn , 0 , 1 , & param , & val , true ,
1763
1803
NULL );
1764
1804
1765
1805
if (csio_mb_issue (hw , mbp )) {
@@ -1769,16 +1809,9 @@ csio_enable_ports(struct csio_hw *hw)
1769
1809
return - EINVAL ;
1770
1810
}
1771
1811
1772
- csio_mb_process_read_params_rsp (hw , mbp , & retval , 1 ,
1773
- & val );
1774
- if (retval != FW_SUCCESS ) {
1775
- csio_err (hw , "FW_PARAMS_CMD(r) port:%d failed: 0x%x\n" ,
1776
- portid , retval );
1777
- mempool_free (mbp , hw -> mb_mempool );
1778
- return - EINVAL ;
1779
- }
1780
-
1781
- fw_caps = val ;
1812
+ csio_mb_process_read_params_rsp (hw , mbp , & retval ,
1813
+ 0 , NULL );
1814
+ fw_caps = retval ? FW_CAPS16 : FW_CAPS32 ;
1782
1815
}
1783
1816
1784
1817
/* Read PORT information */
0 commit comments