diff options
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/ethtool.c')
| -rw-r--r-- | drivers/net/wireless/ath/wil6210/ethtool.c | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/wil6210/ethtool.c b/drivers/net/wireless/ath/wil6210/ethtool.c index d686638972be..4c44a82c34d7 100644 --- a/drivers/net/wireless/ath/wil6210/ethtool.c +++ b/drivers/net/wireless/ath/wil6210/ethtool.c | |||
| @@ -45,16 +45,35 @@ static int wil_ethtoolops_get_coalesce(struct net_device *ndev, | |||
| 45 | struct ethtool_coalesce *cp) | 45 | struct ethtool_coalesce *cp) |
| 46 | { | 46 | { |
| 47 | struct wil6210_priv *wil = ndev_to_wil(ndev); | 47 | struct wil6210_priv *wil = ndev_to_wil(ndev); |
| 48 | u32 itr_en, itr_val = 0; | 48 | u32 tx_itr_en, tx_itr_val = 0; |
| 49 | u32 rx_itr_en, rx_itr_val = 0; | ||
| 49 | 50 | ||
| 50 | wil_dbg_misc(wil, "%s()\n", __func__); | 51 | wil_dbg_misc(wil, "%s()\n", __func__); |
| 51 | 52 | ||
| 52 | itr_en = ioread32(wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_CRL)); | 53 | if (test_bit(hw_capability_advanced_itr_moderation, |
| 53 | if (itr_en & BIT_DMA_ITR_CNT_CRL_EN) | 54 | wil->hw_capabilities)) { |
| 54 | itr_val = ioread32(wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_TRSH)); | 55 | tx_itr_en = ioread32(wil->csr + |
| 55 | 56 | HOSTADDR(RGF_DMA_ITR_TX_CNT_CTL)); | |
| 56 | cp->rx_coalesce_usecs = itr_val; | 57 | if (tx_itr_en & BIT_DMA_ITR_TX_CNT_CTL_EN) |
| 58 | tx_itr_val = | ||
| 59 | ioread32(wil->csr + | ||
| 60 | HOSTADDR(RGF_DMA_ITR_TX_CNT_TRSH)); | ||
| 61 | |||
| 62 | rx_itr_en = ioread32(wil->csr + | ||
| 63 | HOSTADDR(RGF_DMA_ITR_RX_CNT_CTL)); | ||
| 64 | if (rx_itr_en & BIT_DMA_ITR_RX_CNT_CTL_EN) | ||
| 65 | rx_itr_val = | ||
| 66 | ioread32(wil->csr + | ||
| 67 | HOSTADDR(RGF_DMA_ITR_RX_CNT_TRSH)); | ||
| 68 | } else { | ||
| 69 | rx_itr_en = ioread32(wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_CRL)); | ||
| 70 | if (rx_itr_en & BIT_DMA_ITR_CNT_CRL_EN) | ||
| 71 | rx_itr_val = ioread32(wil->csr + | ||
| 72 | HOSTADDR(RGF_DMA_ITR_CNT_TRSH)); | ||
| 73 | } | ||
| 57 | 74 | ||
| 75 | cp->tx_coalesce_usecs = tx_itr_val; | ||
| 76 | cp->rx_coalesce_usecs = rx_itr_val; | ||
| 58 | return 0; | 77 | return 0; |
| 59 | } | 78 | } |
| 60 | 79 | ||
| @@ -63,22 +82,25 @@ static int wil_ethtoolops_set_coalesce(struct net_device *ndev, | |||
| 63 | { | 82 | { |
| 64 | struct wil6210_priv *wil = ndev_to_wil(ndev); | 83 | struct wil6210_priv *wil = ndev_to_wil(ndev); |
| 65 | 84 | ||
| 66 | wil_dbg_misc(wil, "%s(%d usec)\n", __func__, cp->rx_coalesce_usecs); | 85 | wil_dbg_misc(wil, "%s(rx %d usec, tx %d usec)\n", __func__, |
| 86 | cp->rx_coalesce_usecs, cp->tx_coalesce_usecs); | ||
| 67 | 87 | ||
| 68 | if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { | 88 | if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { |
| 69 | wil_dbg_misc(wil, "No IRQ coalescing in monitor mode\n"); | 89 | wil_dbg_misc(wil, "No IRQ coalescing in monitor mode\n"); |
| 70 | return -EINVAL; | 90 | return -EINVAL; |
| 71 | } | 91 | } |
| 72 | 92 | ||
| 73 | /* only @rx_coalesce_usecs supported, ignore | 93 | /* only @rx_coalesce_usecs and @tx_coalesce_usecs supported, |
| 74 | * other parameters | 94 | * ignore other parameters |
| 75 | */ | 95 | */ |
| 76 | 96 | ||
| 77 | if (cp->rx_coalesce_usecs > WIL6210_ITR_TRSH_MAX) | 97 | if (cp->rx_coalesce_usecs > WIL6210_ITR_TRSH_MAX || |
| 98 | cp->tx_coalesce_usecs > WIL6210_ITR_TRSH_MAX) | ||
| 78 | goto out_bad; | 99 | goto out_bad; |
| 79 | 100 | ||
| 80 | wil->itr_trsh = cp->rx_coalesce_usecs; | 101 | wil->tx_max_burst_duration = cp->tx_coalesce_usecs; |
| 81 | wil_set_itr_trsh(wil); | 102 | wil->rx_max_burst_duration = cp->rx_coalesce_usecs; |
| 103 | wil_configure_interrupt_moderation(wil); | ||
| 82 | 104 | ||
| 83 | return 0; | 105 | return 0; |
| 84 | 106 | ||
