forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
....@@ -313,7 +313,17 @@
313313 return ret;
314314 }
315315
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
+ */
316323 #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) | \
317327 FW_PORT_CAP32_ANEG)
318328
319329 /**
....@@ -379,9 +389,7 @@
379389 return cc_fec;
380390 }
381391
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. */
385393 static unsigned int fwcap_to_speed(fw_port_cap32_t caps)
386394 {
387395 #define TEST_SPEED_RETURN(__caps_speed, __speed) \
....@@ -1457,6 +1465,7 @@
14571465 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change
14581466 * @vlanex: 1 to enable hardware VLAN Tag extraction, 0 to disable it,
14591467 * -1 no change
1468
+ * @sleep_ok: call is allowed to sleep
14601469 *
14611470 * Sets Rx properties of a virtual interface.
14621471 */
....@@ -1896,23 +1905,23 @@
18961905 /**
18971906 * t4vf_handle_get_port_info - process a FW reply message
18981907 * @pi: the port info
1899
- * @rpl: start of the FW message
1908
+ * @cmd: start of the FW message
19001909 *
19011910 * Processes a GET_PORT_INFO FW reply message.
19021911 */
19031912 static void t4vf_handle_get_port_info(struct port_info *pi,
19041913 const struct fw_port_cmd *cmd)
19051914 {
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;
19131915 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;
19141922
19151923 /* Extract the various fields from the Port Information message. */
1924
+ action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
19161925 switch (action) {
19171926 case FW_PORT_ACTION_GET_PORT_INFO: {
19181927 u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype);
....@@ -1972,6 +1981,7 @@
19721981 }
19731982
19741983 fec = fwcap_to_cc_fec(acaps);
1984
+ adv_fc = fwcap_to_cc_pause(acaps);
19751985 fc = fwcap_to_cc_pause(linkattr);
19761986 speed = fwcap_to_speed(linkattr);
19771987
....@@ -2002,14 +2012,19 @@
20022012 }
20032013
20042014 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 */
20062018 if (!link_ok && lc->link_ok) {
20072019 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));
20102024 }
20112025 lc->link_ok = link_ok;
20122026 lc->speed = speed;
2027
+ lc->advertised_fc = adv_fc;
20132028 lc->fc = fc;
20142029 lc->fec = fec;
20152030
....@@ -2121,8 +2136,6 @@
21212136 return 0;
21222137 }
21232138
2124
-/**
2125
- */
21262139 int t4vf_prep_adapter(struct adapter *adapter)
21272140 {
21282141 int err;
....@@ -2174,14 +2187,14 @@
21742187 * t4vf_get_vf_mac_acl - Get the MAC address to be set to
21752188 * the VI of this VF.
21762189 * @adapter: The adapter
2177
- * @pf: The pf associated with vf
2190
+ * @port: The port associated with vf
21782191 * @naddr: the number of ACL MAC addresses returned in addr
21792192 * @addr: Placeholder for MAC addresses
21802193 *
21812194 * Find the MAC address to be set to the VF's VI. The requested MAC address
21822195 * is from the host OS via callback in the PF driver.
21832196 */
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,
21852198 unsigned int *naddr, u8 *addr)
21862199 {
21872200 struct fw_acl_mac_cmd cmd;
....@@ -2199,7 +2212,7 @@
21992212 if (cmd.nmac < *naddr)
22002213 *naddr = cmd.nmac;
22012214
2202
- switch (pf) {
2215
+ switch (port) {
22032216 case 3:
22042217 memcpy(addr, cmd.macaddr3, sizeof(cmd.macaddr3));
22052218 break;