| .. | .. |
|---|
| 313 | 313 | return ret; |
|---|
| 314 | 314 | } |
|---|
| 315 | 315 | |
|---|
| 316 | +/* In the Physical Function Driver Common Code, the ADVERT_MASK is used to |
|---|
| 317 | + * mask out bits in the Advertised Port Capabilities which are managed via |
|---|
| 318 | + * separate controls, like Pause Frames and Forward Error Correction. In the |
|---|
| 319 | + * Virtual Function Common Code, since we never perform L1 Configuration on |
|---|
| 320 | + * the Link, the only things we really need to filter out are things which |
|---|
| 321 | + * we decode and report separately like Speed. |
|---|
| 322 | + */ |
|---|
| 316 | 323 | #define ADVERT_MASK (FW_PORT_CAP32_SPEED_V(FW_PORT_CAP32_SPEED_M) | \ |
|---|
| 324 | + FW_PORT_CAP32_802_3_PAUSE | \ |
|---|
| 325 | + FW_PORT_CAP32_802_3_ASM_DIR | \ |
|---|
| 326 | + FW_PORT_CAP32_FEC_V(FW_PORT_CAP32_FEC_M) | \ |
|---|
| 317 | 327 | FW_PORT_CAP32_ANEG) |
|---|
| 318 | 328 | |
|---|
| 319 | 329 | /** |
|---|
| .. | .. |
|---|
| 379 | 389 | return cc_fec; |
|---|
| 380 | 390 | } |
|---|
| 381 | 391 | |
|---|
| 382 | | -/** |
|---|
| 383 | | - * Return the highest speed set in the port capabilities, in Mb/s. |
|---|
| 384 | | - */ |
|---|
| 392 | +/* Return the highest speed set in the port capabilities, in Mb/s. */ |
|---|
| 385 | 393 | static unsigned int fwcap_to_speed(fw_port_cap32_t caps) |
|---|
| 386 | 394 | { |
|---|
| 387 | 395 | #define TEST_SPEED_RETURN(__caps_speed, __speed) \ |
|---|
| .. | .. |
|---|
| 1457 | 1465 | * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change |
|---|
| 1458 | 1466 | * @vlanex: 1 to enable hardware VLAN Tag extraction, 0 to disable it, |
|---|
| 1459 | 1467 | * -1 no change |
|---|
| 1468 | + * @sleep_ok: call is allowed to sleep |
|---|
| 1460 | 1469 | * |
|---|
| 1461 | 1470 | * Sets Rx properties of a virtual interface. |
|---|
| 1462 | 1471 | */ |
|---|
| .. | .. |
|---|
| 1896 | 1905 | /** |
|---|
| 1897 | 1906 | * t4vf_handle_get_port_info - process a FW reply message |
|---|
| 1898 | 1907 | * @pi: the port info |
|---|
| 1899 | | - * @rpl: start of the FW message |
|---|
| 1908 | + * @cmd: start of the FW message |
|---|
| 1900 | 1909 | * |
|---|
| 1901 | 1910 | * Processes a GET_PORT_INFO FW reply message. |
|---|
| 1902 | 1911 | */ |
|---|
| 1903 | 1912 | static void t4vf_handle_get_port_info(struct port_info *pi, |
|---|
| 1904 | 1913 | const struct fw_port_cmd *cmd) |
|---|
| 1905 | 1914 | { |
|---|
| 1906 | | - int action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16)); |
|---|
| 1907 | | - struct adapter *adapter = pi->adapter; |
|---|
| 1908 | | - struct link_config *lc = &pi->link_cfg; |
|---|
| 1909 | | - int link_ok, linkdnrc; |
|---|
| 1910 | | - enum fw_port_type port_type; |
|---|
| 1911 | | - enum fw_port_module_type mod_type; |
|---|
| 1912 | | - unsigned int speed, fc, fec; |
|---|
| 1913 | 1915 | fw_port_cap32_t pcaps, acaps, lpacaps, linkattr; |
|---|
| 1916 | + struct link_config *lc = &pi->link_cfg; |
|---|
| 1917 | + struct adapter *adapter = pi->adapter; |
|---|
| 1918 | + unsigned int speed, fc, fec, adv_fc; |
|---|
| 1919 | + enum fw_port_module_type mod_type; |
|---|
| 1920 | + int action, link_ok, linkdnrc; |
|---|
| 1921 | + enum fw_port_type port_type; |
|---|
| 1914 | 1922 | |
|---|
| 1915 | 1923 | /* Extract the various fields from the Port Information message. */ |
|---|
| 1924 | + action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16)); |
|---|
| 1916 | 1925 | switch (action) { |
|---|
| 1917 | 1926 | case FW_PORT_ACTION_GET_PORT_INFO: { |
|---|
| 1918 | 1927 | u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype); |
|---|
| .. | .. |
|---|
| 1972 | 1981 | } |
|---|
| 1973 | 1982 | |
|---|
| 1974 | 1983 | fec = fwcap_to_cc_fec(acaps); |
|---|
| 1984 | + adv_fc = fwcap_to_cc_pause(acaps); |
|---|
| 1975 | 1985 | fc = fwcap_to_cc_pause(linkattr); |
|---|
| 1976 | 1986 | speed = fwcap_to_speed(linkattr); |
|---|
| 1977 | 1987 | |
|---|
| .. | .. |
|---|
| 2002 | 2012 | } |
|---|
| 2003 | 2013 | |
|---|
| 2004 | 2014 | if (link_ok != lc->link_ok || speed != lc->speed || |
|---|
| 2005 | | - fc != lc->fc || fec != lc->fec) { /* something changed */ |
|---|
| 2015 | + fc != lc->fc || adv_fc != lc->advertised_fc || |
|---|
| 2016 | + fec != lc->fec) { |
|---|
| 2017 | + /* something changed */ |
|---|
| 2006 | 2018 | if (!link_ok && lc->link_ok) { |
|---|
| 2007 | 2019 | lc->link_down_rc = linkdnrc; |
|---|
| 2008 | | - dev_warn(adapter->pdev_dev, "Port %d link down, reason: %s\n", |
|---|
| 2009 | | - pi->port_id, t4vf_link_down_rc_str(linkdnrc)); |
|---|
| 2020 | + dev_warn_ratelimited(adapter->pdev_dev, |
|---|
| 2021 | + "Port %d link down, reason: %s\n", |
|---|
| 2022 | + pi->port_id, |
|---|
| 2023 | + t4vf_link_down_rc_str(linkdnrc)); |
|---|
| 2010 | 2024 | } |
|---|
| 2011 | 2025 | lc->link_ok = link_ok; |
|---|
| 2012 | 2026 | lc->speed = speed; |
|---|
| 2027 | + lc->advertised_fc = adv_fc; |
|---|
| 2013 | 2028 | lc->fc = fc; |
|---|
| 2014 | 2029 | lc->fec = fec; |
|---|
| 2015 | 2030 | |
|---|
| .. | .. |
|---|
| 2121 | 2136 | return 0; |
|---|
| 2122 | 2137 | } |
|---|
| 2123 | 2138 | |
|---|
| 2124 | | -/** |
|---|
| 2125 | | - */ |
|---|
| 2126 | 2139 | int t4vf_prep_adapter(struct adapter *adapter) |
|---|
| 2127 | 2140 | { |
|---|
| 2128 | 2141 | int err; |
|---|
| .. | .. |
|---|
| 2174 | 2187 | * t4vf_get_vf_mac_acl - Get the MAC address to be set to |
|---|
| 2175 | 2188 | * the VI of this VF. |
|---|
| 2176 | 2189 | * @adapter: The adapter |
|---|
| 2177 | | - * @pf: The pf associated with vf |
|---|
| 2190 | + * @port: The port associated with vf |
|---|
| 2178 | 2191 | * @naddr: the number of ACL MAC addresses returned in addr |
|---|
| 2179 | 2192 | * @addr: Placeholder for MAC addresses |
|---|
| 2180 | 2193 | * |
|---|
| 2181 | 2194 | * Find the MAC address to be set to the VF's VI. The requested MAC address |
|---|
| 2182 | 2195 | * is from the host OS via callback in the PF driver. |
|---|
| 2183 | 2196 | */ |
|---|
| 2184 | | -int t4vf_get_vf_mac_acl(struct adapter *adapter, unsigned int pf, |
|---|
| 2197 | +int t4vf_get_vf_mac_acl(struct adapter *adapter, unsigned int port, |
|---|
| 2185 | 2198 | unsigned int *naddr, u8 *addr) |
|---|
| 2186 | 2199 | { |
|---|
| 2187 | 2200 | struct fw_acl_mac_cmd cmd; |
|---|
| .. | .. |
|---|
| 2199 | 2212 | if (cmd.nmac < *naddr) |
|---|
| 2200 | 2213 | *naddr = cmd.nmac; |
|---|
| 2201 | 2214 | |
|---|
| 2202 | | - switch (pf) { |
|---|
| 2215 | + switch (port) { |
|---|
| 2203 | 2216 | case 3: |
|---|
| 2204 | 2217 | memcpy(addr, cmd.macaddr3, sizeof(cmd.macaddr3)); |
|---|
| 2205 | 2218 | break; |
|---|