Lines Matching refs:efv
25 static int efx_ef100_rep_init_struct(struct efx_nic *efx, struct efx_rep *efv, in efx_ef100_rep_init_struct() argument
28 efv->parent = efx; in efx_ef100_rep_init_struct()
29 efv->idx = i; in efx_ef100_rep_init_struct()
30 INIT_LIST_HEAD(&efv->list); in efx_ef100_rep_init_struct()
31 efv->dflt.fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL; in efx_ef100_rep_init_struct()
32 INIT_LIST_HEAD(&efv->dflt.acts.list); in efx_ef100_rep_init_struct()
33 INIT_LIST_HEAD(&efv->rx_list); in efx_ef100_rep_init_struct()
34 spin_lock_init(&efv->rx_lock); in efx_ef100_rep_init_struct()
35 efv->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | in efx_ef100_rep_init_struct()
44 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_open() local
46 netif_napi_add(net_dev, &efv->napi, efx_ef100_rep_poll); in efx_ef100_rep_open()
47 napi_enable(&efv->napi); in efx_ef100_rep_open()
53 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_close() local
55 napi_disable(&efv->napi); in efx_ef100_rep_close()
56 netif_napi_del(&efv->napi); in efx_ef100_rep_close()
63 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_xmit() local
64 struct efx_nic *efx = efv->parent; in efx_ef100_rep_xmit()
71 atomic64_inc(&efv->stats.tx_packets); in efx_ef100_rep_xmit()
72 atomic64_add(skb->len, &efv->stats.tx_bytes); in efx_ef100_rep_xmit()
74 rc = __ef100_hard_start_xmit(skb, efx, dev, efv); in efx_ef100_rep_xmit()
82 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_port_parent_id() local
83 struct efx_nic *efx = efv->parent; in efx_ef100_rep_get_port_parent_id()
96 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_phys_port_name() local
97 struct efx_nic *efx = efv->parent; in efx_ef100_rep_get_phys_port_name()
103 nic_data->pf_index, efv->idx); in efx_ef100_rep_get_phys_port_name()
113 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_setup_tc() local
114 struct efx_nic *efx = efv->parent; in efx_ef100_rep_setup_tc()
117 return efx_tc_flower(efx, net_dev, type_data, efv); in efx_ef100_rep_setup_tc()
119 return efx_tc_setup_block(net_dev, efx, type_data, efv); in efx_ef100_rep_setup_tc()
127 struct efx_rep *efv = netdev_priv(dev); in efx_ef100_rep_get_stats64() local
129 stats->rx_packets = atomic64_read(&efv->stats.rx_packets); in efx_ef100_rep_get_stats64()
130 stats->tx_packets = atomic64_read(&efv->stats.tx_packets); in efx_ef100_rep_get_stats64()
131 stats->rx_bytes = atomic64_read(&efv->stats.rx_bytes); in efx_ef100_rep_get_stats64()
132 stats->tx_bytes = atomic64_read(&efv->stats.tx_bytes); in efx_ef100_rep_get_stats64()
133 stats->rx_dropped = atomic64_read(&efv->stats.rx_dropped); in efx_ef100_rep_get_stats64()
134 stats->tx_errors = atomic64_read(&efv->stats.tx_errors); in efx_ef100_rep_get_stats64()
155 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_get_msglevel() local
157 return efv->msg_enable; in efx_ef100_rep_ethtool_get_msglevel()
163 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_set_msglevel() local
165 efv->msg_enable = msg_enable; in efx_ef100_rep_ethtool_set_msglevel()
173 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_get_ringparam() local
176 ring->rx_pending = efv->rx_pring_size; in efx_ef100_rep_ethtool_get_ringparam()
184 struct efx_rep *efv = netdev_priv(net_dev); in efx_ef100_rep_ethtool_set_ringparam() local
189 efv->rx_pring_size = ring->rx_pending; in efx_ef100_rep_ethtool_set_ringparam()
205 struct efx_rep *efv; in efx_ef100_rep_create_netdev() local
208 net_dev = alloc_etherdev_mq(sizeof(*efv), 1); in efx_ef100_rep_create_netdev()
212 efv = netdev_priv(net_dev); in efx_ef100_rep_create_netdev()
213 rc = efx_ef100_rep_init_struct(efx, efv, i); in efx_ef100_rep_create_netdev()
216 efv->net_dev = net_dev; in efx_ef100_rep_create_netdev()
219 list_add_tail(&efv->list, &efx->vf_reps); in efx_ef100_rep_create_netdev()
236 return efv; in efx_ef100_rep_create_netdev()
242 static int efx_ef100_configure_rep(struct efx_rep *efv) in efx_ef100_configure_rep() argument
244 struct efx_nic *efx = efv->parent; in efx_ef100_configure_rep()
248 efv->rx_pring_size = EFX_REP_DEFAULT_PSEUDO_RING_SIZE; in efx_ef100_configure_rep()
250 efx_mae_mport_vf(efx, efv->idx, &selector); in efx_ef100_configure_rep()
252 rc = efx_mae_lookup_mport(efx, selector, &efv->mport); in efx_ef100_configure_rep()
255 pci_dbg(efx->pci_dev, "VF %u has mport ID %#x\n", efv->idx, efv->mport); in efx_ef100_configure_rep()
257 WARN_ON(efv->mport >> 16); in efx_ef100_configure_rep()
259 return efx_tc_configure_default_rule_rep(efv); in efx_ef100_configure_rep()
262 static void efx_ef100_deconfigure_rep(struct efx_rep *efv) in efx_ef100_deconfigure_rep() argument
264 struct efx_nic *efx = efv->parent; in efx_ef100_deconfigure_rep()
266 efx_tc_deconfigure_default_rule(efx, &efv->dflt); in efx_ef100_deconfigure_rep()
269 static void efx_ef100_rep_destroy_netdev(struct efx_rep *efv) in efx_ef100_rep_destroy_netdev() argument
271 struct efx_nic *efx = efv->parent; in efx_ef100_rep_destroy_netdev()
275 list_del(&efv->list); in efx_ef100_rep_destroy_netdev()
279 free_netdev(efv->net_dev); in efx_ef100_rep_destroy_netdev()
284 struct efx_rep *efv; in efx_ef100_vfrep_create() local
287 efv = efx_ef100_rep_create_netdev(efx, i); in efx_ef100_vfrep_create()
288 if (IS_ERR(efv)) { in efx_ef100_vfrep_create()
289 rc = PTR_ERR(efv); in efx_ef100_vfrep_create()
295 rc = efx_ef100_configure_rep(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 efx_ef100_deconfigure_rep(efv); in efx_ef100_vfrep_create()
315 efx_ef100_rep_destroy_netdev(efv); in efx_ef100_vfrep_create()
319 void efx_ef100_vfrep_destroy(struct efx_nic *efx, struct efx_rep *efv) in efx_ef100_vfrep_destroy() argument
323 rep_dev = efv->net_dev; in efx_ef100_vfrep_destroy()
328 efx_ef100_deconfigure_rep(efv); in efx_ef100_vfrep_destroy()
329 efx_ef100_rep_destroy_netdev(efv); in efx_ef100_vfrep_destroy()
335 struct efx_rep *efv, *next; in efx_ef100_fini_vfreps() local
340 list_for_each_entry_safe(efv, next, &efx->vf_reps, list) in efx_ef100_fini_vfreps()
341 efx_ef100_vfrep_destroy(efx, efv); in efx_ef100_fini_vfreps()
346 struct efx_rep *efv = container_of(napi, struct efx_rep, napi); in efx_ef100_rep_poll() local
355 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
356 read_index = efv->write_index; in efx_ef100_rep_poll()
357 while (spent < weight && !list_empty(&efv->rx_list)) { in efx_ef100_rep_poll()
358 skb = list_first_entry(&efv->rx_list, struct sk_buff, list); in efx_ef100_rep_poll()
363 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
368 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
369 efv->read_index = read_index; in efx_ef100_rep_poll()
375 need_resched = efv->write_index != read_index; in efx_ef100_rep_poll()
376 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_poll()
378 napi_schedule(&efv->napi); in efx_ef100_rep_poll()
383 void efx_ef100_rep_rx_packet(struct efx_rep *efv, struct efx_rx_buffer *rx_buf) in efx_ef100_rep_rx_packet() argument
392 if (efv->write_index - READ_ONCE(efv->read_index) > efv->rx_pring_size) { in efx_ef100_rep_rx_packet()
393 atomic64_inc(&efv->stats.rx_dropped); in efx_ef100_rep_rx_packet()
395 netif_dbg(efv->parent, rx_err, efv->net_dev, in efx_ef100_rep_rx_packet()
401 skb = netdev_alloc_skb(efv->net_dev, rx_buf->len); in efx_ef100_rep_rx_packet()
403 atomic64_inc(&efv->stats.rx_dropped); in efx_ef100_rep_rx_packet()
405 netif_dbg(efv->parent, rx_err, efv->net_dev, in efx_ef100_rep_rx_packet()
416 skb->protocol = eth_type_trans(skb, efv->net_dev); in efx_ef100_rep_rx_packet()
420 atomic64_inc(&efv->stats.rx_packets); in efx_ef100_rep_rx_packet()
421 atomic64_add(rx_buf->len, &efv->stats.rx_bytes); in efx_ef100_rep_rx_packet()
424 spin_lock_bh(&efv->rx_lock); in efx_ef100_rep_rx_packet()
425 primed = efv->read_index == efv->write_index; in efx_ef100_rep_rx_packet()
426 list_add_tail(&skb->list, &efv->rx_list); in efx_ef100_rep_rx_packet()
427 efv->write_index++; in efx_ef100_rep_rx_packet()
428 spin_unlock_bh(&efv->rx_lock); in efx_ef100_rep_rx_packet()
431 napi_schedule(&efv->napi); in efx_ef100_rep_rx_packet()
436 struct efx_rep *efv, *out = NULL; in efx_ef100_find_rep_by_mport() local
443 list_for_each_entry(efv, &efx->vf_reps, list) in efx_ef100_find_rep_by_mport()
444 if (efv->mport == mport) { in efx_ef100_find_rep_by_mport()
445 out = efv; in efx_ef100_find_rep_by_mport()