ef100_rep.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /****************************************************************************
  3. * Driver for Solarflare network controllers and boards
  4. * Copyright 2019 Solarflare Communications Inc.
  5. * Copyright 2020-2022 Xilinx Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation, incorporated herein by reference.
  10. */
  11. /* Handling for ef100 representor netdevs */
  12. #ifndef EF100_REP_H
  13. #define EF100_REP_H
  14. #include "net_driver.h"
  15. #include "tc.h"
  16. struct efx_rep_sw_stats {
  17. atomic64_t rx_packets, tx_packets;
  18. atomic64_t rx_bytes, tx_bytes;
  19. atomic64_t rx_dropped, tx_errors;
  20. };
  21. /**
  22. * struct efx_rep - Private data for an Efx representor
  23. *
  24. * @parent: the efx PF which manages this representor
  25. * @net_dev: representor netdevice
  26. * @msg_enable: log message enable flags
  27. * @mport: m-port ID of corresponding VF
  28. * @idx: VF index
  29. * @write_index: number of packets enqueued to @rx_list
  30. * @read_index: number of packets consumed from @rx_list
  31. * @rx_pring_size: max length of RX list
  32. * @dflt: default-rule for MAE switching
  33. * @list: entry on efx->vf_reps
  34. * @rx_list: list of SKBs queued for receive in NAPI poll
  35. * @rx_lock: protects @rx_list
  36. * @napi: NAPI control structure
  37. * @stats: software traffic counters for netdev stats
  38. */
  39. struct efx_rep {
  40. struct efx_nic *parent;
  41. struct net_device *net_dev;
  42. u32 msg_enable;
  43. u32 mport;
  44. unsigned int idx;
  45. unsigned int write_index, read_index;
  46. unsigned int rx_pring_size;
  47. struct efx_tc_flow_rule dflt;
  48. struct list_head list;
  49. struct list_head rx_list;
  50. spinlock_t rx_lock;
  51. struct napi_struct napi;
  52. struct efx_rep_sw_stats stats;
  53. };
  54. int efx_ef100_vfrep_create(struct efx_nic *efx, unsigned int i);
  55. void efx_ef100_vfrep_destroy(struct efx_nic *efx, struct efx_rep *efv);
  56. void efx_ef100_fini_vfreps(struct efx_nic *efx);
  57. void efx_ef100_rep_rx_packet(struct efx_rep *efv, struct efx_rx_buffer *rx_buf);
  58. /* Returns the representor corresponding to a VF m-port, or NULL
  59. * @mport is an m-port label, *not* an m-port ID!
  60. * Caller must hold rcu_read_lock().
  61. */
  62. struct efx_rep *efx_ef100_find_rep_by_mport(struct efx_nic *efx, u16 mport);
  63. extern const struct net_device_ops efx_ef100_rep_netdev_ops;
  64. #endif /* EF100_REP_H */