CC: [email protected] CC: [email protected] TO: Vladimir Oltean <[email protected]> CC: Russell King <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4d41ead6ead97c3730bbd186a601a64828668f01 commit: ffe10e679cec9a99f19049459cb27c2fbb1e913a net: dsa: sja1105: Add support for the SGMII port date: 5 months ago :::::: branch date: 9 hours ago :::::: commit date: 5 months ago config: arm-randconfig-m031-20200829 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> New smatch warnings: drivers/net/dsa/sja1105/sja1105_main.c:1608 sja1105_static_config_reload() warn: bitwise AND condition is false here Old smatch warnings: drivers/net/dsa/sja1105/sja1105_main.c:44 sja1105_port_allow_traffic() warn: should '(((1))) << to' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:45 sja1105_port_allow_traffic() warn: should '(((1))) << to' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:46 sja1105_port_allow_traffic() warn: should '(((1))) << to' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:186 sja1105_init_mii_settings() warn: is 'table->entries' large enough for 'struct sja1105_xmii_params_entry'? 1 drivers/net/dsa/sja1105/sja1105_main.c:189 sja1105_init_mii_settings() warn: is 'table->entries' large enough for 'struct sja1105_xmii_params_entry'? 1 drivers/net/dsa/sja1105/sja1105_main.c:195 sja1105_init_mii_settings() warn: is 'table->entries' large enough for 'struct sja1105_xmii_params_entry'? 1 drivers/net/dsa/sja1105/sja1105_main.c:200 sja1105_init_mii_settings() warn: is 'table->entries' large enough for 'struct sja1105_xmii_params_entry'? 1 drivers/net/dsa/sja1105/sja1105_main.c:1013 sja1105_find_static_fdb_entry() warn: should '((((1))) << port)' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1131 sja1105et_fdb_add() warn: should '((((1))) << port)' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1133 sja1105et_fdb_add() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1141 sja1105et_fdb_add() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1227 sja1105pqrs_fdb_add() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1235 sja1105pqrs_fdb_add() warn: should '((((1))) << port)' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1240 sja1105pqrs_fdb_add() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1290 sja1105pqrs_fdb_del() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1374 sja1105_fdb_dump() warn: should '((((1))) << port)' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1672 sja1105_vlan_apply() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1673 sja1105_vlan_apply() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1684 sja1105_vlan_apply() warn: should '(((1))) << port' be a 64 bit type? drivers/net/dsa/sja1105/sja1105_main.c:1981 sja1105_mgmt_xmit() warn: should '(((1))) << port' be a 64 bit type? # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe10e679cec9a99f19049459cb27c2fbb1e913a git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout ffe10e679cec9a99f19049459cb27c2fbb1e913a vim +1608 drivers/net/dsa/sja1105/sja1105_main.c 2eea1fa82f681b Vladimir Oltean 2019-11-12 1508 6666cebc5e306f Vladimir Oltean 2019-05-02 1509 /* For situations where we need to change a setting at runtime that is only 6666cebc5e306f Vladimir Oltean 2019-05-02 1510 * available through the static configuration, resetting the switch in order 6666cebc5e306f Vladimir Oltean 2019-05-02 1511 * to upload the new static config is unavoidable. Back up the settings we 6666cebc5e306f Vladimir Oltean 2019-05-02 1512 * modify at runtime (currently only MAC) and restore them after uploading, 6666cebc5e306f Vladimir Oltean 2019-05-02 1513 * such that this operation is relatively seamless. 6666cebc5e306f Vladimir Oltean 2019-05-02 1514 */ 2eea1fa82f681b Vladimir Oltean 2019-11-12 1515 int sja1105_static_config_reload(struct sja1105_private *priv, 2eea1fa82f681b Vladimir Oltean 2019-11-12 1516 enum sja1105_reset_reason reason) 6666cebc5e306f Vladimir Oltean 2019-05-02 1517 { 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1518 struct ptp_system_timestamp ptp_sts_before; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1519 struct ptp_system_timestamp ptp_sts_after; 6666cebc5e306f Vladimir Oltean 2019-05-02 1520 struct sja1105_mac_config_entry *mac; 6666cebc5e306f Vladimir Oltean 2019-05-02 1521 int speed_mbps[SJA1105_NUM_PORTS]; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1522 struct dsa_switch *ds = priv->ds; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1523 s64 t1, t2, t3, t4; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1524 s64 t12, t34; ffe10e679cec9a Vladimir Oltean 2020-03-20 1525 u16 bmcr = 0; 6666cebc5e306f Vladimir Oltean 2019-05-02 1526 int rc, i; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1527 s64 now; 6666cebc5e306f Vladimir Oltean 2019-05-02 1528 af580ae2dcb250 Vladimir Oltean 2019-11-09 1529 mutex_lock(&priv->mgmt_lock); af580ae2dcb250 Vladimir Oltean 2019-11-09 1530 6666cebc5e306f Vladimir Oltean 2019-05-02 1531 mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries; 6666cebc5e306f Vladimir Oltean 2019-05-02 1532 8400cff60b472c Vladimir Oltean 2019-06-08 1533 /* Back up the dynamic link speed changed by sja1105_adjust_port_config 8400cff60b472c Vladimir Oltean 2019-06-08 1534 * in order to temporarily restore it to SJA1105_SPEED_AUTO - which the 8400cff60b472c Vladimir Oltean 2019-06-08 1535 * switch wants to see in the static config in order to allow us to 8400cff60b472c Vladimir Oltean 2019-06-08 1536 * change it through the dynamic interface later. 6666cebc5e306f Vladimir Oltean 2019-05-02 1537 */ 6666cebc5e306f Vladimir Oltean 2019-05-02 1538 for (i = 0; i < SJA1105_NUM_PORTS; i++) { 6666cebc5e306f Vladimir Oltean 2019-05-02 1539 speed_mbps[i] = sja1105_speed[mac[i].speed]; 6666cebc5e306f Vladimir Oltean 2019-05-02 1540 mac[i].speed = SJA1105_SPEED_AUTO; 6666cebc5e306f Vladimir Oltean 2019-05-02 1541 } 6666cebc5e306f Vladimir Oltean 2019-05-02 1542 ffe10e679cec9a Vladimir Oltean 2020-03-20 1543 if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) ffe10e679cec9a Vladimir Oltean 2020-03-20 1544 bmcr = sja1105_sgmii_read(priv, MII_BMCR); ffe10e679cec9a Vladimir Oltean 2020-03-20 1545 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1546 /* No PTP operations can run right now */ 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1547 mutex_lock(&priv->ptp_data.lock); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1548 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1549 rc = __sja1105_ptp_gettimex(ds, &now, &ptp_sts_before); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1550 if (rc < 0) 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1551 goto out_unlock_ptp; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1552 6666cebc5e306f Vladimir Oltean 2019-05-02 1553 /* Reset switch and send updated static configuration */ 6666cebc5e306f Vladimir Oltean 2019-05-02 1554 rc = sja1105_static_config_upload(priv); 6666cebc5e306f Vladimir Oltean 2019-05-02 1555 if (rc < 0) 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1556 goto out_unlock_ptp; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1557 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1558 rc = __sja1105_ptp_settime(ds, 0, &ptp_sts_after); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1559 if (rc < 0) 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1560 goto out_unlock_ptp; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1561 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1562 t1 = timespec64_to_ns(&ptp_sts_before.pre_ts); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1563 t2 = timespec64_to_ns(&ptp_sts_before.post_ts); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1564 t3 = timespec64_to_ns(&ptp_sts_after.pre_ts); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1565 t4 = timespec64_to_ns(&ptp_sts_after.post_ts); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1566 /* Mid point, corresponds to pre-reset PTPCLKVAL */ 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1567 t12 = t1 + (t2 - t1) / 2; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1568 /* Mid point, corresponds to post-reset PTPCLKVAL, aka 0 */ 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1569 t34 = t3 + (t4 - t3) / 2; 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1570 /* Advance PTPCLKVAL by the time it took since its readout */ 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1571 now += (t34 - t12); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1572 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1573 __sja1105_ptp_adjtime(ds, now); 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1574 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1575 out_unlock_ptp: 6cf99c13ea07b5 Vladimir Oltean 2019-11-09 1576 mutex_unlock(&priv->ptp_data.lock); 6666cebc5e306f Vladimir Oltean 2019-05-02 1577 2eea1fa82f681b Vladimir Oltean 2019-11-12 1578 dev_info(priv->ds->dev, 2eea1fa82f681b Vladimir Oltean 2019-11-12 1579 "Reset switch and programmed static config. Reason: %s\n", 2eea1fa82f681b Vladimir Oltean 2019-11-12 1580 sja1105_reset_reasons[reason]); 2eea1fa82f681b Vladimir Oltean 2019-11-12 1581 6666cebc5e306f Vladimir Oltean 2019-05-02 1582 /* Configure the CGU (PLLs) for MII and RMII PHYs. 6666cebc5e306f Vladimir Oltean 2019-05-02 1583 * For these interfaces there is no dynamic configuration 6666cebc5e306f Vladimir Oltean 2019-05-02 1584 * needed, since PLLs have same settings at all speeds. 6666cebc5e306f Vladimir Oltean 2019-05-02 1585 */ 6666cebc5e306f Vladimir Oltean 2019-05-02 1586 rc = sja1105_clocking_setup(priv); 6666cebc5e306f Vladimir Oltean 2019-05-02 1587 if (rc < 0) 6666cebc5e306f Vladimir Oltean 2019-05-02 1588 goto out; 6666cebc5e306f Vladimir Oltean 2019-05-02 1589 6666cebc5e306f Vladimir Oltean 2019-05-02 1590 for (i = 0; i < SJA1105_NUM_PORTS; i++) { 8400cff60b472c Vladimir Oltean 2019-06-08 1591 rc = sja1105_adjust_port_config(priv, i, speed_mbps[i]); 6666cebc5e306f Vladimir Oltean 2019-05-02 1592 if (rc < 0) 6666cebc5e306f Vladimir Oltean 2019-05-02 1593 goto out; 6666cebc5e306f Vladimir Oltean 2019-05-02 1594 } ffe10e679cec9a Vladimir Oltean 2020-03-20 1595 ffe10e679cec9a Vladimir Oltean 2020-03-20 1596 if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) { ffe10e679cec9a Vladimir Oltean 2020-03-20 1597 bool an_enabled = !!(bmcr & BMCR_ANENABLE); ffe10e679cec9a Vladimir Oltean 2020-03-20 1598 ffe10e679cec9a Vladimir Oltean 2020-03-20 1599 sja1105_sgmii_pcs_config(priv, an_enabled, false); ffe10e679cec9a Vladimir Oltean 2020-03-20 1600 ffe10e679cec9a Vladimir Oltean 2020-03-20 1601 if (!an_enabled) { ffe10e679cec9a Vladimir Oltean 2020-03-20 1602 int speed = SPEED_UNKNOWN; ffe10e679cec9a Vladimir Oltean 2020-03-20 1603 ffe10e679cec9a Vladimir Oltean 2020-03-20 1604 if (bmcr & BMCR_SPEED1000) ffe10e679cec9a Vladimir Oltean 2020-03-20 1605 speed = SPEED_1000; ffe10e679cec9a Vladimir Oltean 2020-03-20 1606 else if (bmcr & BMCR_SPEED100) ffe10e679cec9a Vladimir Oltean 2020-03-20 1607 speed = SPEED_100; ffe10e679cec9a Vladimir Oltean 2020-03-20 @1608 else if (bmcr & BMCR_SPEED10) ffe10e679cec9a Vladimir Oltean 2020-03-20 1609 speed = SPEED_10; ffe10e679cec9a Vladimir Oltean 2020-03-20 1610 ffe10e679cec9a Vladimir Oltean 2020-03-20 1611 sja1105_sgmii_pcs_force_speed(priv, speed); ffe10e679cec9a Vladimir Oltean 2020-03-20 1612 } ffe10e679cec9a Vladimir Oltean 2020-03-20 1613 } 6666cebc5e306f Vladimir Oltean 2019-05-02 1614 out: af580ae2dcb250 Vladimir Oltean 2019-11-09 1615 mutex_unlock(&priv->mgmt_lock); af580ae2dcb250 Vladimir Oltean 2019-11-09 1616 6666cebc5e306f Vladimir Oltean 2019-05-02 1617 return rc; 6666cebc5e306f Vladimir Oltean 2019-05-02 1618 } 6666cebc5e306f Vladimir Oltean 2019-05-02 1619 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
