Merge branch 'hns-fixes'
Yisen Zhuang says: ==================== net: hns: fix some bugs in HNS driver Here are some bug fixed patches for HNS driver. They are: >from Kejian, fix for the warning of passing zero to 'PTR_ERR' >from qianqian, four fixes for inappropriate operation in hns driver >from Sheng, one fix for optimization of irq proccess in hns driver, and one fix for hilink status for hns driver. For more details, please see individual patches. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
7629d9c1a2
@ -664,7 +664,8 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_gmac_stats_string); i++) {
|
||||
snprintf(buff, ETH_GSTRING_LEN, g_gmac_stats_string[i].desc);
|
||||
snprintf(buff, ETH_GSTRING_LEN, "%s",
|
||||
g_gmac_stats_string[i].desc);
|
||||
buff = buff + ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
|
@ -2219,17 +2219,17 @@ void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data)
|
||||
/* dsaf onode registers */
|
||||
for (i = 0; i < DSAF_XOD_NUM; i++) {
|
||||
p[311 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_TSA_TC0_TC3_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_TSA_TC0_TC3_CFG_0_REG + i * 0x90);
|
||||
p[319 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_TSA_TC4_TC7_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_TSA_TC4_TC7_CFG_0_REG + i * 0x90);
|
||||
p[327 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_BW_TC0_TC3_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_BW_TC0_TC3_CFG_0_REG + i * 0x90);
|
||||
p[335 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_BW_TC4_TC7_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_BW_TC4_TC7_CFG_0_REG + i * 0x90);
|
||||
p[343 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_BW_OFFSET_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_BW_OFFSET_CFG_0_REG + i * 0x90);
|
||||
p[351 + i] = dsaf_read_dev(ddev,
|
||||
DSAF_XOD_ETS_TOKEN_CFG_0_REG + j * 0x90);
|
||||
DSAF_XOD_ETS_TOKEN_CFG_0_REG + i * 0x90);
|
||||
}
|
||||
|
||||
p[359] = dsaf_read_dev(ddev, DSAF_XOD_PFS_CFG_0_0_REG + port * 0x90);
|
||||
|
@ -244,31 +244,35 @@ void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val)
|
||||
*/
|
||||
phy_interface_t hns_mac_get_phy_if(struct hns_mac_cb *mac_cb)
|
||||
{
|
||||
u32 hilink3_mode;
|
||||
u32 hilink4_mode;
|
||||
u32 mode;
|
||||
u32 reg;
|
||||
u32 shift;
|
||||
bool is_ver1 = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver);
|
||||
void __iomem *sys_ctl_vaddr = mac_cb->sys_ctl_vaddr;
|
||||
int dev_id = mac_cb->mac_id;
|
||||
int mac_id = mac_cb->mac_id;
|
||||
phy_interface_t phy_if = PHY_INTERFACE_MODE_NA;
|
||||
|
||||
hilink3_mode = dsaf_read_reg(sys_ctl_vaddr, HNS_MAC_HILINK3_REG);
|
||||
hilink4_mode = dsaf_read_reg(sys_ctl_vaddr, HNS_MAC_HILINK4_REG);
|
||||
if (dev_id >= 0 && dev_id <= 3) {
|
||||
if (hilink4_mode == 0)
|
||||
phy_if = PHY_INTERFACE_MODE_SGMII;
|
||||
else
|
||||
phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
} else if (dev_id >= 4 && dev_id <= 5) {
|
||||
if (hilink3_mode == 0)
|
||||
phy_if = PHY_INTERFACE_MODE_SGMII;
|
||||
else
|
||||
phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
} else {
|
||||
if (is_ver1 && (mac_id >= 6 && mac_id <= 7)) {
|
||||
phy_if = PHY_INTERFACE_MODE_SGMII;
|
||||
} else if (mac_id >= 0 && mac_id <= 3) {
|
||||
reg = is_ver1 ? HNS_MAC_HILINK4_REG : HNS_MAC_HILINK4V2_REG;
|
||||
mode = dsaf_read_reg(sys_ctl_vaddr, reg);
|
||||
/* mac_id 0, 1, 2, 3 ---> hilink4 lane 0, 1, 2, 3 */
|
||||
shift = is_ver1 ? 0 : mac_id;
|
||||
if (dsaf_get_bit(mode, shift))
|
||||
phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
else
|
||||
phy_if = PHY_INTERFACE_MODE_SGMII;
|
||||
} else if (mac_id >= 4 && mac_id <= 7) {
|
||||
reg = is_ver1 ? HNS_MAC_HILINK3_REG : HNS_MAC_HILINK3V2_REG;
|
||||
mode = dsaf_read_reg(sys_ctl_vaddr, reg);
|
||||
/* mac_id 4, 5, 6, 7 ---> hilink3 lane 2, 3, 0, 1 */
|
||||
shift = is_ver1 ? 0 : mac_id <= 5 ? mac_id - 2 : mac_id - 6;
|
||||
if (dsaf_get_bit(mode, shift))
|
||||
phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
else
|
||||
phy_if = PHY_INTERFACE_MODE_SGMII;
|
||||
}
|
||||
|
||||
dev_dbg(mac_cb->dev,
|
||||
"hilink3_mode=%d, hilink4_mode=%d dev_id=%d, phy_if=%d\n",
|
||||
hilink3_mode, hilink4_mode, dev_id, phy_if);
|
||||
return phy_if;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,8 @@
|
||||
/*serdes offset**/
|
||||
#define HNS_MAC_HILINK3_REG DSAF_SUB_SC_HILINK3_CRG_CTRL0_REG
|
||||
#define HNS_MAC_HILINK4_REG DSAF_SUB_SC_HILINK4_CRG_CTRL0_REG
|
||||
#define HNS_MAC_HILINK3V2_REG DSAF_SUB_SC_HILINK3_CRG_CTRL1_REG
|
||||
#define HNS_MAC_HILINK4V2_REG DSAF_SUB_SC_HILINK4_CRG_CTRL1_REG
|
||||
#define HNS_MAC_LANE0_CTLEDFE_REG 0x000BFFCCULL
|
||||
#define HNS_MAC_LANE1_CTLEDFE_REG 0x000BFFBCULL
|
||||
#define HNS_MAC_LANE2_CTLEDFE_REG 0x000BFFACULL
|
||||
|
@ -913,10 +913,7 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data,
|
||||
static void hns_nic_tx_fini_pro(struct hns_nic_ring_data *ring_data)
|
||||
{
|
||||
struct hnae_ring *ring = ring_data->ring;
|
||||
int head = ring->next_to_clean;
|
||||
|
||||
/* for hardware bug fixed */
|
||||
head = readl_relaxed(ring->io_base + RCB_REG_HEAD);
|
||||
int head = readl_relaxed(ring->io_base + RCB_REG_HEAD);
|
||||
|
||||
if (head != ring->next_to_clean) {
|
||||
ring_data->ring->q->handle->dev->ops->toggle_ring_irq(
|
||||
@ -959,8 +956,8 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget)
|
||||
napi_complete(napi);
|
||||
ring_data->ring->q->handle->dev->ops->toggle_ring_irq(
|
||||
ring_data->ring, 0);
|
||||
|
||||
ring_data->fini_process(ring_data);
|
||||
if (ring_data->fini_process)
|
||||
ring_data->fini_process(ring_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1723,6 +1720,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
|
||||
{
|
||||
struct hnae_handle *h = priv->ae_handle;
|
||||
struct hns_nic_ring_data *rd;
|
||||
bool is_ver1 = AE_IS_VER1(priv->enet_ver);
|
||||
int i;
|
||||
|
||||
if (h->q_num > NIC_MAX_Q_PER_VF) {
|
||||
@ -1740,7 +1738,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
|
||||
rd->queue_index = i;
|
||||
rd->ring = &h->qs[i]->tx_ring;
|
||||
rd->poll_one = hns_nic_tx_poll_one;
|
||||
rd->fini_process = hns_nic_tx_fini_pro;
|
||||
rd->fini_process = is_ver1 ? hns_nic_tx_fini_pro : NULL;
|
||||
|
||||
netif_napi_add(priv->netdev, &rd->napi,
|
||||
hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM);
|
||||
@ -1752,7 +1750,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
|
||||
rd->ring = &h->qs[i - h->q_num]->rx_ring;
|
||||
rd->poll_one = hns_nic_rx_poll_one;
|
||||
rd->ex_process = hns_nic_rx_up_pro;
|
||||
rd->fini_process = hns_nic_rx_fini_pro;
|
||||
rd->fini_process = is_ver1 ? hns_nic_rx_fini_pro : NULL;
|
||||
|
||||
netif_napi_add(priv->netdev, &rd->napi,
|
||||
hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM);
|
||||
@ -1816,7 +1814,7 @@ static int hns_nic_try_get_ae(struct net_device *ndev)
|
||||
h = hnae_get_handle(&priv->netdev->dev,
|
||||
priv->ae_node, priv->port_id, NULL);
|
||||
if (IS_ERR_OR_NULL(h)) {
|
||||
ret = PTR_ERR(h);
|
||||
ret = -ENODEV;
|
||||
dev_dbg(priv->dev, "has not handle, register notifier!\n");
|
||||
goto out;
|
||||
}
|
||||
|
@ -1013,8 +1013,8 @@ int hns_phy_led_set(struct net_device *netdev, int value)
|
||||
struct phy_device *phy_dev = priv->phy;
|
||||
|
||||
retval = phy_write(phy_dev, HNS_PHY_PAGE_REG, HNS_PHY_PAGE_LED);
|
||||
retval = phy_write(phy_dev, HNS_LED_FC_REG, value);
|
||||
retval = phy_write(phy_dev, HNS_PHY_PAGE_REG, HNS_PHY_PAGE_COPPER);
|
||||
retval |= phy_write(phy_dev, HNS_LED_FC_REG, value);
|
||||
retval |= phy_write(phy_dev, HNS_PHY_PAGE_REG, HNS_PHY_PAGE_COPPER);
|
||||
if (retval) {
|
||||
netdev_err(netdev, "mdiobus_write fail !\n");
|
||||
return retval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user