Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd.
3 : : * Copyright(c) 2010-2017 Intel Corporation
4 : : */
5 : :
6 : : #include <sys/queue.h>
7 : : #include <stdio.h>
8 : : #include <errno.h>
9 : : #include <stdint.h>
10 : : #include <string.h>
11 : : #include <rte_log.h>
12 : : #include <ethdev_pci.h>
13 : : #include <rte_alarm.h>
14 : :
15 : : #include "txgbe_logs.h"
16 : : #include "base/txgbe.h"
17 : : #include "txgbe_ethdev.h"
18 : : #include "txgbe_rxtx.h"
19 : : #include "txgbe_regs_group.h"
20 : :
21 : : static const struct reg_info txgbevf_regs_general[] = {
22 : : {TXGBE_VFRST, 1, 1, "TXGBE_VFRST"},
23 : : {TXGBE_VFSTATUS, 1, 1, "TXGBE_VFSTATUS"},
24 : : {TXGBE_VFMBCTL, 1, 1, "TXGBE_VFMAILBOX"},
25 : : {TXGBE_VFMBX, 16, 4, "TXGBE_VFMBX"},
26 : : {TXGBE_VFPBWRAP, 1, 1, "TXGBE_VFPBWRAP"},
27 : : {0, 0, 0, ""}
28 : : };
29 : :
30 : : static const struct reg_info txgbevf_regs_interrupt[] = {
31 : : {0, 0, 0, ""}
32 : : };
33 : :
34 : : static const struct reg_info txgbevf_regs_rxdma[] = {
35 : : {0, 0, 0, ""}
36 : : };
37 : :
38 : : static const struct reg_info txgbevf_regs_tx[] = {
39 : : {0, 0, 0, ""}
40 : : };
41 : :
42 : : /* VF registers */
43 : : static const struct reg_info *txgbevf_regs[] = {
44 : : txgbevf_regs_general,
45 : : txgbevf_regs_interrupt,
46 : : txgbevf_regs_rxdma,
47 : : txgbevf_regs_tx,
48 : : NULL};
49 : :
50 : : static int txgbevf_dev_xstats_get(struct rte_eth_dev *dev,
51 : : struct rte_eth_xstat *xstats, unsigned int n);
52 : : static int txgbevf_dev_info_get(struct rte_eth_dev *dev,
53 : : struct rte_eth_dev_info *dev_info);
54 : : static int txgbevf_dev_configure(struct rte_eth_dev *dev);
55 : : static int txgbevf_dev_start(struct rte_eth_dev *dev);
56 : : static int txgbevf_dev_link_update(struct rte_eth_dev *dev,
57 : : int wait_to_complete);
58 : : static int txgbevf_dev_stop(struct rte_eth_dev *dev);
59 : : static int txgbevf_dev_close(struct rte_eth_dev *dev);
60 : : static void txgbevf_intr_disable(struct rte_eth_dev *dev);
61 : : static void txgbevf_intr_enable(struct rte_eth_dev *dev);
62 : : static int txgbevf_dev_stats_reset(struct rte_eth_dev *dev);
63 : : static int txgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask);
64 : : static void txgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on);
65 : : static void txgbevf_configure_msix(struct rte_eth_dev *dev);
66 : : static int txgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
67 : : static int txgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
68 : : static void txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
69 : : static void txgbevf_dev_interrupt_handler(void *param);
70 : :
71 : : /*
72 : : * The set of PCI devices this driver supports (for VF)
73 : : */
74 : : static const struct rte_pci_id pci_id_txgbevf_map[] = {
75 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_SP1000_VF) },
76 : : { RTE_PCI_DEVICE(PCI_VENDOR_ID_WANGXUN, TXGBE_DEV_ID_WX1820_VF) },
77 : : { .vendor_id = 0, /* sentinel */ },
78 : : };
79 : :
80 : : static const struct rte_eth_desc_lim rx_desc_lim = {
81 : : .nb_max = TXGBE_RING_DESC_MAX,
82 : : .nb_min = TXGBE_RING_DESC_MIN,
83 : : .nb_align = TXGBE_RXD_ALIGN,
84 : : };
85 : :
86 : : static const struct rte_eth_desc_lim tx_desc_lim = {
87 : : .nb_max = TXGBE_RING_DESC_MAX,
88 : : .nb_min = TXGBE_RING_DESC_MIN,
89 : : .nb_align = TXGBE_TXD_ALIGN,
90 : : .nb_seg_max = TXGBE_TX_MAX_SEG,
91 : : .nb_mtu_seg_max = TXGBE_TX_MAX_SEG,
92 : : };
93 : :
94 : : static const struct eth_dev_ops txgbevf_eth_dev_ops;
95 : :
96 : : static const struct rte_txgbe_xstats_name_off rte_txgbevf_stats_strings[] = {
97 : : {"rx_multicast_packets_0",
98 : : offsetof(struct txgbevf_hw_stats, qp[0].vfmprc)},
99 : : {"rx_multicast_packets_1",
100 : : offsetof(struct txgbevf_hw_stats, qp[1].vfmprc)},
101 : : {"rx_multicast_packets_2",
102 : : offsetof(struct txgbevf_hw_stats, qp[2].vfmprc)},
103 : : {"rx_multicast_packets_3",
104 : : offsetof(struct txgbevf_hw_stats, qp[3].vfmprc)},
105 : : {"rx_multicast_packets_4",
106 : : offsetof(struct txgbevf_hw_stats, qp[4].vfmprc)},
107 : : {"rx_multicast_packets_5",
108 : : offsetof(struct txgbevf_hw_stats, qp[5].vfmprc)},
109 : : {"rx_multicast_packets_6",
110 : : offsetof(struct txgbevf_hw_stats, qp[6].vfmprc)},
111 : : {"rx_multicast_packets_7",
112 : : offsetof(struct txgbevf_hw_stats, qp[7].vfmprc)}
113 : : };
114 : :
115 : : #define TXGBEVF_NB_XSTATS (sizeof(rte_txgbevf_stats_strings) / \
116 : : sizeof(rte_txgbevf_stats_strings[0]))
117 : :
118 : : /*
119 : : * Negotiate mailbox API version with the PF.
120 : : * After reset API version is always set to the basic one (txgbe_mbox_api_10).
121 : : * Then we try to negotiate starting with the most recent one.
122 : : * If all negotiation attempts fail, then we will proceed with
123 : : * the default one (txgbe_mbox_api_10).
124 : : */
125 : : static void
126 : 0 : txgbevf_negotiate_api(struct txgbe_hw *hw)
127 : : {
128 : : int32_t i;
129 : :
130 : : /* start with highest supported, proceed down */
131 : : static const int sup_ver[] = {
132 : : txgbe_mbox_api_21,
133 : : txgbe_mbox_api_13,
134 : : txgbe_mbox_api_12,
135 : : txgbe_mbox_api_11,
136 : : txgbe_mbox_api_10,
137 : : };
138 : :
139 [ # # ]: 0 : for (i = 0; i < ARRAY_SIZE(sup_ver); i++) {
140 [ # # ]: 0 : if (txgbevf_negotiate_api_version(hw, sup_ver[i]) == 0)
141 : : break;
142 : : }
143 : 0 : }
144 : :
145 : : static void
146 : 0 : generate_random_mac_addr(struct rte_ether_addr *mac_addr)
147 : : {
148 : : uint64_t random;
149 : :
150 : : /* Set Organizationally Unique Identifier (OUI) prefix. */
151 : : mac_addr->addr_bytes[0] = 0x00;
152 : 0 : mac_addr->addr_bytes[1] = 0x09;
153 : 0 : mac_addr->addr_bytes[2] = 0xC0;
154 : : /* Force indication of locally assigned MAC address. */
155 : 0 : mac_addr->addr_bytes[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;
156 : : /* Generate the last 3 bytes of the MAC address with a random number. */
157 : 0 : random = rte_rand();
158 : 0 : memcpy(&mac_addr->addr_bytes[3], &random, 3);
159 : 0 : }
160 : :
161 : : int
162 : 0 : txgbevf_inject_5tuple_filter(struct rte_eth_dev *dev,
163 : : struct txgbe_5tuple_filter *filter)
164 : : {
165 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
166 : : uint32_t mask = TXGBE_5TFCTL0_MASK;
167 : 0 : uint16_t index = filter->index;
168 : : uint32_t msg[TXGBEVF_5T_MAX];
169 : : int err;
170 : :
171 : : memset(msg, 0, sizeof(*msg));
172 : :
173 : : /* 0 means compare */
174 : : mask &= ~TXGBE_5TFCTL0_MPOOL;
175 [ # # ]: 0 : if (filter->filter_info.src_ip_mask == 0)
176 : : mask &= ~TXGBE_5TFCTL0_MSADDR;
177 [ # # ]: 0 : if (filter->filter_info.dst_ip_mask == 0)
178 : 0 : mask &= ~TXGBE_5TFCTL0_MDADDR;
179 [ # # ]: 0 : if (filter->filter_info.src_port_mask == 0)
180 : 0 : mask &= ~TXGBE_5TFCTL0_MSPORT;
181 [ # # ]: 0 : if (filter->filter_info.dst_port_mask == 0)
182 : 0 : mask &= ~TXGBE_5TFCTL0_MDPORT;
183 [ # # ]: 0 : if (filter->filter_info.proto_mask == 0)
184 : 0 : mask &= ~TXGBE_5TFCTL0_MPROTO;
185 : :
186 : : msg[TXGBEVF_5T_CTRL0] = mask;
187 : 0 : msg[TXGBEVF_5T_CTRL0] |= TXGBE_5TFCTL0_ENA;
188 : 0 : msg[TXGBEVF_5T_CTRL0] |= TXGBE_5TFCTL0_PROTO(filter->filter_info.proto);
189 : 0 : msg[TXGBEVF_5T_CTRL0] |= TXGBE_5TFCTL0_PRI(filter->filter_info.priority);
190 : 0 : msg[TXGBEVF_5T_CTRL1] = TXGBE_5TFCTL1_QP(filter->queue);
191 [ # # ]: 0 : msg[TXGBEVF_5T_PORT] = TXGBE_5TFPORT_DST(be_to_le16(filter->filter_info.dst_port));
192 [ # # ]: 0 : msg[TXGBEVF_5T_PORT] |= TXGBE_5TFPORT_SRC(be_to_le16(filter->filter_info.src_port));
193 [ # # ]: 0 : msg[TXGBEVF_5T_DA] = be_to_le32(filter->filter_info.dst_ip);
194 [ # # ]: 0 : msg[TXGBEVF_5T_SA] = be_to_le32(filter->filter_info.src_ip);
195 : :
196 : 0 : err = txgbevf_add_5tuple_filter(hw, msg, index);
197 [ # # ]: 0 : if (err)
198 : 0 : PMD_DRV_LOG(ERR, "VF request PF to add 5tuple filters failed.");
199 : :
200 : 0 : return err;
201 : : }
202 : :
203 : : void
204 : 0 : txgbevf_remove_5tuple_filter(struct rte_eth_dev *dev, u16 index)
205 : : {
206 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
207 : : int err;
208 : :
209 : 0 : err = txgbevf_del_5tuple_filter(hw, index);
210 [ # # ]: 0 : if (err)
211 : 0 : PMD_DRV_LOG(ERR, "VF request PF to delete 5tuple filters failed.");
212 : 0 : }
213 : :
214 : : /*
215 : : * Virtual Function device init
216 : : */
217 : : static int
218 : 0 : eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)
219 : : {
220 : : int err;
221 : : uint32_t tc, tcs;
222 : 0 : struct txgbe_adapter *ad = eth_dev->data->dev_private;
223 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
224 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
225 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(eth_dev);
226 : 0 : struct txgbe_vfta *shadow_vfta = TXGBE_DEV_VFTA(eth_dev);
227 : 0 : struct txgbe_hwstrip *hwstrip = TXGBE_DEV_HWSTRIP(eth_dev);
228 : 0 : struct rte_ether_addr *perm_addr =
229 : : (struct rte_ether_addr *)hw->mac.perm_addr;
230 : 0 : struct txgbe_filter_info *filter_info = TXGBE_DEV_FILTER(eth_dev);
231 : :
232 : 0 : PMD_INIT_FUNC_TRACE();
233 : :
234 : 0 : eth_dev->dev_ops = &txgbevf_eth_dev_ops;
235 : 0 : eth_dev->rx_descriptor_status = txgbe_dev_rx_descriptor_status;
236 : 0 : eth_dev->tx_descriptor_status = txgbe_dev_tx_descriptor_status;
237 : 0 : eth_dev->rx_pkt_burst = &txgbe_recv_pkts;
238 : 0 : eth_dev->tx_pkt_burst = &txgbe_xmit_pkts;
239 : :
240 : : /* for secondary processes, we don't initialise any further as primary
241 : : * has already done this work. Only check we don't need a different
242 : : * RX function
243 : : */
244 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
245 : : struct txgbe_tx_queue *txq;
246 : 0 : uint16_t nb_tx_queues = eth_dev->data->nb_tx_queues;
247 : : /* TX queue function in primary, set by last queue initialized
248 : : * Tx queue may not initialized by primary process
249 : : */
250 [ # # ]: 0 : if (eth_dev->data->tx_queues) {
251 : 0 : txq = eth_dev->data->tx_queues[nb_tx_queues - 1];
252 : 0 : txgbe_set_tx_function(eth_dev, txq);
253 : : } else {
254 : : /* Use default TX function if we get here */
255 : 0 : PMD_INIT_LOG(NOTICE,
256 : : "No TX queues configured yet. Using default TX function.");
257 : : }
258 : :
259 : 0 : txgbe_set_rx_function(eth_dev);
260 : :
261 : 0 : return 0;
262 : : }
263 : :
264 : 0 : rte_atomic_store_explicit(&ad->link_thread_running, 0, rte_memory_order_seq_cst);
265 : 0 : rte_eth_copy_pci_info(eth_dev, pci_dev);
266 : :
267 : 0 : hw->device_id = pci_dev->id.device_id;
268 : 0 : hw->vendor_id = pci_dev->id.vendor_id;
269 : 0 : hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
270 : 0 : hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
271 : 0 : hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
272 : :
273 : : /* initialize the vfta */
274 : : memset(shadow_vfta, 0, sizeof(*shadow_vfta));
275 : :
276 : : /* initialize the hw strip bitmap*/
277 : : memset(hwstrip, 0, sizeof(*hwstrip));
278 : :
279 : : /* Initialize the shared code (base driver) */
280 : 0 : err = txgbe_init_shared_code(hw);
281 [ # # ]: 0 : if (err != 0) {
282 : 0 : PMD_INIT_LOG(ERR,
283 : : "Shared code init failed for txgbevf: %d", err);
284 : 0 : return -EIO;
285 : : }
286 : :
287 : : /* init_mailbox_params */
288 : 0 : hw->mbx.init_params(hw);
289 : :
290 : : /* Reset the hw statistics */
291 : 0 : txgbevf_dev_stats_reset(eth_dev);
292 : :
293 : : /* Disable the interrupts for VF */
294 : 0 : txgbevf_intr_disable(eth_dev);
295 : :
296 : 0 : hw->mac.num_rar_entries = 128; /* The MAX of the underlying PF */
297 : 0 : err = hw->mac.reset_hw(hw);
298 : :
299 : : /*
300 : : * The VF reset operation returns the TXGBE_ERR_INVALID_MAC_ADDR when
301 : : * the underlying PF driver has not assigned a MAC address to the VF.
302 : : * In this case, assign a random MAC address.
303 : : */
304 [ # # ]: 0 : if (err != 0 && err != TXGBE_ERR_INVALID_MAC_ADDR) {
305 : 0 : PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", err);
306 : : /*
307 : : * This error code will be propagated to the app by
308 : : * rte_eth_dev_reset, so use a public error code rather than
309 : : * the internal-only TXGBE_ERR_RESET_FAILED
310 : : */
311 : 0 : return -EAGAIN;
312 : : }
313 : :
314 : : /* negotiate mailbox API version to use with the PF. */
315 : 0 : txgbevf_negotiate_api(hw);
316 : :
317 : : /* Get Rx/Tx queue count via mailbox, which is ready after reset_hw */
318 : 0 : txgbevf_get_queues(hw, &tcs, &tc);
319 : :
320 : : /* Allocate memory for storing MAC addresses */
321 : 0 : eth_dev->data->mac_addrs = rte_zmalloc("txgbevf", RTE_ETHER_ADDR_LEN *
322 : 0 : hw->mac.num_rar_entries, 0);
323 [ # # ]: 0 : if (eth_dev->data->mac_addrs == NULL) {
324 : 0 : PMD_INIT_LOG(ERR,
325 : : "Failed to allocate %u bytes needed to store "
326 : : "MAC addresses",
327 : : RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries);
328 : 0 : return -ENOMEM;
329 : : }
330 : :
331 : : /* Generate a random MAC address, if none was assigned by PF. */
332 [ # # ]: 0 : if (rte_is_zero_ether_addr(perm_addr)) {
333 : 0 : generate_random_mac_addr(perm_addr);
334 : 0 : err = txgbe_set_rar_vf(hw, 1, perm_addr->addr_bytes, 0, 1);
335 [ # # ]: 0 : if (err) {
336 : 0 : rte_free(eth_dev->data->mac_addrs);
337 : 0 : eth_dev->data->mac_addrs = NULL;
338 : 0 : return err;
339 : : }
340 : 0 : PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF");
341 : 0 : PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address "
342 : : RTE_ETHER_ADDR_PRT_FMT,
343 : : RTE_ETHER_ADDR_BYTES(perm_addr));
344 : : }
345 : :
346 : : /* Copy the permanent MAC address */
347 : 0 : rte_ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]);
348 : :
349 : : /* reset the hardware with the new settings */
350 : 0 : err = hw->mac.start_hw(hw);
351 [ # # ]: 0 : if (err) {
352 : 0 : PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", err);
353 : 0 : rte_free(eth_dev->data->mac_addrs);
354 : 0 : eth_dev->data->mac_addrs = NULL;
355 : 0 : return -EIO;
356 : : }
357 : :
358 : : /* enter promiscuous mode */
359 : : txgbevf_dev_promiscuous_enable(eth_dev);
360 : :
361 : 0 : rte_intr_callback_register(intr_handle,
362 : : txgbevf_dev_interrupt_handler, eth_dev);
363 : 0 : rte_intr_enable(intr_handle);
364 : 0 : txgbevf_intr_enable(eth_dev);
365 : :
366 : : /* initialize filter info */
367 : : memset(filter_info, 0,
368 : : sizeof(struct txgbe_filter_info));
369 : :
370 : : /* initialize 5tuple filter list */
371 : 0 : TAILQ_INIT(&filter_info->fivetuple_list);
372 : :
373 : : /* initialize flow filter lists */
374 : 0 : txgbe_filterlist_init();
375 : :
376 : 0 : PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x mac.type=%s",
377 : : eth_dev->data->port_id, pci_dev->id.vendor_id,
378 : : pci_dev->id.device_id, "txgbe_mac_sp_vf");
379 : :
380 : 0 : return 0;
381 : : }
382 : :
383 : : /* Virtual Function device uninit */
384 : : static int
385 : 0 : eth_txgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
386 : : {
387 : 0 : PMD_INIT_FUNC_TRACE();
388 : :
389 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY)
390 : : return 0;
391 : :
392 : 0 : txgbevf_dev_close(eth_dev);
393 : :
394 : 0 : return 0;
395 : : }
396 : :
397 : 0 : static int eth_txgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
398 : : struct rte_pci_device *pci_dev)
399 : : {
400 : 0 : return rte_eth_dev_pci_generic_probe(pci_dev,
401 : : sizeof(struct txgbe_adapter), eth_txgbevf_dev_init);
402 : : }
403 : :
404 : 0 : static int eth_txgbevf_pci_remove(struct rte_pci_device *pci_dev)
405 : : {
406 : 0 : return rte_eth_dev_pci_generic_remove(pci_dev, eth_txgbevf_dev_uninit);
407 : : }
408 : :
409 : : /*
410 : : * virtual function driver struct
411 : : */
412 : : static struct rte_pci_driver rte_txgbevf_pmd = {
413 : : .id_table = pci_id_txgbevf_map,
414 : : .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
415 : : .probe = eth_txgbevf_pci_probe,
416 : : .remove = eth_txgbevf_pci_remove,
417 : : };
418 : :
419 : 0 : static int txgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
420 : : struct rte_eth_xstat_name *xstats_names, unsigned int limit)
421 : : {
422 : : unsigned int i;
423 : :
424 [ # # ]: 0 : if (limit < TXGBEVF_NB_XSTATS && xstats_names != NULL)
425 : : return -ENOMEM;
426 : :
427 [ # # ]: 0 : if (xstats_names != NULL)
428 [ # # ]: 0 : for (i = 0; i < TXGBEVF_NB_XSTATS; i++)
429 : 0 : snprintf(xstats_names[i].name,
430 : : sizeof(xstats_names[i].name),
431 : 0 : "%s", rte_txgbevf_stats_strings[i].name);
432 : : return TXGBEVF_NB_XSTATS;
433 : : }
434 : :
435 : : static void
436 : 0 : txgbevf_update_stats(struct rte_eth_dev *dev)
437 : : {
438 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
439 : : struct txgbevf_hw_stats *hw_stats = (struct txgbevf_hw_stats *)
440 : : TXGBE_DEV_STATS(dev);
441 : : unsigned int i;
442 : :
443 [ # # ]: 0 : for (i = 0; i < dev->data->nb_rx_queues; i++) {
444 : : /* Good Rx packet, include VF loopback */
445 [ # # ]: 0 : TXGBE_UPDCNT32(TXGBE_QPRXPKT(i),
446 : : hw_stats->qp[i].last_vfgprc, hw_stats->qp[i].vfgprc);
447 : :
448 : : /* Good Rx octets, include VF loopback */
449 [ # # ]: 0 : TXGBE_UPDCNT36(TXGBE_QPRXOCTL(i),
450 : : hw_stats->qp[i].last_vfgorc, hw_stats->qp[i].vfgorc);
451 : :
452 : : /* Rx Multicst Packet */
453 [ # # ]: 0 : TXGBE_UPDCNT32(TXGBE_QPRXMPKT(i),
454 : : hw_stats->qp[i].last_vfmprc, hw_stats->qp[i].vfmprc);
455 : : }
456 : 0 : hw->rx_loaded = 0;
457 : :
458 [ # # ]: 0 : for (i = 0; i < dev->data->nb_tx_queues; i++) {
459 : : /* Good Tx packet, include VF loopback */
460 [ # # ]: 0 : TXGBE_UPDCNT32(TXGBE_QPTXPKT(i),
461 : : hw_stats->qp[i].last_vfgptc, hw_stats->qp[i].vfgptc);
462 : :
463 : : /* Good Tx octets, include VF loopback */
464 [ # # ]: 0 : TXGBE_UPDCNT36(TXGBE_QPTXOCTL(i),
465 : : hw_stats->qp[i].last_vfgotc, hw_stats->qp[i].vfgotc);
466 : : }
467 : 0 : hw->offset_loaded = 0;
468 : 0 : }
469 : :
470 : : static int
471 : 0 : txgbevf_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
472 : : unsigned int n)
473 : : {
474 : 0 : struct txgbevf_hw_stats *hw_stats = (struct txgbevf_hw_stats *)
475 : 0 : TXGBE_DEV_STATS(dev);
476 : : unsigned int i;
477 : :
478 [ # # ]: 0 : if (n < TXGBEVF_NB_XSTATS)
479 : : return TXGBEVF_NB_XSTATS;
480 : :
481 : 0 : txgbevf_update_stats(dev);
482 : :
483 [ # # ]: 0 : if (!xstats)
484 : : return 0;
485 : :
486 : : /* Extended stats */
487 [ # # ]: 0 : for (i = 0; i < TXGBEVF_NB_XSTATS; i++) {
488 : 0 : xstats[i].id = i;
489 : 0 : xstats[i].value = *(uint64_t *)(((char *)hw_stats) +
490 : 0 : rte_txgbevf_stats_strings[i].offset);
491 : : }
492 : :
493 : : return TXGBEVF_NB_XSTATS;
494 : : }
495 : :
496 : : static int
497 : 0 : txgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
498 : : struct eth_queue_stats *qstats __rte_unused)
499 : : {
500 : : struct txgbevf_hw_stats *hw_stats = (struct txgbevf_hw_stats *)
501 : 0 : TXGBE_DEV_STATS(dev);
502 : : uint32_t i;
503 : :
504 : 0 : txgbevf_update_stats(dev);
505 : :
506 [ # # ]: 0 : if (stats == NULL)
507 : : return -EINVAL;
508 : :
509 : 0 : stats->ipackets = 0;
510 : 0 : stats->ibytes = 0;
511 : 0 : stats->opackets = 0;
512 : 0 : stats->obytes = 0;
513 : :
514 [ # # ]: 0 : for (i = 0; i < 8; i++) {
515 : 0 : stats->ipackets += hw_stats->qp[i].vfgprc;
516 : 0 : stats->ibytes += hw_stats->qp[i].vfgorc;
517 : 0 : stats->opackets += hw_stats->qp[i].vfgptc;
518 : 0 : stats->obytes += hw_stats->qp[i].vfgotc;
519 : : }
520 : :
521 : : return 0;
522 : : }
523 : :
524 : : static int
525 : 0 : txgbevf_dev_stats_reset(struct rte_eth_dev *dev)
526 : : {
527 : : struct txgbevf_hw_stats *hw_stats = (struct txgbevf_hw_stats *)
528 : 0 : TXGBE_DEV_STATS(dev);
529 : : uint32_t i;
530 : :
531 : : /* Sync HW register to the last stats */
532 : : txgbevf_dev_stats_get(dev, NULL, NULL);
533 : :
534 : : /* reset HW current stats*/
535 [ # # ]: 0 : for (i = 0; i < 8; i++) {
536 : 0 : hw_stats->qp[i].vfgprc = 0;
537 : 0 : hw_stats->qp[i].vfgorc = 0;
538 : 0 : hw_stats->qp[i].vfgptc = 0;
539 : 0 : hw_stats->qp[i].vfgotc = 0;
540 : : }
541 : :
542 : 0 : return 0;
543 : : }
544 : :
545 : : static int
546 : 0 : txgbevf_dev_info_get(struct rte_eth_dev *dev,
547 : : struct rte_eth_dev_info *dev_info)
548 : : {
549 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
550 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
551 : :
552 : 0 : dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
553 : 0 : dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
554 : 0 : dev_info->min_rx_bufsize = 1024;
555 : 0 : dev_info->max_rx_pktlen = TXGBE_FRAME_SIZE_MAX;
556 : 0 : dev_info->max_mac_addrs = hw->mac.num_rar_entries;
557 : 0 : dev_info->max_hash_mac_addrs = TXGBE_VMDQ_NUM_UC_MAC;
558 : 0 : dev_info->max_vfs = pci_dev->max_vfs;
559 : 0 : dev_info->max_vmdq_pools = RTE_ETH_64_POOLS;
560 : 0 : dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
561 : 0 : dev_info->rx_queue_offload_capa = txgbe_get_rx_queue_offloads(dev);
562 : 0 : dev_info->rx_offload_capa = (txgbe_get_rx_port_offloads(dev) |
563 : 0 : dev_info->rx_queue_offload_capa);
564 : 0 : dev_info->tx_queue_offload_capa = txgbe_get_tx_queue_offloads(dev);
565 : 0 : dev_info->tx_offload_capa = txgbe_get_tx_port_offloads(dev);
566 : 0 : dev_info->hash_key_size = TXGBE_HKEY_MAX_INDEX * sizeof(uint32_t);
567 : 0 : dev_info->reta_size = RTE_ETH_RSS_RETA_SIZE_128;
568 : 0 : dev_info->flow_type_rss_offloads = TXGBE_RSS_OFFLOAD_ALL;
569 : :
570 : 0 : dev_info->default_rxconf = (struct rte_eth_rxconf) {
571 : : .rx_thresh = {
572 : : .pthresh = TXGBE_DEFAULT_RX_PTHRESH,
573 : : .hthresh = TXGBE_DEFAULT_RX_HTHRESH,
574 : : .wthresh = TXGBE_DEFAULT_RX_WTHRESH,
575 : : },
576 : : .rx_free_thresh = TXGBE_DEFAULT_RX_FREE_THRESH,
577 : : .rx_drop_en = 0,
578 : : .offloads = 0,
579 : : };
580 : :
581 : 0 : dev_info->default_txconf = (struct rte_eth_txconf) {
582 : : .tx_thresh = {
583 : : .pthresh = TXGBE_DEFAULT_TX_PTHRESH,
584 : : .hthresh = TXGBE_DEFAULT_TX_HTHRESH,
585 : : .wthresh = TXGBE_DEFAULT_TX_WTHRESH,
586 : : },
587 : : .tx_free_thresh = TXGBE_DEFAULT_TX_FREE_THRESH,
588 : : .offloads = 0,
589 : : };
590 : :
591 : 0 : dev_info->rx_desc_lim = rx_desc_lim;
592 : 0 : dev_info->tx_desc_lim = tx_desc_lim;
593 : :
594 : 0 : dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE;
595 : :
596 : 0 : return 0;
597 : : }
598 : :
599 : : static int
600 : 0 : txgbevf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
601 : : {
602 : 0 : return txgbe_dev_link_update_share(dev, wait_to_complete);
603 : : }
604 : :
605 : : /*
606 : : * Virtual Function operations
607 : : */
608 : : static void
609 : 0 : txgbevf_intr_disable(struct rte_eth_dev *dev)
610 : : {
611 : 0 : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
612 : : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
613 : :
614 : 0 : PMD_INIT_FUNC_TRACE();
615 : :
616 : : /* Clear interrupt mask to stop from interrupts being generated */
617 : : wr32(hw, TXGBE_VFIMS, TXGBE_VFIMS_MASK);
618 : :
619 : : txgbe_flush(hw);
620 : :
621 : : /* Clear mask value. */
622 : 0 : intr->mask_misc = TXGBE_VFIMS_MASK;
623 : 0 : }
624 : :
625 : : static void
626 : 0 : txgbevf_intr_enable(struct rte_eth_dev *dev)
627 : : {
628 : 0 : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
629 : : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
630 : :
631 : 0 : PMD_INIT_FUNC_TRACE();
632 : :
633 : : /* VF enable interrupt autoclean */
634 : : wr32(hw, TXGBE_VFIMC, TXGBE_VFIMC_MASK);
635 : :
636 : : txgbe_flush(hw);
637 : :
638 : 0 : intr->mask_misc = 0;
639 : 0 : }
640 : :
641 : : static int
642 : 0 : txgbevf_dev_configure(struct rte_eth_dev *dev)
643 : : {
644 : 0 : struct rte_eth_conf *conf = &dev->data->dev_conf;
645 : 0 : struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
646 : :
647 : 0 : PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d",
648 : : dev->data->port_id);
649 : :
650 [ # # ]: 0 : if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
651 : 0 : dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
652 : :
653 : : /*
654 : : * VF has no ability to enable/disable HW CRC
655 : : * Keep the persistent behavior the same as Host PF
656 : : */
657 : : #ifndef RTE_LIBRTE_TXGBE_PF_DISABLE_STRIP_CRC
658 [ # # ]: 0 : if (conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) {
659 : 0 : PMD_INIT_LOG(NOTICE, "VF can't disable HW CRC Strip");
660 : 0 : conf->rxmode.offloads &= ~RTE_ETH_RX_OFFLOAD_KEEP_CRC;
661 : : }
662 : : #else
663 : : if (!(conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC)) {
664 : : PMD_INIT_LOG(NOTICE, "VF can't enable HW CRC Strip");
665 : : conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_KEEP_CRC;
666 : : }
667 : : #endif
668 : :
669 : : /*
670 : : * Initialize to TRUE. If any of Rx queues doesn't meet the bulk
671 : : * allocation or vector Rx preconditions we will reset it.
672 : : */
673 : 0 : adapter->rx_bulk_alloc_allowed = true;
674 : 0 : adapter->rx_vec_allowed = true;
675 : :
676 : 0 : return 0;
677 : : }
678 : :
679 : : static int
680 : 0 : txgbevf_dev_start(struct rte_eth_dev *dev)
681 : : {
682 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
683 : : uint32_t intr_vector = 0;
684 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
685 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
686 : :
687 : : int err, mask = 0;
688 : :
689 : 0 : PMD_INIT_FUNC_TRACE();
690 : :
691 : : /* Stop the link setup handler before resetting the HW. */
692 : 0 : txgbe_dev_wait_setup_link_complete(dev, 0);
693 : :
694 : 0 : err = hw->mac.reset_hw(hw);
695 [ # # ]: 0 : if (err) {
696 : 0 : PMD_INIT_LOG(ERR, "Unable to reset vf hardware (%d)", err);
697 : 0 : return err;
698 : : }
699 : 0 : hw->mac.get_link_status = true;
700 : 0 : hw->dev_start = true;
701 : :
702 : : /* negotiate mailbox API version to use with the PF. */
703 : 0 : txgbevf_negotiate_api(hw);
704 : :
705 : 0 : txgbevf_dev_tx_init(dev);
706 : :
707 : : /* This can fail when allocating mbufs for descriptor rings */
708 : 0 : err = txgbevf_dev_rx_init(dev);
709 : :
710 : : /**
711 : : * In this case, reuses the MAC address assigned by VF
712 : : * initialization.
713 : : */
714 [ # # ]: 0 : if (err != 0 && err != TXGBE_ERR_INVALID_MAC_ADDR) {
715 : 0 : PMD_INIT_LOG(ERR, "Unable to initialize RX hardware (%d)", err);
716 : 0 : txgbe_dev_clear_queues(dev);
717 : 0 : return err;
718 : : }
719 : :
720 : : /* Set vfta */
721 : 0 : txgbevf_set_vfta_all(dev, 1);
722 : :
723 : : /* Set HW strip */
724 : : mask = RTE_ETH_VLAN_STRIP_MASK | RTE_ETH_VLAN_FILTER_MASK |
725 : : RTE_ETH_VLAN_EXTEND_MASK;
726 : 0 : err = txgbevf_vlan_offload_config(dev, mask);
727 [ # # ]: 0 : if (err) {
728 : 0 : PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err);
729 : 0 : txgbe_dev_clear_queues(dev);
730 : 0 : return err;
731 : : }
732 : :
733 : 0 : txgbevf_dev_rxtx_start(dev);
734 : :
735 : : /* check and configure queue intr-vector mapping */
736 [ # # ]: 0 : if (rte_intr_cap_multiple(intr_handle) &&
737 [ # # ]: 0 : dev->data->dev_conf.intr_conf.rxq) {
738 : : /* According to datasheet, only vector 0/1/2 can be used,
739 : : * now only one vector is used for Rx queue
740 : : */
741 : : intr_vector = 1;
742 [ # # ]: 0 : if (rte_intr_efd_enable(intr_handle, intr_vector)) {
743 : 0 : txgbe_dev_clear_queues(dev);
744 : 0 : return -1;
745 : : }
746 : : }
747 : :
748 [ # # ]: 0 : if (rte_intr_dp_is_en(intr_handle)) {
749 [ # # ]: 0 : if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
750 : 0 : dev->data->nb_rx_queues)) {
751 : 0 : PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
752 : : " intr_vec", dev->data->nb_rx_queues);
753 : 0 : txgbe_dev_clear_queues(dev);
754 : 0 : return -ENOMEM;
755 : : }
756 : : }
757 : 0 : txgbevf_configure_msix(dev);
758 : :
759 : : /* When a VF port is bound to VFIO-PCI, only miscellaneous interrupt
760 : : * is mapped to VFIO vector 0 in eth_txgbevf_dev_init( ).
761 : : * If previous VFIO interrupt mapping setting in eth_txgbevf_dev_init( )
762 : : * is not cleared, it will fail when following rte_intr_enable( ) tries
763 : : * to map Rx queue interrupt to other VFIO vectors.
764 : : * So clear uio/vfio intr/evevnfd first to avoid failure.
765 : : */
766 : 0 : rte_intr_disable(intr_handle);
767 : :
768 : 0 : rte_intr_enable(intr_handle);
769 : :
770 : : /* Re-enable interrupt for VF */
771 : 0 : txgbevf_intr_enable(dev);
772 : :
773 : : /*
774 : : * Update link status right before return, because it may
775 : : * start link configuration process in a separate thread.
776 : : */
777 : : txgbevf_dev_link_update(dev, 0);
778 : :
779 : 0 : hw->adapter_stopped = false;
780 : :
781 : 0 : return 0;
782 : : }
783 : :
784 : : static int
785 : 0 : txgbevf_dev_stop(struct rte_eth_dev *dev)
786 : : {
787 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
788 : : struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
789 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
790 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
791 : :
792 [ # # ]: 0 : if (hw->adapter_stopped)
793 : : return 0;
794 : :
795 : 0 : PMD_INIT_FUNC_TRACE();
796 : :
797 : 0 : txgbe_dev_wait_setup_link_complete(dev, 0);
798 : :
799 : 0 : txgbevf_intr_disable(dev);
800 : :
801 : 0 : hw->adapter_stopped = 1;
802 : 0 : hw->mac.stop_hw(hw);
803 : :
804 : : /*
805 : : * Clear what we set, but we still keep shadow_vfta to
806 : : * restore after device starts
807 : : */
808 : 0 : txgbevf_set_vfta_all(dev, 0);
809 : :
810 : : /* Clear stored conf */
811 : 0 : dev->data->scattered_rx = 0;
812 : :
813 : 0 : txgbe_dev_clear_queues(dev);
814 : :
815 : : /* Clean datapath event and queue/vec mapping */
816 : 0 : rte_intr_efd_disable(intr_handle);
817 : 0 : rte_intr_vec_list_free(intr_handle);
818 : :
819 : 0 : adapter->rss_reta_updated = 0;
820 : 0 : hw->dev_start = false;
821 : :
822 : 0 : return 0;
823 : : }
824 : :
825 : : static int
826 : 0 : txgbevf_dev_close(struct rte_eth_dev *dev)
827 : : {
828 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
829 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
830 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
831 : : int ret;
832 : :
833 : 0 : PMD_INIT_FUNC_TRACE();
834 [ # # ]: 0 : if (rte_eal_process_type() != RTE_PROC_PRIMARY)
835 : : return 0;
836 : :
837 : 0 : hw->mac.reset_hw(hw);
838 : :
839 : 0 : ret = txgbevf_dev_stop(dev);
840 : :
841 : 0 : txgbe_dev_free_queues(dev);
842 : :
843 : : /**
844 : : * Remove the VF MAC address ro ensure
845 : : * that the VF traffic goes to the PF
846 : : * after stop, close and detach of the VF
847 : : **/
848 : 0 : txgbevf_remove_mac_addr(dev, 0);
849 : :
850 : 0 : dev->rx_pkt_burst = NULL;
851 : 0 : dev->tx_pkt_burst = NULL;
852 : :
853 : : /* Disable the interrupts for VF */
854 : 0 : txgbevf_intr_disable(dev);
855 : :
856 : 0 : rte_free(dev->data->mac_addrs);
857 : 0 : dev->data->mac_addrs = NULL;
858 : :
859 : 0 : rte_intr_disable(intr_handle);
860 : 0 : rte_intr_callback_unregister(intr_handle,
861 : : txgbevf_dev_interrupt_handler, dev);
862 : :
863 : : /* Remove all ntuple filters of the device */
864 : 0 : txgbe_ntuple_filter_uninit(dev);
865 : :
866 : : /* clear all the filters list */
867 : 0 : txgbe_filterlist_flush();
868 : :
869 : 0 : return ret;
870 : : }
871 : :
872 : : /*
873 : : * Reset VF device
874 : : */
875 : : static int
876 : 0 : txgbevf_dev_reset(struct rte_eth_dev *dev)
877 : : {
878 : : int ret;
879 : :
880 : 0 : ret = eth_txgbevf_dev_uninit(dev);
881 [ # # ]: 0 : if (ret)
882 : : return ret;
883 : :
884 : 0 : ret = eth_txgbevf_dev_init(dev);
885 : :
886 : 0 : return ret;
887 : : }
888 : :
889 : 0 : static void txgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on)
890 : : {
891 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
892 : : struct txgbe_vfta *shadow_vfta = TXGBE_DEV_VFTA(dev);
893 : : int i = 0, j = 0, vfta = 0, mask = 1;
894 : :
895 [ # # ]: 0 : for (i = 0; i < TXGBE_VFTA_SIZE; i++) {
896 : 0 : vfta = shadow_vfta->vfta[i];
897 [ # # ]: 0 : if (vfta) {
898 : : mask = 1;
899 [ # # ]: 0 : for (j = 0; j < 32; j++) {
900 [ # # ]: 0 : if (vfta & mask)
901 : 0 : hw->mac.set_vfta(hw, (i << 5) + j, 0,
902 : : on, false);
903 : 0 : mask <<= 1;
904 : : }
905 : : }
906 : : }
907 : 0 : }
908 : :
909 : : static int
910 : 0 : txgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
911 : : {
912 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
913 : : struct txgbe_vfta *shadow_vfta = TXGBE_DEV_VFTA(dev);
914 : : uint32_t vid_idx = 0;
915 : : uint32_t vid_bit = 0;
916 : : int ret = 0;
917 : :
918 : 0 : PMD_INIT_FUNC_TRACE();
919 : :
920 : : /* vind is not used in VF driver, set to 0, check txgbe_set_vfta_vf */
921 : 0 : ret = hw->mac.set_vfta(hw, vlan_id, 0, !!on, false);
922 [ # # ]: 0 : if (ret) {
923 : 0 : PMD_INIT_LOG(ERR, "Unable to set VF vlan");
924 : 0 : return ret;
925 : : }
926 : 0 : vid_idx = (uint32_t)((vlan_id >> 5) & 0x7F);
927 : 0 : vid_bit = (uint32_t)(1 << (vlan_id & 0x1F));
928 : :
929 : : /* Save what we set and restore it after device reset */
930 [ # # ]: 0 : if (on)
931 : 0 : shadow_vfta->vfta[vid_idx] |= vid_bit;
932 : : else
933 : 0 : shadow_vfta->vfta[vid_idx] &= ~vid_bit;
934 : :
935 : : return 0;
936 : : }
937 : :
938 : : static void
939 : 0 : txgbevf_vlan_strip_q_set(struct rte_eth_dev *dev, uint16_t queue, int on)
940 : : {
941 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
942 : : uint32_t ctrl;
943 : :
944 : 0 : PMD_INIT_FUNC_TRACE();
945 : :
946 [ # # ]: 0 : if (queue >= hw->mac.max_rx_queues)
947 : : return;
948 : :
949 : 0 : ctrl = rd32(hw, TXGBE_RXCFG(queue));
950 [ # # ]: 0 : if (on)
951 : 0 : ctrl |= TXGBE_RXCFG_VLAN;
952 : : else
953 : 0 : ctrl &= ~TXGBE_RXCFG_VLAN;
954 : : wr32(hw, TXGBE_RXCFG(queue), ctrl);
955 : :
956 : 0 : txgbe_vlan_hw_strip_bitmap_set(dev, queue, on);
957 : : }
958 : :
959 : : static void
960 : 0 : txgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
961 : : {
962 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
963 : :
964 [ # # ]: 0 : if (!hw->adapter_stopped) {
965 : 0 : PMD_DRV_LOG(ERR, "Please stop port first");
966 : 0 : return;
967 : : }
968 : :
969 : 0 : txgbevf_vlan_strip_q_set(dev, queue, on);
970 : : }
971 : :
972 : : static int
973 : 0 : txgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask)
974 : : {
975 : : struct txgbe_rx_queue *rxq;
976 : : uint16_t i;
977 : : int on = 0;
978 : :
979 : : /* VF function only support hw strip feature, others are not support */
980 [ # # ]: 0 : if (mask & RTE_ETH_VLAN_STRIP_MASK) {
981 [ # # ]: 0 : for (i = 0; i < dev->data->nb_rx_queues; i++) {
982 : 0 : rxq = dev->data->rx_queues[i];
983 : 0 : on = !!(rxq->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP);
984 : 0 : txgbevf_vlan_strip_q_set(dev, i, on);
985 : : }
986 : : }
987 : :
988 : 0 : return 0;
989 : : }
990 : :
991 : : static int
992 : 0 : txgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
993 : : {
994 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
995 : :
996 [ # # # # ]: 0 : if (!hw->adapter_stopped && (mask & RTE_ETH_VLAN_STRIP_MASK)) {
997 : 0 : PMD_DRV_LOG(ERR, "Please stop port first");
998 : 0 : return -EPERM;
999 : : }
1000 : :
1001 : 0 : txgbe_config_vlan_strip_on_all_queues(dev, mask);
1002 : :
1003 : 0 : txgbevf_vlan_offload_config(dev, mask);
1004 : :
1005 : 0 : return 0;
1006 : : }
1007 : :
1008 : : static int
1009 : 0 : txgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
1010 : : {
1011 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1012 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
1013 : 0 : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
1014 : : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1015 : : uint32_t vec = TXGBE_MISC_VEC_ID;
1016 : :
1017 [ # # ]: 0 : if (rte_intr_allow_others(intr_handle))
1018 : : vec = TXGBE_RX_VEC_START;
1019 : 0 : intr->mask_misc &= ~(1 << vec);
1020 : : RTE_SET_USED(queue_id);
1021 : 0 : wr32(hw, TXGBE_VFIMC, ~intr->mask_misc);
1022 : :
1023 : 0 : rte_intr_enable(intr_handle);
1024 : :
1025 : 0 : return 0;
1026 : : }
1027 : :
1028 : : static int
1029 : 0 : txgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
1030 : : {
1031 : 0 : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
1032 : : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1033 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1034 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
1035 : : uint32_t vec = TXGBE_MISC_VEC_ID;
1036 : :
1037 [ # # ]: 0 : if (rte_intr_allow_others(intr_handle))
1038 : : vec = TXGBE_RX_VEC_START;
1039 : 0 : intr->mask_misc |= (1 << vec);
1040 : : RTE_SET_USED(queue_id);
1041 : : wr32(hw, TXGBE_VFIMS, intr->mask_misc);
1042 : :
1043 : 0 : return 0;
1044 : : }
1045 : :
1046 : : static void
1047 : 0 : txgbevf_set_ivar_map(struct txgbe_hw *hw, int8_t direction,
1048 : : uint8_t queue, uint8_t msix_vector)
1049 : : {
1050 : : uint32_t tmp, idx;
1051 : :
1052 [ # # ]: 0 : if (direction == -1) {
1053 : : /* other causes */
1054 : 0 : msix_vector |= TXGBE_VFIVAR_VLD;
1055 : : tmp = rd32(hw, TXGBE_VFIVARMISC);
1056 : 0 : tmp &= ~0xFF;
1057 : 0 : tmp |= msix_vector;
1058 : : wr32(hw, TXGBE_VFIVARMISC, tmp);
1059 : : } else {
1060 : : /* rx or tx cause */
1061 : 0 : msix_vector |= TXGBE_VFIVAR_VLD; /* Workaround for ICR lost */
1062 : 0 : idx = ((16 * (queue & 1)) + (8 * direction));
1063 : 0 : tmp = rd32(hw, TXGBE_VFIVAR(queue >> 1));
1064 : 0 : tmp &= ~(0xFF << idx);
1065 : 0 : tmp |= (msix_vector << idx);
1066 : : wr32(hw, TXGBE_VFIVAR(queue >> 1), tmp);
1067 : : }
1068 : 0 : }
1069 : :
1070 : : static void
1071 : 0 : txgbevf_configure_msix(struct rte_eth_dev *dev)
1072 : : {
1073 : 0 : struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1074 : 0 : struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
1075 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1076 : : uint32_t q_idx;
1077 : : uint32_t vector_idx = TXGBE_MISC_VEC_ID;
1078 : : uint32_t base = TXGBE_MISC_VEC_ID;
1079 : :
1080 : : /* Configure VF other cause ivar */
1081 : : txgbevf_set_ivar_map(hw, -1, 1, vector_idx);
1082 : :
1083 : : /* won't configure msix register if no mapping is done
1084 : : * between intr vector and event fd.
1085 : : */
1086 [ # # ]: 0 : if (!rte_intr_dp_is_en(intr_handle))
1087 : : return;
1088 : :
1089 [ # # ]: 0 : if (rte_intr_allow_others(intr_handle)) {
1090 : : base = TXGBE_RX_VEC_START;
1091 : : vector_idx = TXGBE_RX_VEC_START;
1092 : : }
1093 : :
1094 : : /* Configure all RX queues of VF */
1095 [ # # ]: 0 : for (q_idx = 0; q_idx < dev->data->nb_rx_queues; q_idx++) {
1096 : : /* Force all queue use vector 0,
1097 : : * as TXGBE_VF_MAXMSIVECTOR = 1
1098 : : */
1099 : 0 : txgbevf_set_ivar_map(hw, 0, q_idx, vector_idx);
1100 : 0 : rte_intr_vec_list_index_set(intr_handle, q_idx,
1101 : : vector_idx);
1102 : 0 : if (vector_idx < base + rte_intr_nb_efd_get(intr_handle)
1103 [ # # ]: 0 : - 1)
1104 : 0 : vector_idx++;
1105 : : }
1106 : :
1107 : : /* As RX queue setting above show, all queues use the vector 0.
1108 : : * Set only the ITR value of TXGBE_MISC_VEC_ID.
1109 : : */
1110 : : wr32(hw, TXGBE_ITR(TXGBE_MISC_VEC_ID),
1111 : : TXGBE_ITR_IVAL(TXGBE_QUEUE_ITR_INTERVAL_DEFAULT)
1112 : : | TXGBE_ITR_WRDSA);
1113 : : }
1114 : :
1115 : : static int
1116 : 0 : txgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
1117 : : __rte_unused uint32_t index,
1118 : : __rte_unused uint32_t pool)
1119 : : {
1120 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1121 : : int err;
1122 : :
1123 : : /*
1124 : : * On a VF, adding again the same MAC addr is not an idempotent
1125 : : * operation. Trap this case to avoid exhausting the [very limited]
1126 : : * set of PF resources used to store VF MAC addresses.
1127 : : */
1128 [ # # ]: 0 : if (memcmp(hw->mac.perm_addr, mac_addr,
1129 : : sizeof(struct rte_ether_addr)) == 0)
1130 : : return -1;
1131 : 0 : err = txgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
1132 [ # # ]: 0 : if (err != 0)
1133 : 0 : PMD_DRV_LOG(ERR, "Unable to add MAC address "
1134 : : RTE_ETHER_ADDR_PRT_FMT " - err=%d",
1135 : : RTE_ETHER_ADDR_BYTES(mac_addr), err);
1136 : : return err;
1137 : : }
1138 : :
1139 : : static void
1140 : 0 : txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
1141 : : {
1142 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1143 : 0 : struct rte_ether_addr *perm_addr =
1144 : : (struct rte_ether_addr *)hw->mac.perm_addr;
1145 : : struct rte_ether_addr *mac_addr;
1146 : : uint32_t i;
1147 : : int err;
1148 : :
1149 : : /*
1150 : : * The TXGBE_VF_SET_MACVLAN command of the txgbe-pf driver does
1151 : : * not support the deletion of a given MAC address.
1152 : : * Instead, it imposes to delete all MAC addresses, then to add again
1153 : : * all MAC addresses with the exception of the one to be deleted.
1154 : : */
1155 : 0 : (void)txgbevf_set_uc_addr_vf(hw, 0, NULL);
1156 : :
1157 : : /*
1158 : : * Add again all MAC addresses, with the exception of the deleted one
1159 : : * and of the permanent MAC address.
1160 : : */
1161 : 0 : for (i = 0, mac_addr = dev->data->mac_addrs;
1162 [ # # ]: 0 : i < hw->mac.num_rar_entries; i++, mac_addr++) {
1163 : : /* Skip the deleted MAC address */
1164 [ # # ]: 0 : if (i == index)
1165 : 0 : continue;
1166 : : /* Skip NULL MAC addresses */
1167 [ # # ]: 0 : if (rte_is_zero_ether_addr(mac_addr))
1168 : 0 : continue;
1169 : : /* Skip the permanent MAC address */
1170 [ # # ]: 0 : if (memcmp(perm_addr, mac_addr,
1171 : : sizeof(struct rte_ether_addr)) == 0)
1172 : 0 : continue;
1173 : 0 : err = txgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
1174 [ # # ]: 0 : if (err != 0)
1175 : 0 : PMD_DRV_LOG(ERR,
1176 : : "Adding again MAC address "
1177 : : RTE_ETHER_ADDR_PRT_FMT " failed "
1178 : : "err=%d",
1179 : : RTE_ETHER_ADDR_BYTES(mac_addr), err);
1180 : : }
1181 : 0 : }
1182 : :
1183 : : static int
1184 : 0 : txgbevf_set_default_mac_addr(struct rte_eth_dev *dev,
1185 : : struct rte_ether_addr *addr)
1186 : : {
1187 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1188 : :
1189 : 0 : hw->mac.set_rar(hw, 0, (void *)addr, 0, 0);
1190 : :
1191 : 0 : return 0;
1192 : : }
1193 : :
1194 : : static int
1195 : 0 : txgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
1196 : : {
1197 : : struct txgbe_hw *hw;
1198 : 0 : uint32_t max_frame = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
1199 : 0 : struct rte_eth_dev_data *dev_data = dev->data;
1200 : :
1201 : 0 : hw = TXGBE_DEV_HW(dev);
1202 : :
1203 : 0 : if (mtu < RTE_ETHER_MIN_MTU ||
1204 [ # # ]: 0 : max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
1205 : : return -EINVAL;
1206 : :
1207 : : /* If device is started, refuse mtu that requires the support of
1208 : : * scattered packets when this feature has not been enabled before.
1209 : : */
1210 [ # # ]: 0 : if (dev_data->dev_started && !dev_data->scattered_rx &&
1211 : 0 : (max_frame + 2 * RTE_VLAN_HLEN >
1212 [ # # ]: 0 : dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
1213 : 0 : PMD_INIT_LOG(ERR, "Stop port first.");
1214 : 0 : return -EINVAL;
1215 : : }
1216 : :
1217 : : /*
1218 : : * When supported by the underlying PF driver, use the TXGBE_VF_SET_MTU
1219 : : * request of the version 2.0 of the mailbox API.
1220 : : * For now, use the TXGBE_VF_SET_LPE request of the version 1.0
1221 : : * of the mailbox API.
1222 : : */
1223 [ # # ]: 0 : if (txgbevf_rlpml_set_vf(hw, max_frame))
1224 : 0 : return -EINVAL;
1225 : :
1226 : : return 0;
1227 : : }
1228 : :
1229 : : static int
1230 : : txgbevf_get_reg_length(struct rte_eth_dev *dev __rte_unused)
1231 : : {
1232 : : int count = 0;
1233 : : int g_ind = 0;
1234 : : const struct reg_info *reg_group;
1235 : :
1236 [ # # # # ]: 0 : while ((reg_group = txgbevf_regs[g_ind++]))
1237 : 0 : count += txgbe_regs_group_count(reg_group);
1238 : :
1239 : : return count;
1240 : : }
1241 : :
1242 : : static int
1243 : 0 : txgbevf_get_regs(struct rte_eth_dev *dev,
1244 : : struct rte_dev_reg_info *regs)
1245 : : {
1246 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1247 : 0 : uint32_t *data = regs->data;
1248 : : int g_ind = 0;
1249 : : int count = 0;
1250 : : const struct reg_info *reg_group;
1251 : :
1252 [ # # ]: 0 : if (data == NULL) {
1253 : 0 : regs->length = txgbevf_get_reg_length(dev);
1254 : 0 : regs->width = sizeof(uint32_t);
1255 : 0 : return 0;
1256 : : }
1257 : :
1258 : : /* Support only full register dump */
1259 [ # # ]: 0 : if (regs->length == 0 ||
1260 [ # # ]: 0 : regs->length == (uint32_t)txgbevf_get_reg_length(dev)) {
1261 : 0 : regs->version = hw->mac.type << 24 | hw->revision_id << 16 |
1262 : 0 : hw->device_id;
1263 [ # # ]: 0 : while ((reg_group = txgbevf_regs[g_ind++]))
1264 : 0 : count += txgbe_read_regs_group(dev, &data[count],
1265 : : reg_group);
1266 : : return 0;
1267 : : }
1268 : :
1269 : : return -ENOTSUP;
1270 : : }
1271 : :
1272 : : static int
1273 : 0 : txgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
1274 : : {
1275 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1276 : : int ret;
1277 : :
1278 [ # # # ]: 0 : switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_PROMISC)) {
1279 : : case 0:
1280 : : ret = 0;
1281 : : break;
1282 : 0 : case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
1283 : : ret = -ENOTSUP;
1284 : 0 : break;
1285 : 0 : default:
1286 : : ret = -EAGAIN;
1287 : 0 : break;
1288 : : }
1289 : :
1290 : 0 : return ret;
1291 : : }
1292 : :
1293 : : static int
1294 : 0 : txgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
1295 : : {
1296 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1297 : : int mode = TXGBEVF_XCAST_MODE_NONE;
1298 : : int ret;
1299 : :
1300 [ # # ]: 0 : if (dev->data->all_multicast)
1301 : : mode = TXGBEVF_XCAST_MODE_ALLMULTI;
1302 : :
1303 [ # # # ]: 0 : switch (hw->mac.update_xcast_mode(hw, mode)) {
1304 : : case 0:
1305 : : ret = 0;
1306 : : break;
1307 : 0 : case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
1308 : : ret = -ENOTSUP;
1309 : 0 : break;
1310 : 0 : default:
1311 : : ret = -EAGAIN;
1312 : 0 : break;
1313 : : }
1314 : :
1315 : 0 : return ret;
1316 : : }
1317 : :
1318 : : static int
1319 : 0 : txgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
1320 : : {
1321 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1322 : : int ret;
1323 : :
1324 [ # # ]: 0 : if (dev->data->promiscuous)
1325 : : return 0;
1326 : :
1327 [ # # # ]: 0 : switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_ALLMULTI)) {
1328 : : case 0:
1329 : : ret = 0;
1330 : : break;
1331 : 0 : case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
1332 : : ret = -ENOTSUP;
1333 : 0 : break;
1334 : 0 : default:
1335 : : ret = -EAGAIN;
1336 : 0 : break;
1337 : : }
1338 : :
1339 : : return ret;
1340 : : }
1341 : :
1342 : : static int
1343 : 0 : txgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
1344 : : {
1345 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1346 : : int ret;
1347 : :
1348 [ # # ]: 0 : if (dev->data->promiscuous)
1349 : : return 0;
1350 : :
1351 [ # # # ]: 0 : switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_MULTI)) {
1352 : : case 0:
1353 : : ret = 0;
1354 : : break;
1355 : 0 : case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
1356 : : ret = -ENOTSUP;
1357 : 0 : break;
1358 : 0 : default:
1359 : : ret = -EAGAIN;
1360 : 0 : break;
1361 : : }
1362 : :
1363 : : return ret;
1364 : : }
1365 : :
1366 : 0 : static void txgbevf_mbx_process(struct rte_eth_dev *dev)
1367 : : {
1368 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1369 : 0 : u32 in_msg = 0;
1370 : :
1371 : : /* peek the message first */
1372 : 0 : in_msg = rd32(hw, TXGBE_VFMBX);
1373 : :
1374 : : /* PF reset VF event */
1375 [ # # ]: 0 : if (in_msg == TXGBE_PF_CONTROL_MSG) {
1376 : : /* dummy mbx read to ack pf */
1377 [ # # ]: 0 : if (txgbe_read_mbx(hw, &in_msg, 1, 0))
1378 : 0 : return;
1379 : 0 : rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
1380 : : NULL);
1381 : : }
1382 : : }
1383 : :
1384 : : static int
1385 : 0 : txgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev)
1386 : : {
1387 : : uint32_t eicr;
1388 : 0 : struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
1389 : : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
1390 : 0 : txgbevf_intr_disable(dev);
1391 : :
1392 : : /* read-on-clear nic registers here */
1393 : : eicr = rd32(hw, TXGBE_VFICR);
1394 : : intr->flags = 0;
1395 : :
1396 : : /* only one misc vector supported - mailbox */
1397 : : eicr &= TXGBE_VFICR_MASK;
1398 : : /* Workaround for ICR lost */
1399 : 0 : intr->flags |= TXGBE_FLAG_MAILBOX;
1400 : :
1401 : : /* To avoid compiler warnings set eicr to used. */
1402 : : RTE_SET_USED(eicr);
1403 : :
1404 : 0 : return 0;
1405 : : }
1406 : :
1407 : : static int
1408 : 0 : txgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
1409 : : {
1410 : 0 : struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
1411 : :
1412 [ # # ]: 0 : if (intr->flags & TXGBE_FLAG_MAILBOX) {
1413 : 0 : txgbevf_mbx_process(dev);
1414 : 0 : intr->flags &= ~TXGBE_FLAG_MAILBOX;
1415 : : }
1416 : :
1417 : 0 : txgbevf_intr_enable(dev);
1418 : :
1419 : 0 : return 0;
1420 : : }
1421 : :
1422 : : static void
1423 : 0 : txgbevf_dev_interrupt_handler(void *param)
1424 : : {
1425 : : struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
1426 : :
1427 : 0 : txgbevf_dev_interrupt_get_status(dev);
1428 : 0 : txgbevf_dev_interrupt_action(dev);
1429 : 0 : }
1430 : :
1431 : : static int
1432 : 0 : txgbevf_dev_flow_ops_get(__rte_unused struct rte_eth_dev *dev,
1433 : : const struct rte_flow_ops **ops)
1434 : : {
1435 : 0 : *ops = &txgbe_flow_ops;
1436 : 0 : return 0;
1437 : : }
1438 : :
1439 : : /*
1440 : : * dev_ops for virtual function, bare necessities for basic vf
1441 : : * operation have been implemented
1442 : : */
1443 : : static const struct eth_dev_ops txgbevf_eth_dev_ops = {
1444 : : .dev_configure = txgbevf_dev_configure,
1445 : : .dev_start = txgbevf_dev_start,
1446 : : .dev_stop = txgbevf_dev_stop,
1447 : : .link_update = txgbevf_dev_link_update,
1448 : : .stats_get = txgbevf_dev_stats_get,
1449 : : .xstats_get = txgbevf_dev_xstats_get,
1450 : : .stats_reset = txgbevf_dev_stats_reset,
1451 : : .xstats_reset = txgbevf_dev_stats_reset,
1452 : : .xstats_get_names = txgbevf_dev_xstats_get_names,
1453 : : .dev_close = txgbevf_dev_close,
1454 : : .dev_reset = txgbevf_dev_reset,
1455 : : .promiscuous_enable = txgbevf_dev_promiscuous_enable,
1456 : : .promiscuous_disable = txgbevf_dev_promiscuous_disable,
1457 : : .allmulticast_enable = txgbevf_dev_allmulticast_enable,
1458 : : .allmulticast_disable = txgbevf_dev_allmulticast_disable,
1459 : : .dev_infos_get = txgbevf_dev_info_get,
1460 : : .dev_supported_ptypes_get = txgbe_dev_supported_ptypes_get,
1461 : : .mtu_set = txgbevf_dev_set_mtu,
1462 : : .vlan_filter_set = txgbevf_vlan_filter_set,
1463 : : .vlan_strip_queue_set = txgbevf_vlan_strip_queue_set,
1464 : : .vlan_offload_set = txgbevf_vlan_offload_set,
1465 : : .rx_queue_setup = txgbe_dev_rx_queue_setup,
1466 : : .rx_queue_release = txgbe_dev_rx_queue_release,
1467 : : .tx_queue_setup = txgbe_dev_tx_queue_setup,
1468 : : .tx_queue_release = txgbe_dev_tx_queue_release,
1469 : : .rx_queue_intr_enable = txgbevf_dev_rx_queue_intr_enable,
1470 : : .rx_queue_intr_disable = txgbevf_dev_rx_queue_intr_disable,
1471 : : .mac_addr_add = txgbevf_add_mac_addr,
1472 : : .mac_addr_remove = txgbevf_remove_mac_addr,
1473 : : .set_mc_addr_list = txgbe_dev_set_mc_addr_list,
1474 : : .rxq_info_get = txgbe_rxq_info_get,
1475 : : .txq_info_get = txgbe_txq_info_get,
1476 : : .mac_addr_set = txgbevf_set_default_mac_addr,
1477 : : .get_reg = txgbevf_get_regs,
1478 : : .reta_update = txgbe_dev_rss_reta_update,
1479 : : .reta_query = txgbe_dev_rss_reta_query,
1480 : : .rss_hash_update = txgbe_dev_rss_hash_update,
1481 : : .rss_hash_conf_get = txgbe_dev_rss_hash_conf_get,
1482 : : .tx_done_cleanup = txgbe_dev_tx_done_cleanup,
1483 : : .flow_ops_get = txgbevf_dev_flow_ops_get,
1484 : : };
1485 : :
1486 : 253 : RTE_PMD_REGISTER_PCI(net_txgbe_vf, rte_txgbevf_pmd);
1487 : : RTE_PMD_REGISTER_PCI_TABLE(net_txgbe_vf, pci_id_txgbevf_map);
1488 : : RTE_PMD_REGISTER_KMOD_DEP(net_txgbe_vf, "* igb_uio | vfio-pci");
|