static int wil_ethtoolops_get_coalesce(struct net_device *ndev, struct ethtool_coalesce *cp) { struct wil6210_priv *wil = ndev_to_wil(ndev); u32 tx_itr_en, tx_itr_val = 0; u32 rx_itr_en, rx_itr_val = 0; int ret; wil_dbg_misc(wil, "ethtoolops_get_coalesce\n"); ret = wil_pm_runtime_get(wil); if (ret < 0) return ret; tx_itr_en = wil_r(wil, RGF_DMA_ITR_TX_CNT_CTL); if (tx_itr_en & BIT_DMA_ITR_TX_CNT_CTL_EN) tx_itr_val = wil_r(wil, RGF_DMA_ITR_TX_CNT_TRSH); rx_itr_en = wil_r(wil, RGF_DMA_ITR_RX_CNT_CTL); if (rx_itr_en & BIT_DMA_ITR_RX_CNT_CTL_EN) rx_itr_val = wil_r(wil, RGF_DMA_ITR_RX_CNT_TRSH); wil_pm_runtime_put(wil); cp->tx_coalesce_usecs = tx_itr_val; cp->rx_coalesce_usecs = rx_itr_val; return 0; }
static int wil_stop(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); wil_dbg_misc(wil, "%s()\n", __func__); return wil_down(wil); }
static void wil_ethtoolops_complete(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); wil_dbg_misc(wil, "ethtoolops_complete\n"); mutex_unlock(&wil->mutex); }
static int wil_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) { struct wil6210_priv *wil = ndev_to_wil(ndev); int ret = wil_ioctl(wil, ifr->ifr_data, cmd); wil_dbg_misc(wil, "ioctl(0x%04x) -> %d\n", cmd, ret); return ret; }
static int wil_ethtoolops_begin(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); mutex_lock(&wil->mutex); wil_dbg_misc(wil, "ethtoolops_begin\n"); return 0; }
static int wil_open(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); wil_dbg_misc(wil, "%s()\n", __func__); if (debug_fw) { wil_err(wil, "%s() while in debug_fw mode\n", __func__); return -EINVAL; } return wil_up(wil); }
static int wil_set_features(struct net_device *netdev, netdev_features_t features) { struct wil6210_priv *wil = ndev_to_wil(netdev); netdev_features_t changed = features ^ netdev->features; wil_info(wil, "wil_set_features: %x\n", (unsigned int)features); if (changed & NETIF_F_HW_CSUM) wil_dbg_txrx(wil, "Tx checksum offloading changed\n"); else if (changed & NETIF_F_RXCSUM) wil_dbg_txrx(wil, "Rx checksum offloading changed\n"); return 0; }
static int wil_change_mtu(struct net_device *ndev, int new_mtu) { struct wil6210_priv *wil = ndev_to_wil(ndev); if (new_mtu < 68 || new_mtu > mtu_max) { wil_err(wil, "invalid MTU %d\n", new_mtu); return -EINVAL; } wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu); ndev->mtu = new_mtu; return 0; }
static int wil_ethtoolops_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *cp) { struct wil6210_priv *wil = ndev_to_wil(ndev); int ret; wil_dbg_misc(wil, "ethtoolops_set_coalesce: rx %d usec, tx %d usec\n", cp->rx_coalesce_usecs, cp->tx_coalesce_usecs); if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { wil_dbg_misc(wil, "No IRQ coalescing in monitor mode\n"); return -EINVAL; } /* only @rx_coalesce_usecs and @tx_coalesce_usecs supported, * ignore other parameters */ if (cp->rx_coalesce_usecs > WIL6210_ITR_TRSH_MAX || cp->tx_coalesce_usecs > WIL6210_ITR_TRSH_MAX) goto out_bad; wil->tx_max_burst_duration = cp->tx_coalesce_usecs; wil->rx_max_burst_duration = cp->rx_coalesce_usecs; ret = wil_pm_runtime_get(wil); if (ret < 0) return ret; wil_configure_interrupt_moderation(wil); wil_pm_runtime_put(wil); return 0; out_bad: wil_dbg_misc(wil, "Unsupported coalescing params. Raw command:\n"); print_hex_dump_debug("DBG[MISC] coal ", DUMP_PREFIX_OFFSET, 16, 4, cp, sizeof(*cp), false); return -EINVAL; }
static int wil_stop(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); return wil_down(wil); }
static int wil_open(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); return wil_up(wil); }