aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/driver.c
blob: 4b13e03b06fcba030ea91057c41724ce41fe4b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* SPDX-License-Identifier: Apache-2.0
 * Copyright(c) 2021 Cisco Systems, Inc.
 */

#include <vlib/vlib.h>

#include <dpdk/device/dpdk.h>

static const u32 supported_flow_actions_intel =
  (VNET_FLOW_ACTION_MARK | VNET_FLOW_ACTION_REDIRECT_TO_NODE |
   VNET_FLOW_ACTION_REDIRECT_TO_QUEUE | VNET_FLOW_ACTION_BUFFER_ADVANCE |
   VNET_FLOW_ACTION_COUNT | VNET_FLOW_ACTION_DROP | VNET_FLOW_ACTION_RSS);

#define DPDK_DRIVERS(...)                                                     \
  (dpdk_driver_name_t[])                                                      \
  {                                                                           \
    __VA_ARGS__, {}                                                           \
  }

static dpdk_driver_t dpdk_drivers[] = {
  {
    .drivers = DPDK_DRIVERS ({ "net_ice", "Intel E810 Family" },
			     { "net_igc", "Intel I225 2.5G Family" },
			     { "net_e1000_igb", "Intel e1000" },
			     { "net_e1000_em", "Intel 82540EM (e1000)" }),
    .enable_rxq_int = 1,
    .supported_flow_actions = supported_flow_actions_intel,
    .use_intel_phdr_cksum = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_ixgbe", "Intel 82599" }),
    .enable_rxq_int = 1,
    .supported_flow_actions = supported_flow_actions_intel,
    .use_intel_phdr_cksum = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_i40e", "Intel X710/XL710 Family" }),
    .enable_rxq_int = 1,
    .supported_flow_actions = supported_flow_actions_intel,
    .use_intel_phdr_cksum = 1,
    .int_unmaskable = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_liovf", "Cavium Lio VF" },
			     { "net_thunderx", "Cavium ThunderX" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_iavf", "Intel iAVF" },
			     { "net_i40e_vf", "Intel X710/XL710 Family VF" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
    .supported_flow_actions = supported_flow_actions_intel,
    .use_intel_phdr_cksum = 1,
    .int_unmaskable = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_e1000_igb_vf", "Intel e1000 VF" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
    .use_intel_phdr_cksum = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_ixgbe_vf", "Intel 82599 VF" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
    .use_intel_phdr_cksum = 1,
    .program_vlans = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_dpaa2", "NXP DPAA2 Mac" }),
    .interface_name_prefix = "TenGigabitEthernet",
  },
  {
    .drivers =
      DPDK_DRIVERS ({ "net_fm10k", "Intel FM10000 Family Ethernet Switch" }),
    .interface_name_prefix = "EthernetSwitch",
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_cxgbe", "Chelsio T4/T5" }),
    .interface_number_from_port_id = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_mlx4", "Mellanox ConnectX-3 Family" },
			     { "net_qede", "Cavium QLogic FastLinQ QL4xxxx" },
			     { "net_bnxt", "Broadcom NetXtreme E/S-Series" }),
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_virtio_user", "Virtio User" }),
    .interface_name_prefix = "VirtioUser",
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_vhost", "VhostEthernet" }),
    .interface_name_prefix = "VhostEthernet",
  },
  {
    .drivers = DPDK_DRIVERS ({ "mlx5_pci", "Mellanox ConnectX-4 Family" },
			     { "net_enic", "Cisco VIC" }),
    .use_intel_phdr_cksum = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_failsafe", "FailsafeEthernet" }),
    .interface_name_prefix = "FailsafeEthernet",
    .enable_lsc_int = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "AF_PACKET PMD", "af_packet" }),
    .interface_name_prefix = "af_packet",
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_netvsc", "Microsoft Hyper-V Netvsc" }),
    .interface_name_prefix = "NetVSC",
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_ena", "AWS ENA VF" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
    .enable_rxq_int = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_vmxnet3", "VMware VMXNET3" }),
    .interface_name_prefix = "GigabitEthernet",
    .enable_rxq_int = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_virtio", "Red Hat Virtio" }),
    .interface_name_prefix = "GigabitEthernet",
    .n_rx_desc = 256,
    .n_tx_desc = 256,
    .mq_mode_none = 1,
    .enable_rxq_int = 1,
  },
  {
    .drivers = DPDK_DRIVERS ({ "net_gve", "Google vNIC" }),
    .interface_name_prefix = "VirtualFunctionEthernet",
  }
};

dpdk_driver_t *
dpdk_driver_find (const char *name, const char **desc)
{
  for (int i = 0; i < ARRAY_LEN (dpdk_drivers); i++)
    {
      dpdk_driver_t *dr = dpdk_drivers + i;
      dpdk_driver_name_t *dn = dr->drivers;

      while (dn->name)
	{
	  if (name && !strcmp (name, dn->name))
	    {
	      *desc = dn->desc;
	      return dr;
	    }
	  dn++;
	}
    }
  return 0;
}