Lines Matching refs:vport
466 static int idpf_del_mac_filter(struct idpf_vport *vport, in idpf_del_mac_filter() argument
489 err = idpf_add_del_mac_filters(vport, np, false, async); in idpf_del_mac_filter()
545 static int idpf_add_mac_filter(struct idpf_vport *vport, in idpf_add_mac_filter() argument
558 err = idpf_add_del_mac_filters(vport, np, true, async); in idpf_add_mac_filter()
569 static void idpf_del_all_mac_filters(struct idpf_vport *vport) in idpf_del_all_mac_filters() argument
574 vport_config = vport->adapter->vport_config[vport->idx]; in idpf_del_all_mac_filters()
593 static void idpf_restore_mac_filters(struct idpf_vport *vport) in idpf_restore_mac_filters() argument
598 vport_config = vport->adapter->vport_config[vport->idx]; in idpf_restore_mac_filters()
606 idpf_add_del_mac_filters(vport, netdev_priv(vport->netdev), in idpf_restore_mac_filters()
617 static void idpf_remove_mac_filters(struct idpf_vport *vport) in idpf_remove_mac_filters() argument
622 vport_config = vport->adapter->vport_config[vport->idx]; in idpf_remove_mac_filters()
630 idpf_add_del_mac_filters(vport, netdev_priv(vport->netdev), in idpf_remove_mac_filters()
638 static void idpf_deinit_mac_addr(struct idpf_vport *vport) in idpf_deinit_mac_addr() argument
643 vport_config = vport->adapter->vport_config[vport->idx]; in idpf_deinit_mac_addr()
647 f = idpf_find_mac_filter(vport_config, vport->default_mac_addr); in idpf_deinit_mac_addr()
661 static int idpf_init_mac_addr(struct idpf_vport *vport, in idpf_init_mac_addr() argument
665 struct idpf_adapter *adapter = vport->adapter; in idpf_init_mac_addr()
668 if (is_valid_ether_addr(vport->default_mac_addr)) { in idpf_init_mac_addr()
669 eth_hw_addr_set(netdev, vport->default_mac_addr); in idpf_init_mac_addr()
670 ether_addr_copy(netdev->perm_addr, vport->default_mac_addr); in idpf_init_mac_addr()
672 return idpf_add_mac_filter(vport, np, vport->default_mac_addr, in idpf_init_mac_addr()
685 err = idpf_add_mac_filter(vport, np, netdev->dev_addr, false); in idpf_init_mac_addr()
690 vport->default_mac_addr, netdev->dev_addr); in idpf_init_mac_addr()
691 ether_addr_copy(vport->default_mac_addr, netdev->dev_addr); in idpf_init_mac_addr()
702 static int idpf_cfg_netdev(struct idpf_vport *vport) in idpf_cfg_netdev() argument
704 struct idpf_adapter *adapter = vport->adapter; in idpf_cfg_netdev()
710 u16 idx = vport->idx; in idpf_cfg_netdev()
721 np->vport = vport; in idpf_cfg_netdev()
722 np->vport_idx = vport->idx; in idpf_cfg_netdev()
723 np->vport_id = vport->vport_id; in idpf_cfg_netdev()
724 vport->netdev = netdev; in idpf_cfg_netdev()
726 return idpf_init_mac_addr(vport, netdev); in idpf_cfg_netdev()
735 vport->netdev = netdev; in idpf_cfg_netdev()
737 np->vport = vport; in idpf_cfg_netdev()
739 np->vport_idx = vport->idx; in idpf_cfg_netdev()
740 np->vport_id = vport->vport_id; in idpf_cfg_netdev()
744 err = idpf_init_mac_addr(vport, netdev); in idpf_cfg_netdev()
746 free_netdev(vport->netdev); in idpf_cfg_netdev()
747 vport->netdev = NULL; in idpf_cfg_netdev()
762 netdev->max_mtu = vport->max_mtu; in idpf_cfg_netdev()
791 if (idpf_is_cap_ena(vport->adapter, IDPF_SEG_CAPS, in idpf_cfg_netdev()
802 if (!idpf_is_cap_ena_all(vport->adapter, IDPF_CSUM_CAPS, in idpf_cfg_netdev()
853 static void idpf_remove_features(struct idpf_vport *vport) in idpf_remove_features() argument
855 struct idpf_adapter *adapter = vport->adapter; in idpf_remove_features()
858 idpf_remove_mac_filters(vport); in idpf_remove_features()
865 static void idpf_vport_stop(struct idpf_vport *vport) in idpf_vport_stop() argument
867 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); in idpf_vport_stop()
872 netif_carrier_off(vport->netdev); in idpf_vport_stop()
873 netif_tx_disable(vport->netdev); in idpf_vport_stop()
875 idpf_send_disable_vport_msg(vport); in idpf_vport_stop()
876 idpf_send_disable_queues_msg(vport); in idpf_vport_stop()
877 idpf_send_map_unmap_queue_vector_msg(vport, false); in idpf_vport_stop()
883 if (test_and_clear_bit(IDPF_VPORT_DEL_QUEUES, vport->flags)) in idpf_vport_stop()
884 idpf_send_delete_queues_msg(vport); in idpf_vport_stop()
886 idpf_remove_features(vport); in idpf_vport_stop()
888 vport->link_up = false; in idpf_vport_stop()
889 idpf_vport_intr_deinit(vport); in idpf_vport_stop()
890 idpf_vport_queues_rel(vport); in idpf_vport_stop()
891 idpf_vport_intr_rel(vport); in idpf_vport_stop()
908 struct idpf_vport *vport; in idpf_stop() local
914 vport = idpf_netdev_to_vport(netdev); in idpf_stop()
916 idpf_vport_stop(vport); in idpf_stop()
927 static void idpf_decfg_netdev(struct idpf_vport *vport) in idpf_decfg_netdev() argument
929 struct idpf_adapter *adapter = vport->adapter; in idpf_decfg_netdev()
931 kfree(vport->rx_ptype_lkup); in idpf_decfg_netdev()
932 vport->rx_ptype_lkup = NULL; in idpf_decfg_netdev()
934 unregister_netdev(vport->netdev); in idpf_decfg_netdev()
935 free_netdev(vport->netdev); in idpf_decfg_netdev()
936 vport->netdev = NULL; in idpf_decfg_netdev()
938 adapter->netdevs[vport->idx] = NULL; in idpf_decfg_netdev()
945 static void idpf_vport_rel(struct idpf_vport *vport) in idpf_vport_rel() argument
947 struct idpf_adapter *adapter = vport->adapter; in idpf_vport_rel()
952 u16 idx = vport->idx; in idpf_vport_rel()
954 vport_config = adapter->vport_config[vport->idx]; in idpf_vport_rel()
955 idpf_deinit_rss(vport); in idpf_vport_rel()
960 idpf_send_destroy_vport_msg(vport); in idpf_vport_rel()
971 vec_info.num_curr_vecs = vport->num_q_vectors; in idpf_vport_rel()
972 vec_info.default_vport = vport->default_vport; in idpf_vport_rel()
974 idpf_req_rel_vector_indexes(adapter, vport->q_vector_idxs, &vec_info); in idpf_vport_rel()
976 kfree(vport->q_vector_idxs); in idpf_vport_rel()
977 vport->q_vector_idxs = NULL; in idpf_vport_rel()
987 kfree(vport); in idpf_vport_rel()
997 static void idpf_vport_dealloc(struct idpf_vport *vport) in idpf_vport_dealloc() argument
999 struct idpf_adapter *adapter = vport->adapter; in idpf_vport_dealloc()
1000 unsigned int i = vport->idx; in idpf_vport_dealloc()
1002 idpf_deinit_mac_addr(vport); in idpf_vport_dealloc()
1003 idpf_vport_stop(vport); in idpf_vport_dealloc()
1006 idpf_decfg_netdev(vport); in idpf_vport_dealloc()
1008 idpf_del_all_mac_filters(vport); in idpf_vport_dealloc()
1013 np->vport = NULL; in idpf_vport_dealloc()
1016 idpf_vport_rel(vport); in idpf_vport_dealloc()
1028 static bool idpf_is_hsplit_supported(const struct idpf_vport *vport) in idpf_is_hsplit_supported() argument
1030 return idpf_is_queue_model_split(vport->rxq_model) && in idpf_is_hsplit_supported()
1031 idpf_is_cap_ena_all(vport->adapter, IDPF_HSPLIT_CAPS, in idpf_is_hsplit_supported()
1043 u8 idpf_vport_get_hsplit(const struct idpf_vport *vport) in idpf_vport_get_hsplit() argument
1047 if (!idpf_is_hsplit_supported(vport)) in idpf_vport_get_hsplit()
1050 config = &vport->adapter->vport_config[vport->idx]->user_config; in idpf_vport_get_hsplit()
1064 bool idpf_vport_set_hsplit(const struct idpf_vport *vport, u8 val) in idpf_vport_set_hsplit() argument
1068 if (!idpf_is_hsplit_supported(vport)) in idpf_vport_set_hsplit()
1071 config = &vport->adapter->vport_config[vport->idx]->user_config; in idpf_vport_set_hsplit()
1099 struct idpf_vport *vport; in idpf_vport_alloc() local
1105 vport = kzalloc(sizeof(*vport), GFP_KERNEL); in idpf_vport_alloc()
1106 if (!vport) in idpf_vport_alloc()
1107 return vport; in idpf_vport_alloc()
1114 kfree(vport); in idpf_vport_alloc()
1122 vport->idx = idx; in idpf_vport_alloc()
1123 vport->adapter = adapter; in idpf_vport_alloc()
1124 vport->compln_clean_budget = IDPF_TX_COMPLQ_CLEAN_BUDGET; in idpf_vport_alloc()
1125 vport->default_vport = adapter->num_alloc_vports < in idpf_vport_alloc()
1129 vport->q_vector_idxs = kcalloc(num_max_q, sizeof(u16), GFP_KERNEL); in idpf_vport_alloc()
1130 if (!vport->q_vector_idxs) { in idpf_vport_alloc()
1131 kfree(vport); in idpf_vport_alloc()
1135 idpf_vport_init(vport, max_q); in idpf_vport_alloc()
1145 kfree(vport); in idpf_vport_alloc()
1153 adapter->vports[idx] = vport; in idpf_vport_alloc()
1154 adapter->vport_ids[idx] = idpf_get_vport_id(vport); in idpf_vport_alloc()
1160 return vport; in idpf_vport_alloc()
1190 struct idpf_vport *vport = adapter->vports[i]; in idpf_statistics_task() local
1192 if (vport && !test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) in idpf_statistics_task()
1193 idpf_send_get_stats_msg(vport); in idpf_statistics_task()
1248 static void idpf_restore_features(struct idpf_vport *vport) in idpf_restore_features() argument
1250 struct idpf_adapter *adapter = vport->adapter; in idpf_restore_features()
1253 idpf_restore_mac_filters(vport); in idpf_restore_features()
1262 static int idpf_set_real_num_queues(struct idpf_vport *vport) in idpf_set_real_num_queues() argument
1266 err = netif_set_real_num_rx_queues(vport->netdev, vport->num_rxq); in idpf_set_real_num_queues()
1270 return netif_set_real_num_tx_queues(vport->netdev, vport->num_txq); in idpf_set_real_num_queues()
1279 static int idpf_up_complete(struct idpf_vport *vport) in idpf_up_complete() argument
1281 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); in idpf_up_complete()
1283 if (vport->link_up && !netif_carrier_ok(vport->netdev)) { in idpf_up_complete()
1284 netif_carrier_on(vport->netdev); in idpf_up_complete()
1285 netif_tx_start_all_queues(vport->netdev); in idpf_up_complete()
1297 static void idpf_rx_init_buf_tail(struct idpf_vport *vport) in idpf_rx_init_buf_tail() argument
1301 for (i = 0; i < vport->num_rxq_grp; i++) { in idpf_rx_init_buf_tail()
1302 struct idpf_rxq_group *grp = &vport->rxq_grps[i]; in idpf_rx_init_buf_tail()
1304 if (idpf_is_queue_model_split(vport->rxq_model)) { in idpf_rx_init_buf_tail()
1305 for (j = 0; j < vport->num_bufqs_per_qgrp; j++) { in idpf_rx_init_buf_tail()
1326 static int idpf_vport_open(struct idpf_vport *vport) in idpf_vport_open() argument
1328 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); in idpf_vport_open()
1329 struct idpf_adapter *adapter = vport->adapter; in idpf_vport_open()
1337 netif_carrier_off(vport->netdev); in idpf_vport_open()
1339 err = idpf_vport_intr_alloc(vport); in idpf_vport_open()
1342 vport->vport_id, err); in idpf_vport_open()
1346 err = idpf_vport_queues_alloc(vport); in idpf_vport_open()
1350 err = idpf_vport_queue_ids_init(vport); in idpf_vport_open()
1353 vport->vport_id, err); in idpf_vport_open()
1357 err = idpf_vport_intr_init(vport); in idpf_vport_open()
1360 vport->vport_id, err); in idpf_vport_open()
1364 err = idpf_rx_bufs_init_all(vport); in idpf_vport_open()
1367 vport->vport_id, err); in idpf_vport_open()
1371 err = idpf_queue_reg_init(vport); in idpf_vport_open()
1374 vport->vport_id, err); in idpf_vport_open()
1378 idpf_rx_init_buf_tail(vport); in idpf_vport_open()
1379 idpf_vport_intr_ena(vport); in idpf_vport_open()
1381 err = idpf_send_config_queues_msg(vport); in idpf_vport_open()
1384 vport->vport_id, err); in idpf_vport_open()
1388 err = idpf_send_map_unmap_queue_vector_msg(vport, true); in idpf_vport_open()
1391 vport->vport_id, err); in idpf_vport_open()
1395 err = idpf_send_enable_queues_msg(vport); in idpf_vport_open()
1398 vport->vport_id, err); in idpf_vport_open()
1402 err = idpf_send_enable_vport_msg(vport); in idpf_vport_open()
1405 vport->vport_id, err); in idpf_vport_open()
1410 idpf_restore_features(vport); in idpf_vport_open()
1412 vport_config = adapter->vport_config[vport->idx]; in idpf_vport_open()
1414 err = idpf_config_rss(vport); in idpf_vport_open()
1416 err = idpf_init_rss(vport); in idpf_vport_open()
1419 vport->vport_id, err); in idpf_vport_open()
1423 err = idpf_up_complete(vport); in idpf_vport_open()
1426 vport->vport_id, err); in idpf_vport_open()
1433 idpf_deinit_rss(vport); in idpf_vport_open()
1435 idpf_send_disable_vport_msg(vport); in idpf_vport_open()
1437 idpf_send_disable_queues_msg(vport); in idpf_vport_open()
1439 idpf_send_map_unmap_queue_vector_msg(vport, false); in idpf_vport_open()
1441 idpf_vport_intr_deinit(vport); in idpf_vport_open()
1443 idpf_vport_queues_rel(vport); in idpf_vport_open()
1445 idpf_vport_intr_rel(vport); in idpf_vport_open()
1466 struct idpf_vport *vport; in idpf_init_task() local
1491 vport = idpf_vport_alloc(adapter, &max_q); in idpf_init_task()
1492 if (!vport) { in idpf_init_task()
1500 index = vport->idx; in idpf_init_task()
1503 init_waitqueue_head(&vport->sw_marker_wq); in idpf_init_task()
1509 err = idpf_check_supported_desc_ids(vport); in idpf_init_task()
1515 if (idpf_cfg_netdev(vport)) in idpf_init_task()
1518 err = idpf_send_get_rx_ptype_msg(vport); in idpf_init_task()
1523 np = netdev_priv(vport->netdev); in idpf_init_task()
1526 idpf_vport_open(vport); in idpf_init_task()
1559 idpf_decfg_netdev(vport); in idpf_init_task()
1561 idpf_vport_rel(vport); in idpf_init_task()
1834 int idpf_initiate_soft_reset(struct idpf_vport *vport, in idpf_initiate_soft_reset() argument
1837 struct idpf_netdev_priv *np = netdev_priv(vport->netdev); in idpf_initiate_soft_reset()
1839 struct idpf_adapter *adapter = vport->adapter; in idpf_initiate_soft_reset()
1855 new_vport = kzalloc(sizeof(*vport), GFP_KERNEL); in idpf_initiate_soft_reset()
1864 memcpy(new_vport, vport, offsetof(struct idpf_vport, link_up)); in idpf_initiate_soft_reset()
1887 idpf_send_delete_queues_msg(vport); in idpf_initiate_soft_reset()
1889 set_bit(IDPF_VPORT_DEL_QUEUES, vport->flags); in idpf_initiate_soft_reset()
1890 idpf_vport_stop(vport); in idpf_initiate_soft_reset()
1893 idpf_deinit_rss(vport); in idpf_initiate_soft_reset()
1900 err = idpf_send_add_queues_msg(vport, new_vport->num_txq, in idpf_initiate_soft_reset()
1910 memcpy(vport, new_vport, offsetof(struct idpf_vport, link_up)); in idpf_initiate_soft_reset()
1913 idpf_vport_alloc_vec_indexes(vport); in idpf_initiate_soft_reset()
1915 err = idpf_set_real_num_queues(vport); in idpf_initiate_soft_reset()
1920 err = idpf_vport_open(vport); in idpf_initiate_soft_reset()
1927 idpf_send_add_queues_msg(vport, vport->num_txq, vport->num_complq, in idpf_initiate_soft_reset()
1928 vport->num_rxq, vport->num_bufq); in idpf_initiate_soft_reset()
1932 idpf_vport_open(vport); in idpf_initiate_soft_reset()
1957 return idpf_add_mac_filter(np->vport, np, addr, true); in idpf_addr_sync()
1985 idpf_del_mac_filter(np->vport, np, addr, true); in idpf_addr_unsync()
2067 static int idpf_vport_manage_rss_lut(struct idpf_vport *vport) in idpf_vport_manage_rss_lut() argument
2069 bool ena = idpf_is_feature_ena(vport, NETIF_F_RXHASH); in idpf_vport_manage_rss_lut()
2071 u16 idx = vport->idx; in idpf_vport_manage_rss_lut()
2074 rss_data = &vport->adapter->vport_config[idx]->user_config.rss_data; in idpf_vport_manage_rss_lut()
2090 return idpf_config_rss(vport); in idpf_vport_manage_rss_lut()
2103 struct idpf_vport *vport; in idpf_set_features() local
2107 vport = idpf_netdev_to_vport(netdev); in idpf_set_features()
2109 adapter = vport->adapter; in idpf_set_features()
2119 err = idpf_vport_manage_rss_lut(vport); in idpf_set_features()
2126 err = idpf_initiate_soft_reset(vport, IDPF_SR_RSC_CHANGE); in idpf_set_features()
2133 err = idpf_send_ena_dis_loopback_msg(vport); in idpf_set_features()
2156 struct idpf_vport *vport; in idpf_open() local
2160 vport = idpf_netdev_to_vport(netdev); in idpf_open()
2162 err = idpf_vport_open(vport); in idpf_open()
2178 struct idpf_vport *vport; in idpf_change_mtu() local
2182 vport = idpf_netdev_to_vport(netdev); in idpf_change_mtu()
2186 err = idpf_initiate_soft_reset(vport, IDPF_SR_MTU_CHANGE); in idpf_change_mtu()
2203 struct idpf_vport *vport = idpf_netdev_to_vport(netdev); in idpf_features_check() local
2204 struct idpf_adapter *adapter = vport->adapter; in idpf_features_check()
2266 struct idpf_vport *vport; in idpf_set_mac() local
2270 vport = idpf_netdev_to_vport(netdev); in idpf_set_mac()
2272 if (!idpf_is_cap_ena(vport->adapter, IDPF_OTHER_CAPS, in idpf_set_mac()
2274 dev_info(&vport->adapter->pdev->dev, "Setting MAC address is not supported\n"); in idpf_set_mac()
2280 dev_info(&vport->adapter->pdev->dev, "Invalid MAC address: %pM\n", in idpf_set_mac()
2289 vport_config = vport->adapter->vport_config[vport->idx]; in idpf_set_mac()
2290 err = idpf_add_mac_filter(vport, np, addr->sa_data, false); in idpf_set_mac()
2296 if (is_valid_ether_addr(vport->default_mac_addr)) in idpf_set_mac()
2297 idpf_del_mac_filter(vport, np, vport->default_mac_addr, false); in idpf_set_mac()
2299 ether_addr_copy(vport->default_mac_addr, addr->sa_data); in idpf_set_mac()