Lines Matching +full:max +full:- +full:link +full:- +full:speed
1 /* SPDX-License-Identifier: BSD-3-Clause */
47 * iavf_send_pf_msg - Send virtchnl message to PF device
62 struct iavf_hw *hw = &sc->hw; in iavf_send_pf_msg()
63 device_t dev = sc->dev; in iavf_send_pf_msg()
68 val_err = virtchnl_vc_validate_vf_msg(&sc->version, op, msg, len); in iavf_send_pf_msg()
91 iavf_aq_str(hw, hw->aq.asq_last_status)); in iavf_send_pf_msg()
97 * iavf_send_api_ver - Send the API version we support to the PF
119 * iavf_verify_api_ver - Verify the PF supports our API version
132 struct iavf_hw *hw = &sc->hw; in iavf_verify_api_ver()
135 device_t dev = sc->dev; in iavf_verify_api_ver()
173 if ((pf_vvi->major > VIRTCHNL_VERSION_MAJOR) || in iavf_verify_api_ver()
174 ((pf_vvi->major == VIRTCHNL_VERSION_MAJOR) && in iavf_verify_api_ver()
175 (pf_vvi->minor > VIRTCHNL_VERSION_MINOR))) { in iavf_verify_api_ver()
179 sc->version.major = pf_vvi->major; in iavf_verify_api_ver()
180 sc->version.minor = pf_vvi->minor; in iavf_verify_api_ver()
185 pf_vvi->major, pf_vvi->minor, in iavf_verify_api_ver()
194 * iavf_send_vf_config_msg - Send VF configuration request
209 * speed reporting capability. in iavf_send_vf_config_msg()
217 if (sc->version.minor == VIRTCHNL_VERSION_MINOR_NO_VF_CAPS) in iavf_send_vf_config_msg()
226 * iavf_get_vf_config - Get the VF configuration from the PF
239 struct iavf_hw *hw = &sc->hw; in iavf_get_vf_config()
240 device_t dev = sc->dev; in iavf_get_vf_config()
290 memcpy(sc->vf_res, event.msg_buf, min(event.msg_len, len)); in iavf_get_vf_config()
291 iavf_vf_parse_hw_config(hw, sc->vf_res); in iavf_get_vf_config()
299 * iavf_enable_queues - Enable queues
312 struct iavf_vsi *vsi = &sc->vsi; in iavf_enable_queues()
314 vqs.vsi_id = sc->vsi_res->vsi_id; in iavf_enable_queues()
315 vqs.tx_queues = (1 << IAVF_NTXQS(vsi)) - 1; in iavf_enable_queues()
323 * iavf_disable_queues - Disable queues
336 struct iavf_vsi *vsi = &sc->vsi; in iavf_disable_queues()
338 vqs.vsi_id = sc->vsi_res->vsi_id; in iavf_disable_queues()
339 vqs.tx_queues = (1 << IAVF_NTXQS(vsi)) - 1; in iavf_disable_queues()
347 * iavf_add_vlans - Add VLAN filters
361 device_t dev = sc->dev; in iavf_add_vlans()
366 SLIST_FOREACH(f, sc->vlan_filters, next) { in iavf_add_vlans()
367 if (f->flags & IAVF_FILTER_ADD) in iavf_add_vlans()
378 device_printf(dev, "%s: Exceeded Max AQ Buf size\n", in iavf_add_vlans()
390 v->vsi_id = sc->vsi_res->vsi_id; in iavf_add_vlans()
391 v->num_elements = cnt; in iavf_add_vlans()
394 SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { in iavf_add_vlans()
395 if (f->flags & IAVF_FILTER_ADD) { in iavf_add_vlans()
396 bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); in iavf_add_vlans()
397 f->flags = IAVF_FILTER_USED; in iavf_add_vlans()
411 * iavf_del_vlans - Delete VLAN filters
425 device_t dev = sc->dev; in iavf_del_vlans()
430 SLIST_FOREACH(f, sc->vlan_filters, next) { in iavf_del_vlans()
431 if (f->flags & IAVF_FILTER_DEL) in iavf_del_vlans()
442 device_printf(dev, "%s: Exceeded Max AQ Buf size\n", in iavf_del_vlans()
455 v->vsi_id = sc->vsi_res->vsi_id; in iavf_del_vlans()
456 v->num_elements = cnt; in iavf_del_vlans()
459 SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { in iavf_del_vlans()
460 if (f->flags & IAVF_FILTER_DEL) { in iavf_del_vlans()
461 bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); in iavf_del_vlans()
463 SLIST_REMOVE(sc->vlan_filters, f, iavf_vlan_filter, next); in iavf_del_vlans()
477 * iavf_add_ether_filters - Add MAC filters
491 device_t dev = sc->dev; in iavf_add_ether_filters()
496 SLIST_FOREACH(f, sc->mac_filters, next) { in iavf_add_ether_filters()
497 if (f->flags & IAVF_FILTER_ADD) in iavf_add_ether_filters()
515 a->vsi_id = sc->vsi.id; in iavf_add_ether_filters()
516 a->num_elements = cnt; in iavf_add_ether_filters()
519 SLIST_FOREACH(f, sc->mac_filters, next) { in iavf_add_ether_filters()
520 if (f->flags & IAVF_FILTER_ADD) { in iavf_add_ether_filters()
521 bcopy(f->macaddr, a->list[j].addr, ETHER_ADDR_LEN); in iavf_add_ether_filters()
522 f->flags &= ~IAVF_FILTER_ADD; in iavf_add_ether_filters()
526 __func__, MAC_FORMAT_ARGS(f->macaddr)); in iavf_add_ether_filters()
542 * iavf_del_ether_filters - Delete MAC filters
556 device_t dev = sc->dev; in iavf_del_ether_filters()
560 SLIST_FOREACH(f, sc->mac_filters, next) { in iavf_del_ether_filters()
561 if (f->flags & IAVF_FILTER_DEL) in iavf_del_ether_filters()
579 d->vsi_id = sc->vsi.id; in iavf_del_ether_filters()
580 d->num_elements = cnt; in iavf_del_ether_filters()
583 SLIST_FOREACH_SAFE(f, sc->mac_filters, next, f_temp) { in iavf_del_ether_filters()
584 if (f->flags & IAVF_FILTER_DEL) { in iavf_del_ether_filters()
585 bcopy(f->macaddr, d->list[j].addr, ETHER_ADDR_LEN); in iavf_del_ether_filters()
587 MAC_FORMAT_ARGS(f->macaddr)); in iavf_del_ether_filters()
589 SLIST_REMOVE(sc->mac_filters, f, iavf_mac_filter, next); in iavf_del_ether_filters()
603 * iavf_request_reset - Request a device reset
618 wr32(&sc->hw, IAVF_VFGEN_RSTAT, VIRTCHNL_VFR_INPROGRESS); in iavf_request_reset()
624 * iavf_request_stats - Request VF stats
640 vqs.vsi_id = sc->vsi_res->vsi_id; in iavf_request_stats()
645 device_printf(sc->dev, "Error sending stats request to PF: %d\n", error); in iavf_request_stats()
651 * iavf_update_stats_counters - Update driver statistics
660 struct iavf_vsi *vsi = &sc->vsi; in iavf_update_stats_counters()
663 vsi->ipackets = es->rx_unicast + es->rx_multicast + es->rx_broadcast; in iavf_update_stats_counters()
664 vsi->opackets = es->tx_unicast + es->tx_multicast + es->tx_broadcast; in iavf_update_stats_counters()
665 vsi->ibytes = es->rx_bytes; in iavf_update_stats_counters()
666 vsi->obytes = es->tx_bytes; in iavf_update_stats_counters()
667 vsi->imcasts = es->rx_multicast; in iavf_update_stats_counters()
668 vsi->omcasts = es->tx_multicast; in iavf_update_stats_counters()
670 vsi->oerrors = es->tx_errors; in iavf_update_stats_counters()
671 vsi->iqdrops = es->rx_discards; in iavf_update_stats_counters()
672 vsi->oqdrops = es->tx_discards; in iavf_update_stats_counters()
673 vsi->noproto = es->rx_unknown_protocol; in iavf_update_stats_counters()
675 vsi->eth_stats = *es; in iavf_update_stats_counters()
679 * iavf_config_rss_key - Configure RSS key over virtchnl
705 msg_len = sizeof(struct virtchnl_rss_key) + (sizeof(u8) * key_length) - 1; in iavf_config_rss_key()
709 device_printf(sc->dev, "Unable to allocate msg memory for RSS key msg.\n"); in iavf_config_rss_key()
713 rss_key_msg->vsi_id = sc->vsi_res->vsi_id; in iavf_config_rss_key()
714 rss_key_msg->key_len = key_length; in iavf_config_rss_key()
715 bcopy(rss_seed, &rss_key_msg->key[0], key_length); in iavf_config_rss_key()
718 rss_key_msg->vsi_id, rss_key_msg->key_len); in iavf_config_rss_key()
728 * iavf_set_rss_hena - Configure the RSS HENA
741 struct iavf_hw *hw = &sc->hw; in iavf_set_rss_hena()
743 if (hw->mac.type == IAVF_MAC_VF) in iavf_set_rss_hena()
745 else if (hw->mac.type == IAVF_MAC_X722_VF) in iavf_set_rss_hena()
756 * iavf_config_rss_lut - Configure RSS lookup table
775 msg_len = sizeof(struct virtchnl_rss_lut) + (lut_length * sizeof(u8)) - 1; in iavf_config_rss_lut()
779 device_printf(sc->dev, "Unable to allocate msg memory for RSS lut msg.\n"); in iavf_config_rss_lut()
783 rss_lut_msg->vsi_id = sc->vsi_res->vsi_id; in iavf_config_rss_lut()
784 /* Each LUT entry is a max of 1 byte, so this is easy */ in iavf_config_rss_lut()
785 rss_lut_msg->lut_entries = lut_length; in iavf_config_rss_lut()
787 /* Populate the LUT with max no. of queues in round robin fashion */ in iavf_config_rss_lut()
796 que_id = que_id % sc->vsi.num_rx_queues; in iavf_config_rss_lut()
798 que_id = i % sc->vsi.num_rx_queues; in iavf_config_rss_lut()
801 rss_lut_msg->lut[i] = lut; in iavf_config_rss_lut()
812 * iavf_config_promisc_mode - Configure promiscuous mode
827 pinfo.vsi_id = sc->vsi_res->vsi_id; in iavf_config_promisc_mode()
828 pinfo.flags = sc->promisc_flags; in iavf_config_promisc_mode()
836 * iavf_vc_send_cmd - Convert request into virtchnl calls
890 * iavf_vc_get_op_chan - Get op channel for a request
902 return (&sc->enable_queues_chan); in iavf_vc_get_op_chan()
904 return (&sc->disable_queues_chan); in iavf_vc_get_op_chan()
911 * iavf_vc_stat_str - convert virtchnl status err code to a string
939 snprintf(hw->err_str, sizeof(hw->err_str), "%d", stat_err); in iavf_vc_stat_str()
940 return hw->err_str; in iavf_vc_stat_str()
944 * iavf_adv_speed_to_ext_speed - Convert numeric speed to iavf speed enum
945 * @adv_link_speed: link speed in Mb/s
947 * Converts the link speed from the "advanced" link speed virtchnl op into the
948 * closest approximation of the internal iavf link speed, rounded down.
950 * @returns the link speed as an iavf_ext_link_speed enum value
982 * iavf_ext_speed_to_ifmedia - Convert internal iavf speed to ifmedia value
983 * @link_speed: the link speed
987 * type as "virtual" and have another mechanism for reporting the link
988 * speed.
990 * @returns a suitable ifmedia type for the given link speed.
1025 * iavf_vc_speed_to_ext_speed - Convert virtchnl speed enum to native iavf
1026 * driver speed representation.
1027 * @link_speed: link speed enum value
1029 * @returns the link speed in the native iavf format.
1054 * iavf_vc_speed_to_string - Convert virtchnl speed to a string
1055 * @link_speed: the speed to convert
1057 * @returns string representing the link speed as reported by the virtchnl
1067 * iavf_ext_speed_to_str - Convert iavf speed enum to string representation
1068 * @link_speed: link speed enum value
1070 * XXX: This is an iavf-modified copy of ice_aq_speed_to_str()
1072 * @returns the string representation of the given link speed.
1107 * iavf_vc_opcode_str - Convert virtchnl opcode to string
1164 * iavf_vc_completion - Handle PF reply messages
1180 device_t dev = sc->dev; in iavf_vc_completion()
1190 switch (vpe->event) { in iavf_vc_completion()
1196 iavf_set_state(&sc->state, IAVF_STATE_RESET_PENDING); in iavf_vc_completion()
1200 vpe->event); in iavf_vc_completion()
1207 /* Catch-all error response */ in iavf_vc_completion()
1217 sc->enable_queues_chan = 1; in iavf_vc_completion()
1218 wakeup_one(&sc->enable_queues_chan); in iavf_vc_completion()
1221 sc->disable_queues_chan = 1; in iavf_vc_completion()
1222 wakeup_one(&sc->disable_queues_chan); in iavf_vc_completion()
1226 if (!(sc->dbg_mask & IAVF_DBG_VC)) in iavf_vc_completion()
1236 __func__, iavf_vc_stat_str(&sc->hw, v_retval), in iavf_vc_completion()
1256 atomic_store_rel_32(&sc->queues_enabled, 1); in iavf_vc_completion()
1257 sc->enable_queues_chan = 1; in iavf_vc_completion()
1258 wakeup_one(&sc->enable_queues_chan); in iavf_vc_completion()
1261 atomic_store_rel_32(&sc->queues_enabled, 0); in iavf_vc_completion()
1262 sc->disable_queues_chan = 1; in iavf_vc_completion()
1263 wakeup_one(&sc->disable_queues_chan); in iavf_vc_completion()
1284 * iavf_handle_link_event - Handle Link event virtchml message
1286 * @vpe: virtchnl PF link event structure
1288 * Process a virtchnl PF link event and update the driver and stack status of
1289 * the link event.
1294 MPASS(vpe->event == VIRTCHNL_EVENT_LINK_CHANGE); in iavf_handle_link_event()
1296 if (sc->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED) in iavf_handle_link_event()
1298 iavf_dbg_vc(sc, "Link change (adv): status %d, speed %u\n", in iavf_handle_link_event()
1299 vpe->event_data.link_event_adv.link_status, in iavf_handle_link_event()
1300 vpe->event_data.link_event_adv.link_speed); in iavf_handle_link_event()
1301 sc->link_up = in iavf_handle_link_event()
1302 vpe->event_data.link_event_adv.link_status; in iavf_handle_link_event()
1303 sc->link_speed_adv = in iavf_handle_link_event()
1304 vpe->event_data.link_event_adv.link_speed; in iavf_handle_link_event()
1307 iavf_dbg_vc(sc, "Link change: status %d, speed %x\n", in iavf_handle_link_event()
1308 vpe->event_data.link_event.link_status, in iavf_handle_link_event()
1309 vpe->event_data.link_event.link_speed); in iavf_handle_link_event()
1310 sc->link_up = in iavf_handle_link_event()
1311 vpe->event_data.link_event.link_status; in iavf_handle_link_event()
1312 sc->link_speed = in iavf_handle_link_event()
1313 vpe->event_data.link_event.link_speed; in iavf_handle_link_event()