Lines Matching refs:efv

27 static int efx_ef100_rep_init_struct(struct efx_nic *efx, struct efx_rep *efv,  in efx_ef100_rep_init_struct()  argument
30 efv->parent = efx; in efx_ef100_rep_init_struct()
31 efv->idx = i; in efx_ef100_rep_init_struct()
32 INIT_LIST_HEAD(&efv->list); in efx_ef100_rep_init_struct()
33 efv->dflt.fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL; in efx_ef100_rep_init_struct()
34 INIT_LIST_HEAD(&efv->dflt.acts.list); in efx_ef100_rep_init_struct()
35 INIT_LIST_HEAD(&efv->rx_list); in efx_ef100_rep_init_struct()
36 spin_lock_init(&efv->rx_lock); in efx_ef100_rep_init_struct()
37 efv->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | in efx_ef100_rep_init_struct()
46 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_open() local
48 netif_napi_add(net_dev, &efv->napi, efx_ef100_rep_poll); in efx_ef100_rep_open()
49 napi_enable(&efv->napi); in efx_ef100_rep_open()
55 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_close() local
57 napi_disable(&efv->napi); in efx_ef100_rep_close()
58 netif_napi_del(&efv->napi); in efx_ef100_rep_close()
65 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_xmit() local
66 struct efx_nic *efx = efv->parent; in efx_ef100_rep_xmit()
73 atomic64_inc(&efv->stats.tx_packets); in efx_ef100_rep_xmit()
74 atomic64_add(skb->len, &efv->stats.tx_bytes); in efx_ef100_rep_xmit()
76 rc = __ef100_hard_start_xmit(skb, efx, dev, efv); in efx_ef100_rep_xmit()
84 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_port_parent_id() local
85 struct efx_nic *efx = efv->parent; in efx_ef100_rep_get_port_parent_id()
98 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_phys_port_name() local
99 struct efx_nic *efx = efv->parent; in efx_ef100_rep_get_phys_port_name()
105 nic_data->pf_index, efv->idx); in efx_ef100_rep_get_phys_port_name()
115 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_setup_tc() local
116 struct efx_nic *efx = efv->parent; in efx_ef100_rep_setup_tc()
119 return efx_tc_flower(efx, net_dev, type_data, efv); in efx_ef100_rep_setup_tc()
121 return efx_tc_setup_block(net_dev, efx, type_data, efv); in efx_ef100_rep_setup_tc()
129 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_stats64() local
131 stats->rx_packets = atomic64_read(&efv->stats.rx_packets); in efx_ef100_rep_get_stats64()
132 stats->tx_packets = atomic64_read(&efv->stats.tx_packets); in efx_ef100_rep_get_stats64()
133 stats->rx_bytes = atomic64_read(&efv->stats.rx_bytes); in efx_ef100_rep_get_stats64()
134 stats->tx_bytes = atomic64_read(&efv->stats.tx_bytes); in efx_ef100_rep_get_stats64()
135 stats->rx_dropped = atomic64_read(&efv->stats.rx_dropped); in efx_ef100_rep_get_stats64()
136 stats->tx_errors = atomic64_read(&efv->stats.tx_errors); in efx_ef100_rep_get_stats64()
157 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_get_msglevel() local
159 return efv->msg_enable; in efx_ef100_rep_ethtool_get_msglevel()
165 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_set_msglevel() local
167 efv->msg_enable = msg_enable; in efx_ef100_rep_ethtool_set_msglevel()
175 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_get_ringparam() local
178 ring->rx_pending = efv->rx_pring_size; in efx_ef100_rep_ethtool_get_ringparam()
186 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_set_ringparam() local
191 efv->rx_pring_size = ring->rx_pending; in efx_ef100_rep_ethtool_set_ringparam()
207 struct efx_rep *efv; in efx_ef100_rep_create_netdev() local
210 net_dev = alloc_etherdev_mq(sizeof(*efv), 1); in efx_ef100_rep_create_netdev()
214 efv = netdev_priv(net_dev); in efx_ef100_rep_create_netdev()
215 rc = efx_ef100_rep_init_struct(efx, efv, i); in efx_ef100_rep_create_netdev()
218 efv->net_dev = net_dev; in efx_ef100_rep_create_netdev()
221 list_add_tail(&efv->list, &efx->vf_reps); in efx_ef100_rep_create_netdev()
238 return efv; in efx_ef100_rep_create_netdev()
244 static int efx_ef100_configure_rep(struct efx_rep *efv) in efx_ef100_configure_rep() argument
246 struct efx_nic *efx = efv->parent; in efx_ef100_configure_rep()
249 efv->rx_pring_size = EFX_REP_DEFAULT_PSEUDO_RING_SIZE; in efx_ef100_configure_rep()
251 rc = efx_mae_lookup_mport(efx, efv->idx, &efv->mport); in efx_ef100_configure_rep()
254 pci_dbg(efx->pci_dev, "VF %u has mport ID %#x\n", efv->idx, efv->mport); in efx_ef100_configure_rep()
256 WARN_ON(efv->mport >> 16); in efx_ef100_configure_rep()
258 return efx_tc_configure_default_rule_rep(efv); in efx_ef100_configure_rep()
261 static void efx_ef100_deconfigure_rep(struct efx_rep *efv) in efx_ef100_deconfigure_rep() argument
263 struct efx_nic *efx = efv->parent; in efx_ef100_deconfigure_rep()
265 efx_tc_deconfigure_default_rule(efx, &efv->dflt); in efx_ef100_deconfigure_rep()
268 static void efx_ef100_rep_destroy_netdev(struct efx_rep *efv) in efx_ef100_rep_destroy_netdev() argument
270 struct efx_nic *efx = efv->parent; in efx_ef100_rep_destroy_netdev()
274 list_del(&efv->list); in efx_ef100_rep_destroy_netdev()
278 free_netdev(efv->net_dev); in efx_ef100_rep_destroy_netdev()
283 struct efx_rep *efv; in efx_ef100_vfrep_create() local
286 efv = efx_ef100_rep_create_netdev(efx, i); in efx_ef100_vfrep_create()
287 if (IS_ERR(efv)) { in efx_ef100_vfrep_create()
288 rc = PTR_ERR(efv); in efx_ef100_vfrep_create()
294 rc = efx_ef100_configure_rep(efv); in efx_ef100_vfrep_create()
301 ef100_rep_set_devlink_port(efv); in efx_ef100_vfrep_create()
302 rc = register_netdev(efv->net_dev); in efx_ef100_vfrep_create()
310 efv->net_dev->name); in efx_ef100_vfrep_create()
313 ef100_rep_unset_devlink_port(efv); in efx_ef100_vfrep_create()
314 efx_ef100_deconfigure_rep(efv); in efx_ef100_vfrep_create()
316 efx_ef100_rep_destroy_netdev(efv); in efx_ef100_vfrep_create()
320 void efx_ef100_vfrep_destroy(struct efx_nic *efx, struct efx_rep *efv) in efx_ef100_vfrep_destroy() argument
324 rep_dev = efv->net_dev; in efx_ef100_vfrep_destroy()
329 ef100_rep_unset_devlink_port(efv); in efx_ef100_vfrep_destroy()
330 efx_ef100_deconfigure_rep(efv); in efx_ef100_vfrep_destroy()
331 efx_ef100_rep_destroy_netdev(efv); in efx_ef100_vfrep_destroy()
337 struct efx_rep *efv, *next; in efx_ef100_fini_vfreps() local
342 list_for_each_entry_safe(efv, next, &efx->vf_reps, list) in efx_ef100_fini_vfreps()
343 efx_ef100_vfrep_destroy(efx, efv); in efx_ef100_fini_vfreps()
395 struct efx_rep *efv = container_of(napi, struct efx_rep, napi); in efx_ef100_rep_poll() local
404 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
405 read_index = efv->write_index; in efx_ef100_rep_poll()
406 while (spent < weight && !list_empty(&efv->rx_list)) { in efx_ef100_rep_poll()
407 skb = list_first_entry(&efv->rx_list, struct sk_buff, list); in efx_ef100_rep_poll()
412 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
417 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
418 efv->read_index = read_index; in efx_ef100_rep_poll()
424 need_resched = efv->write_index != read_index; in efx_ef100_rep_poll()
425 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
427 napi_schedule(&efv->napi); in efx_ef100_rep_poll()
432 void efx_ef100_rep_rx_packet(struct efx_rep *efv, struct efx_rx_buffer *rx_buf) in efx_ef100_rep_rx_packet() argument
441 if (efv->write_index - READ_ONCE(efv->read_index) > efv->rx_pring_size) { in efx_ef100_rep_rx_packet()
442 atomic64_inc(&efv->stats.rx_dropped); in efx_ef100_rep_rx_packet()
444 netif_dbg(efv->parent, rx_err, efv->net_dev, in efx_ef100_rep_rx_packet()
450 skb = netdev_alloc_skb(efv->net_dev, rx_buf->len); in efx_ef100_rep_rx_packet()
452 atomic64_inc(&efv->stats.rx_dropped); in efx_ef100_rep_rx_packet()
454 netif_dbg(efv->parent, rx_err, efv->net_dev, in efx_ef100_rep_rx_packet()
465 skb->protocol = eth_type_trans(skb, efv->net_dev); in efx_ef100_rep_rx_packet()
469 atomic64_inc(&efv->stats.rx_packets); in efx_ef100_rep_rx_packet()
470 atomic64_add(rx_buf->len, &efv->stats.rx_bytes); in efx_ef100_rep_rx_packet()
473 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_rx_packet()
474 primed = efv->read_index == efv->write_index; in efx_ef100_rep_rx_packet()
475 list_add_tail(&skb->list, &efv->rx_list); in efx_ef100_rep_rx_packet()
476 efv->write_index++; in efx_ef100_rep_rx_packet()
477 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_rx_packet()
480 napi_schedule(&efv->napi); in efx_ef100_rep_rx_packet()
485 struct efx_rep *efv, *out = NULL; in efx_ef100_find_rep_by_mport() local
492 list_for_each_entry(efv, &efx->vf_reps, list) in efx_ef100_find_rep_by_mport()
493 if (efv->mport == mport) { in efx_ef100_find_rep_by_mport()
494 out = efv; in efx_ef100_find_rep_by_mport()