Lines Matching +full:supported +full:- +full:hw
47 #include "hw.h"
51 * See hw.h
109 static u32 alx_get_supported_speeds(struct alx_hw *hw) in alx_get_supported_speeds() argument
111 u32 supported = SUPPORTED_10baseT_Half | in alx_get_supported_speeds() local
116 if (alx_hw_giga(hw)) in alx_get_supported_speeds()
117 supported |= SUPPORTED_1000baseT_Full; in alx_get_supported_speeds()
125 return supported; in alx_get_supported_speeds()
132 struct alx_hw *hw = &alx->hw; in alx_get_link_ksettings() local
133 u32 supported, advertising; in alx_get_link_ksettings() local
135 supported = SUPPORTED_Autoneg | in alx_get_link_ksettings()
139 if (alx_hw_giga(hw)) in alx_get_link_ksettings()
140 supported |= SUPPORTED_1000baseT_Full; in alx_get_link_ksettings()
141 supported |= alx_get_supported_speeds(hw); in alx_get_link_ksettings()
144 if (hw->adv_cfg & ADVERTISED_Autoneg) in alx_get_link_ksettings()
145 advertising |= hw->adv_cfg; in alx_get_link_ksettings()
147 cmd->base.port = PORT_TP; in alx_get_link_ksettings()
148 cmd->base.phy_address = 0; in alx_get_link_ksettings()
150 if (hw->adv_cfg & ADVERTISED_Autoneg) in alx_get_link_ksettings()
151 cmd->base.autoneg = AUTONEG_ENABLE; in alx_get_link_ksettings()
153 cmd->base.autoneg = AUTONEG_DISABLE; in alx_get_link_ksettings()
155 if (hw->flowctrl & ALX_FC_ANEG && hw->adv_cfg & ADVERTISED_Autoneg) { in alx_get_link_ksettings()
156 if (hw->flowctrl & ALX_FC_RX) { in alx_get_link_ksettings()
159 if (!(hw->flowctrl & ALX_FC_TX)) in alx_get_link_ksettings()
161 } else if (hw->flowctrl & ALX_FC_TX) { in alx_get_link_ksettings()
166 mutex_lock(&alx->mtx); in alx_get_link_ksettings()
167 cmd->base.speed = hw->link_speed; in alx_get_link_ksettings()
168 cmd->base.duplex = hw->duplex; in alx_get_link_ksettings()
169 mutex_unlock(&alx->mtx); in alx_get_link_ksettings()
171 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in alx_get_link_ksettings()
172 supported); in alx_get_link_ksettings()
173 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, in alx_get_link_ksettings()
183 struct alx_hw *hw = &alx->hw; in alx_set_link_ksettings() local
189 cmd->link_modes.advertising); in alx_set_link_ksettings()
191 if (cmd->base.autoneg == AUTONEG_ENABLE) { in alx_set_link_ksettings()
192 if (advertising & ~alx_get_supported_speeds(hw)) in alx_set_link_ksettings()
193 return -EINVAL; in alx_set_link_ksettings()
196 adv_cfg = alx_speed_to_ethadv(cmd->base.speed, in alx_set_link_ksettings()
197 cmd->base.duplex); in alx_set_link_ksettings()
200 return -EINVAL; in alx_set_link_ksettings()
203 hw->adv_cfg = adv_cfg; in alx_set_link_ksettings()
205 mutex_lock(&alx->mtx); in alx_set_link_ksettings()
206 ret = alx_setup_speed_duplex(hw, adv_cfg, hw->flowctrl); in alx_set_link_ksettings()
207 mutex_unlock(&alx->mtx); in alx_set_link_ksettings()
216 struct alx_hw *hw = &alx->hw; in alx_get_pauseparam() local
218 mutex_lock(&alx->mtx); in alx_get_pauseparam()
219 pause->autoneg = !!(hw->flowctrl & ALX_FC_ANEG && in alx_get_pauseparam()
220 hw->adv_cfg & ADVERTISED_Autoneg); in alx_get_pauseparam()
221 pause->tx_pause = !!(hw->flowctrl & ALX_FC_TX); in alx_get_pauseparam()
222 pause->rx_pause = !!(hw->flowctrl & ALX_FC_RX); in alx_get_pauseparam()
223 mutex_unlock(&alx->mtx); in alx_get_pauseparam()
231 struct alx_hw *hw = &alx->hw; in alx_set_pauseparam() local
236 if (pause->tx_pause) in alx_set_pauseparam()
238 if (pause->rx_pause) in alx_set_pauseparam()
240 if (pause->autoneg) in alx_set_pauseparam()
243 mutex_lock(&alx->mtx); in alx_set_pauseparam()
245 /* restart auto-neg for auto-mode */ in alx_set_pauseparam()
246 if (hw->adv_cfg & ADVERTISED_Autoneg) { in alx_set_pauseparam()
247 if (!((fc ^ hw->flowctrl) & ALX_FC_ANEG)) in alx_set_pauseparam()
249 if (fc & hw->flowctrl & ALX_FC_ANEG && in alx_set_pauseparam()
250 (fc ^ hw->flowctrl) & (ALX_FC_RX | ALX_FC_TX)) in alx_set_pauseparam()
255 err = alx_setup_speed_duplex(hw, hw->adv_cfg, fc); in alx_set_pauseparam()
257 mutex_unlock(&alx->mtx); in alx_set_pauseparam()
263 if ((fc ^ hw->flowctrl) & (ALX_FC_RX | ALX_FC_TX)) in alx_set_pauseparam()
264 alx_cfg_mac_flowcontrol(hw, fc); in alx_set_pauseparam()
266 hw->flowctrl = fc; in alx_set_pauseparam()
267 mutex_unlock(&alx->mtx); in alx_set_pauseparam()
276 return alx->msg_enable; in alx_get_msglevel()
283 alx->msg_enable = data; in alx_set_msglevel()
290 struct alx_hw *hw = &alx->hw; in alx_get_ethtool_stats() local
292 spin_lock(&alx->stats_lock); in alx_get_ethtool_stats()
294 alx_update_hw_stats(hw); in alx_get_ethtool_stats()
295 BUILD_BUG_ON(sizeof(hw->stats) != ALX_NUM_STATS * sizeof(u64)); in alx_get_ethtool_stats()
296 memcpy(data, &hw->stats, sizeof(hw->stats)); in alx_get_ethtool_stats()
298 spin_unlock(&alx->stats_lock); in alx_get_ethtool_stats()
319 return -EINVAL; in alx_get_sset_count()