diff options
Diffstat (limited to 'drivers/net/ethernet/cavium/thunder')
5 files changed, 39 insertions, 41 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c index 5e0b16bb95a0..61c4fcdf7e25 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c @@ -514,25 +514,42 @@ static int nicvf_set_ringparam(struct net_device *netdev, static int nicvf_get_rss_hash_opts(struct nicvf *nic, struct ethtool_rxnfc *info) { + u64 rss_cfg = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); + info->data = 0; + if (!(rss_cfg & BIT_ULL(RSS_HASH_IP))) + return 0; + + info->data = RXH_IP_SRC | RXH_IP_DST; + switch (info->flow_type) { case TCP_V4_FLOW: case TCP_V6_FLOW: + if (rss_cfg & BIT_ULL(RSS_HASH_TCP)) + info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; + break; case UDP_V4_FLOW: case UDP_V6_FLOW: + if (rss_cfg & BIT_ULL(RSS_HASH_UDP)) + info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; + break; case SCTP_V4_FLOW: case SCTP_V6_FLOW: info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; /* Fall through */ + case AH_ESP_V4_FLOW: + case AH_V4_FLOW: + case ESP_V4_FLOW: case IPV4_FLOW: + case AH_ESP_V6_FLOW: + case AH_V6_FLOW: + case ESP_V6_FLOW: case IPV6_FLOW: - info->data |= RXH_IP_SRC | RXH_IP_DST; break; default: return -EINVAL; } - return 0; } @@ -598,19 +615,6 @@ static int nicvf_set_rss_hash_opts(struct nicvf *nic, return -EINVAL; } break; - case SCTP_V4_FLOW: - case SCTP_V6_FLOW: - switch (info->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { - case 0: - rss_cfg &= ~(1ULL << RSS_HASH_L4ETC); - break; - case (RXH_L4_B_0_1 | RXH_L4_B_2_3): - rss_cfg |= (1ULL << RSS_HASH_L4ETC); - break; - default: - return -EINVAL; - } - break; case IPV4_FLOW: case IPV6_FLOW: rss_cfg = RSS_HASH_IP; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 40a44dcb3d9b..48757afeb34e 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -126,8 +126,7 @@ static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx) int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) { - int timeout = NIC_MBOX_MSG_TIMEOUT; - int sleep = 10; + unsigned long timeout; int ret = 0; mutex_lock(&nic->rx_mode_mtx); @@ -137,6 +136,7 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) nicvf_write_to_mbx(nic, mbx); + timeout = jiffies + msecs_to_jiffies(NIC_MBOX_MSG_TIMEOUT); /* Wait for previous message to be acked, timeout 2sec */ while (!nic->pf_acked) { if (nic->pf_nacked) { @@ -146,11 +146,10 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) ret = -EINVAL; break; } - msleep(sleep); + usleep_range(8000, 10000); if (nic->pf_acked) break; - timeout -= sleep; - if (!timeout) { + if (time_after(jiffies, timeout)) { netdev_err(nic->netdev, "PF didn't ACK to mbox msg 0x%02x from VF%d\n", (mbx->msg.msg & 0xFF), nic->vf_id); diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 192bc92da881..0d9c2ca25f35 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -369,7 +369,7 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) } head++; } - + kfree(rbdr->pgcache); /* Free RBDR ring */ nicvf_free_q_desc_mem(nic, &rbdr->dmem); } diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h index bc2427c49b89..2460451fc48f 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h @@ -100,8 +100,8 @@ * RED accepts pkt if unused CQE < 2304 & >= 2560 * DROPs pkts if unused CQE < 2304 */ -#define RQ_PASS_CQ_LVL 192ULL -#define RQ_DROP_CQ_LVL 184ULL +#define RQ_PASS_CQ_LVL 224ULL +#define RQ_DROP_CQ_LVL 216ULL /* RED and Backpressure levels of RBDR for pkt reception * For RBDR, level is a measure of fullness i.e 0x0 means empty diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index ad22554857bf..431234a2a390 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -80,6 +80,7 @@ static struct bgx *bgx_vnic[MAX_BGX_THUNDER]; static int lmac_count; /* Total no of LMACs in system */ static int bgx_xaui_check_link(struct lmac *lmac); +static int bgx_lmac_sgmii_init(struct bgx *bgx, struct lmac *lmac); /* Supported devices */ static const struct pci_device_id bgx_id_table[] = { @@ -570,6 +571,14 @@ static void bgx_sgmii_change_link_state(struct lmac *lmac) } bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_PCS_MISCX_CTL, misc_ctl); bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_PRTX_CFG, port_cfg); + if (!bgx->is_rgx) { + bgx_reg_modify(bgx, lmac->lmacid, BGX_GMP_PCS_MRX_CTL, + PCS_MRX_CTL_RESET); + if (bgx_poll_reg(bgx, lmac->lmacid, BGX_GMP_PCS_MRX_CTL, + PCS_MRX_CTL_RESET, true)) { + dev_err(&bgx->pdev->dev, "BGX PCS reset not completed\n"); + } + } /* Restore CMR config settings */ cmr_cfg |= (rx_en ? CMR_PKT_RX_EN : 0) | (tx_en ? CMR_PKT_TX_EN : 0); @@ -583,35 +592,21 @@ static void bgx_lmac_handler(struct net_device *netdev) { struct lmac *lmac = container_of(netdev, struct lmac, netdev); struct phy_device *phydev; - int link_changed = 0; if (!lmac) return; phydev = lmac->phydev; - if (!phydev->link && lmac->last_link) - link_changed = -1; - - if (phydev->link && - (lmac->last_duplex != phydev->duplex || - lmac->last_link != phydev->link || - lmac->last_speed != phydev->speed)) { - link_changed = 1; - } + if (phydev->link == 1) + lmac->link_up = true; + else + lmac->link_up = false; lmac->last_link = phydev->link; lmac->last_speed = phydev->speed; lmac->last_duplex = phydev->duplex; - if (!link_changed) - return; - - if (link_changed > 0) - lmac->link_up = true; - else - lmac->link_up = false; - if (lmac->is_sgmii) bgx_sgmii_change_link_state(lmac); else |