Lines Matching +full:tcs +full:- +full:config
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2014-2019 aQuantia Corporation
5 * Copyright (C) 2019-2020 Marvell International Ltd.
55 aq_nic->ndev = ndev; in aq_ndev_alloc()
56 ndev->netdev_ops = &aq_ndev_ops; in aq_ndev_alloc()
57 ndev->ethtool_ops = &aq_ethtool_ops; in aq_ndev_alloc()
108 if (unlikely(aq_utils_obj_test(&aq_nic->flags, AQ_NIC_PTP_DPATH_UP))) { in aq_ndev_start_xmit()
116 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) || in aq_ndev_start_xmit()
117 unlikely((ip_hdr(skb)->version == 4) && in aq_ndev_start_xmit()
118 (ip_hdr(skb)->protocol == IPPROTO_UDP) && in aq_ndev_start_xmit()
119 ((udp_hdr(skb)->dest == htons(319)) || in aq_ndev_start_xmit()
120 (udp_hdr(skb)->dest == htons(320)))) || in aq_ndev_start_xmit()
121 unlikely(eth_hdr(skb)->h_proto == htons(ETH_P_1588))) in aq_ndev_start_xmit()
137 prog = READ_ONCE(aq_nic->xdp_prog); in aq_ndev_change_mtu()
138 if (prog && !prog->aux->xdp_has_frags && in aq_ndev_change_mtu()
141 ndev->mtu); in aq_ndev_change_mtu()
142 return -EOPNOTSUPP; in aq_ndev_change_mtu()
149 WRITE_ONCE(ndev->mtu, new_mtu); in aq_ndev_change_mtu()
169 if (aq_nic->ndev->features & NETIF_F_NTUPLE) { in aq_ndev_set_features()
176 if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { in aq_ndev_set_features()
183 aq_cfg->features = features; in aq_ndev_set_features()
185 if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { in aq_ndev_set_features()
188 if (aq_cfg->is_lro != is_lro) { in aq_ndev_set_features()
189 aq_cfg->is_lro = is_lro; in aq_ndev_set_features()
194 if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM) { in aq_ndev_set_features()
195 err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw, in aq_ndev_set_features()
202 if (aq_cfg->is_vlan_rx_strip != is_vlan_rx_strip) { in aq_ndev_set_features()
203 aq_cfg->is_vlan_rx_strip = is_vlan_rx_strip; in aq_ndev_set_features()
206 if (aq_cfg->is_vlan_tx_insert != is_vlan_tx_insert) { in aq_ndev_set_features()
207 aq_cfg->is_vlan_tx_insert = is_vlan_tx_insert; in aq_ndev_set_features()
229 prog = READ_ONCE(aq_nic->xdp_prog); in aq_ndev_fix_features()
230 if (prog && !prog->aux->xdp_has_frags && in aq_ndev_fix_features()
231 aq_nic->xdp_prog && features & NETIF_F_LRO) { in aq_ndev_fix_features()
264 struct hwtstamp_config *config) in aq_ndev_config_hwtstamp() argument
266 switch (config->tx_type) { in aq_ndev_config_hwtstamp()
271 return -ERANGE; in aq_ndev_config_hwtstamp()
274 switch (config->rx_filter) { in aq_ndev_config_hwtstamp()
283 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; in aq_ndev_config_hwtstamp()
289 return -ERANGE; in aq_ndev_config_hwtstamp()
292 return aq_ptp_hwtstamp_config_set(aq_nic->aq_ptp, config); in aq_ndev_config_hwtstamp()
298 struct hwtstamp_config config; in aq_ndev_hwtstamp_set() local
303 if (!aq_nic->aq_ptp) in aq_ndev_hwtstamp_set()
304 return -EOPNOTSUPP; in aq_ndev_hwtstamp_set()
306 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) in aq_ndev_hwtstamp_set()
307 return -EFAULT; in aq_ndev_hwtstamp_set()
309 ret_val = aq_ndev_config_hwtstamp(aq_nic, &config); in aq_ndev_hwtstamp_set()
314 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? in aq_ndev_hwtstamp_set()
315 -EFAULT : 0; in aq_ndev_hwtstamp_set()
321 struct hwtstamp_config config; in aq_ndev_hwtstamp_get() local
323 if (!aq_nic->aq_ptp) in aq_ndev_hwtstamp_get()
324 return -EOPNOTSUPP; in aq_ndev_hwtstamp_get()
326 aq_ptp_hwtstamp_config_get(aq_nic->aq_ptp, &config); in aq_ndev_hwtstamp_get()
327 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? in aq_ndev_hwtstamp_get()
328 -EFAULT : 0; in aq_ndev_hwtstamp_get()
346 return -EOPNOTSUPP; in aq_ndev_ioctl()
354 if (!aq_nic->aq_hw_ops->hw_filter_vlan_set) in aq_ndo_vlan_rx_add_vid()
355 return -EOPNOTSUPP; in aq_ndo_vlan_rx_add_vid()
357 set_bit(vid, aq_nic->active_vlans); in aq_ndo_vlan_rx_add_vid()
367 if (!aq_nic->aq_hw_ops->hw_filter_vlan_set) in aq_ndo_vlan_rx_kill_vid()
368 return -EOPNOTSUPP; in aq_ndo_vlan_rx_kill_vid()
370 clear_bit(vid, aq_nic->active_vlans); in aq_ndo_vlan_rx_kill_vid()
372 if (-ENOENT == aq_del_fvlan_by_vlan(aq_nic, vid)) in aq_ndo_vlan_rx_kill_vid()
382 const bool has_min_rate = !!(mqprio->flags & TC_MQPRIO_F_MIN_RATE); in aq_validate_mqprio_opt()
384 const unsigned int tcs_max = min_t(u8, aq_nic_cfg->aq_hw_caps->tcs_max, in aq_validate_mqprio_opt()
388 netdev_err(self->ndev, "Too many TCs requested\n"); in aq_validate_mqprio_opt()
389 return -EOPNOTSUPP; in aq_validate_mqprio_opt()
393 netdev_err(self->ndev, "TC count should be power of 2\n"); in aq_validate_mqprio_opt()
394 return -EOPNOTSUPP; in aq_validate_mqprio_opt()
397 if (has_min_rate && !ATL_HW_IS_CHIP_FEATURE(self->aq_hw, ANTIGUA)) { in aq_validate_mqprio_opt()
398 netdev_err(self->ndev, "Min tx rate is not supported\n"); in aq_validate_mqprio_opt()
399 return -EOPNOTSUPP; in aq_validate_mqprio_opt()
416 return -EOPNOTSUPP; in aq_ndo_setup_tc()
418 has_min_rate = !!(mqprio->flags & TC_MQPRIO_F_MIN_RATE); in aq_ndo_setup_tc()
419 has_max_rate = !!(mqprio->flags & TC_MQPRIO_F_MAX_RATE); in aq_ndo_setup_tc()
421 err = aq_validate_mqprio_opt(aq_nic, mqprio, mqprio->qopt.num_tc); in aq_ndo_setup_tc()
425 for (i = 0; i < mqprio->qopt.num_tc; i++) { in aq_ndo_setup_tc()
427 u64 max_rate = mqprio->max_rate[i]; in aq_ndo_setup_tc()
434 u64 min_rate = mqprio->min_rate[i]; in aq_ndo_setup_tc()
441 return aq_nic_setup_tc_mqprio(aq_nic, mqprio->qopt.num_tc, in aq_ndo_setup_tc()
442 mqprio->qopt.prio_tc_map); in aq_ndo_setup_tc()
452 if (prog && !prog->aux->xdp_has_frags) { in aq_xdp_setup()
453 if (ndev->mtu > AQ_CFG_RX_FRAME_MAX) { in aq_xdp_setup()
456 return -EOPNOTSUPP; in aq_xdp_setup()
459 if (prog && ndev->features & NETIF_F_LRO) { in aq_xdp_setup()
462 ndev->features &= ~NETIF_F_LRO; in aq_xdp_setup()
466 need_update = !!aq_nic->xdp_prog != !!prog; in aq_xdp_setup()
470 old_prog = xchg(&aq_nic->xdp_prog, prog); in aq_xdp_setup()
487 switch (xdp->command) { in aq_xdp()
489 return aq_xdp_setup(dev, xdp->prog, xdp->extack); in aq_xdp()
491 return -EINVAL; in aq_xdp()
519 return -ENOMEM; in aq_ndev_init_module()