Lines Matching refs:nn

79 static void nfp_net_pf_free_vnic(struct nfp_pf *pf, struct nfp_net *nn)  in nfp_net_pf_free_vnic()  argument
81 if (nfp_net_is_data_vnic(nn)) in nfp_net_pf_free_vnic()
82 nfp_app_vnic_free(pf->app, nn); in nfp_net_pf_free_vnic()
83 nfp_port_free(nn->port); in nfp_net_pf_free_vnic()
84 list_del(&nn->vnic_list); in nfp_net_pf_free_vnic()
86 nfp_net_free(nn); in nfp_net_pf_free_vnic()
91 struct nfp_net *nn, *next; in nfp_net_pf_free_vnics() local
93 list_for_each_entry_safe(nn, next, &pf->vnics, vnic_list) in nfp_net_pf_free_vnics()
94 if (nfp_net_is_data_vnic(nn)) in nfp_net_pf_free_vnics()
95 nfp_net_pf_free_vnic(pf, nn); in nfp_net_pf_free_vnics()
104 struct nfp_net *nn; in nfp_net_pf_alloc_vnic() local
113 nn = nfp_net_alloc(pf->pdev, pf->dev_info, ctrl_bar, needs_netdev, in nfp_net_pf_alloc_vnic()
115 if (IS_ERR(nn)) in nfp_net_pf_alloc_vnic()
116 return nn; in nfp_net_pf_alloc_vnic()
118 nn->app = pf->app; in nfp_net_pf_alloc_vnic()
119 nn->tx_bar = qc_bar + tx_base * NFP_QCP_QUEUE_ADDR_SZ; in nfp_net_pf_alloc_vnic()
120 nn->rx_bar = qc_bar + rx_base * NFP_QCP_QUEUE_ADDR_SZ; in nfp_net_pf_alloc_vnic()
121 nn->dp.is_vf = 0; in nfp_net_pf_alloc_vnic()
122 nn->stride_rx = stride; in nfp_net_pf_alloc_vnic()
123 nn->stride_tx = stride; in nfp_net_pf_alloc_vnic()
126 err = nfp_app_vnic_alloc(pf->app, nn, id); in nfp_net_pf_alloc_vnic()
128 nfp_net_free(nn); in nfp_net_pf_alloc_vnic()
134 list_add_tail(&nn->vnic_list, &pf->vnics); in nfp_net_pf_alloc_vnic()
136 return nn; in nfp_net_pf_alloc_vnic()
140 nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id) in nfp_net_pf_init_vnic() argument
144 nn->id = id; in nfp_net_pf_init_vnic()
146 if (nn->port) { in nfp_net_pf_init_vnic()
147 err = nfp_devlink_port_register(pf->app, nn->port); in nfp_net_pf_init_vnic()
152 err = nfp_net_init(nn); in nfp_net_pf_init_vnic()
156 nfp_net_debugfs_vnic_add(nn, pf->ddir); in nfp_net_pf_init_vnic()
158 nfp_net_info(nn); in nfp_net_pf_init_vnic()
160 if (nfp_net_is_data_vnic(nn)) { in nfp_net_pf_init_vnic()
161 err = nfp_app_vnic_init(pf->app, nn); in nfp_net_pf_init_vnic()
169 nfp_net_debugfs_dir_clean(&nn->debugfs_dir); in nfp_net_pf_init_vnic()
170 nfp_net_clean(nn); in nfp_net_pf_init_vnic()
172 if (nn->port) in nfp_net_pf_init_vnic()
173 nfp_devlink_port_unregister(nn->port); in nfp_net_pf_init_vnic()
181 struct nfp_net *nn; in nfp_net_pf_alloc_vnics() local
186 nn = nfp_net_pf_alloc_vnic(pf, true, ctrl_bar, qc_bar, in nfp_net_pf_alloc_vnics()
188 if (IS_ERR(nn)) { in nfp_net_pf_alloc_vnics()
189 err = PTR_ERR(nn); in nfp_net_pf_alloc_vnics()
193 if (nn->port) in nfp_net_pf_alloc_vnics()
194 nn->port->link_cb = nfp_net_refresh_port_table; in nfp_net_pf_alloc_vnics()
199 if (nn->port && nn->port->type == NFP_PORT_INVALID) in nfp_net_pf_alloc_vnics()
200 nfp_net_pf_free_vnic(pf, nn); in nfp_net_pf_alloc_vnics()
213 static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn) in nfp_net_pf_clean_vnic() argument
215 if (nfp_net_is_data_vnic(nn)) in nfp_net_pf_clean_vnic()
216 nfp_app_vnic_clean(pf->app, nn); in nfp_net_pf_clean_vnic()
217 nfp_net_debugfs_dir_clean(&nn->debugfs_dir); in nfp_net_pf_clean_vnic()
218 nfp_net_clean(nn); in nfp_net_pf_clean_vnic()
219 if (nn->port) in nfp_net_pf_clean_vnic()
220 nfp_devlink_port_unregister(nn->port); in nfp_net_pf_clean_vnic()
226 struct nfp_net *nn; in nfp_net_pf_alloc_irqs() local
230 list_for_each_entry(nn, &pf->vnics, vnic_list) in nfp_net_pf_alloc_irqs()
231 wanted_irqs += NFP_NET_NON_Q_VECTORS + nn->dp.num_r_vecs; in nfp_net_pf_alloc_irqs()
249 list_for_each_entry(nn, &pf->vnics, vnic_list) { in nfp_net_pf_alloc_irqs()
252 n = min(NFP_NET_NON_Q_VECTORS + nn->dp.num_r_vecs, in nfp_net_pf_alloc_irqs()
254 nfp_net_irqs_assign(nn, &pf->irq_entries[num_irqs - irqs_left], in nfp_net_pf_alloc_irqs()
271 struct nfp_net *nn; in nfp_net_pf_init_vnics() local
277 list_for_each_entry(nn, &pf->vnics, vnic_list) { in nfp_net_pf_init_vnics()
278 if (!nfp_net_is_data_vnic(nn)) in nfp_net_pf_init_vnics()
280 err = nfp_net_pf_init_vnic(pf, nn, id); in nfp_net_pf_init_vnics()
290 list_for_each_entry_continue_reverse(nn, &pf->vnics, vnic_list) in nfp_net_pf_init_vnics()
291 if (nfp_net_is_data_vnic(nn)) in nfp_net_pf_init_vnics()
292 nfp_net_pf_clean_vnic(pf, nn); in nfp_net_pf_init_vnics()
549 struct nfp_net *nn; in nfp_net_notify_port_speed() local
555 nn = netdev_priv(netdev); in nfp_net_notify_port_speed()
556 sts = nn_readw(nn, NFP_NET_CFG_STS); in nfp_net_notify_port_speed()
559 nn_writew(nn, NFP_NET_CFG_STS_NSP_LINK_RATE, NFP_NET_CFG_STS_LINK_RATE_UNKNOWN); in nfp_net_notify_port_speed()
563 nn_writew(nn, NFP_NET_CFG_STS_NSP_LINK_RATE, nfp_net_speed2lr(port->eth_port->speed)); in nfp_net_notify_port_speed()
596 struct nfp_net *nn, *next; in nfp_net_refresh_port_table_sync() local
634 list_for_each_entry_safe(nn, next, &pf->vnics, vnic_list) { in nfp_net_refresh_port_table_sync()
635 if (!nn->port || nn->port->type != NFP_PORT_INVALID) in nfp_net_refresh_port_table_sync()
638 nfp_net_pf_clean_vnic(pf, nn); in nfp_net_refresh_port_table_sync()
639 nfp_net_pf_free_vnic(pf, nn); in nfp_net_refresh_port_table_sync()
809 struct nfp_net *nn, *next; in nfp_net_pci_remove() local
813 list_for_each_entry_safe(nn, next, &pf->vnics, vnic_list) { in nfp_net_pci_remove()
814 if (!nfp_net_is_data_vnic(nn)) in nfp_net_pci_remove()
816 nfp_net_pf_clean_vnic(pf, nn); in nfp_net_pci_remove()
817 nfp_net_pf_free_vnic(pf, nn); in nfp_net_pci_remove()