1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
5 #include <rte_string_fns.h>
6 #include <ethdev_driver.h>
7 #include <ethdev_pci.h>
8 #include <rte_cycles.h>
9 #include <rte_malloc.h>
10 #include <rte_alarm.h>
11 #include <rte_ether.h>
14 #include "lio_23xx_vf.h"
15 #include "lio_ethdev.h"
18 /* Default RSS key in use */
19 static uint8_t lio_rss_key[40] = {
20 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2,
21 0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0,
22 0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4,
23 0x77, 0xCB, 0x2D, 0xA3, 0x80, 0x30, 0xF2, 0x0C,
24 0x6A, 0x42, 0xB7, 0x3B, 0xBE, 0xAC, 0x01, 0xFA,
27 static const struct rte_eth_desc_lim lio_rx_desc_lim = {
28 .nb_max = CN23XX_MAX_OQ_DESCRIPTORS,
29 .nb_min = CN23XX_MIN_OQ_DESCRIPTORS,
33 static const struct rte_eth_desc_lim lio_tx_desc_lim = {
34 .nb_max = CN23XX_MAX_IQ_DESCRIPTORS,
35 .nb_min = CN23XX_MIN_IQ_DESCRIPTORS,
39 /* Wait for control command to reach nic. */
41 lio_wait_for_ctrl_cmd(struct lio_device *lio_dev,
42 struct lio_dev_ctrl_cmd *ctrl_cmd)
44 uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
46 while ((ctrl_cmd->cond == 0) && --timeout) {
47 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
55 * \brief Send Rx control command
56 * @param eth_dev Pointer to the structure rte_eth_dev
57 * @param start_stop whether to start or stop
60 lio_send_rx_ctrl_cmd(struct rte_eth_dev *eth_dev, int start_stop)
62 struct lio_device *lio_dev = LIO_DEV(eth_dev);
63 struct lio_dev_ctrl_cmd ctrl_cmd;
64 struct lio_ctrl_pkt ctrl_pkt;
66 /* flush added to prevent cmd failure
67 * incase the queue is full
69 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
71 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
72 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
74 ctrl_cmd.eth_dev = eth_dev;
77 ctrl_pkt.ncmd.s.cmd = LIO_CMD_RX_CTL;
78 ctrl_pkt.ncmd.s.param1 = start_stop;
79 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
81 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
82 lio_dev_err(lio_dev, "Failed to send RX Control message\n");
86 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
87 lio_dev_err(lio_dev, "RX Control command timed out\n");
94 /* store statistics names and its offset in stats structure */
95 struct rte_lio_xstats_name_off {
96 char name[RTE_ETH_XSTATS_NAME_SIZE];
100 static const struct rte_lio_xstats_name_off rte_lio_stats_strings[] = {
101 {"rx_pkts", offsetof(struct octeon_rx_stats, total_rcvd)},
102 {"rx_bytes", offsetof(struct octeon_rx_stats, bytes_rcvd)},
103 {"rx_broadcast_pkts", offsetof(struct octeon_rx_stats, total_bcst)},
104 {"rx_multicast_pkts", offsetof(struct octeon_rx_stats, total_mcst)},
105 {"rx_flow_ctrl_pkts", offsetof(struct octeon_rx_stats, ctl_rcvd)},
106 {"rx_fifo_err", offsetof(struct octeon_rx_stats, fifo_err)},
107 {"rx_dmac_drop", offsetof(struct octeon_rx_stats, dmac_drop)},
108 {"rx_fcs_err", offsetof(struct octeon_rx_stats, fcs_err)},
109 {"rx_jabber_err", offsetof(struct octeon_rx_stats, jabber_err)},
110 {"rx_l2_err", offsetof(struct octeon_rx_stats, l2_err)},
111 {"rx_vxlan_pkts", offsetof(struct octeon_rx_stats, fw_rx_vxlan)},
112 {"rx_vxlan_err", offsetof(struct octeon_rx_stats, fw_rx_vxlan_err)},
113 {"rx_lro_pkts", offsetof(struct octeon_rx_stats, fw_lro_pkts)},
114 {"tx_pkts", (offsetof(struct octeon_tx_stats, total_pkts_sent)) +
115 sizeof(struct octeon_rx_stats)},
116 {"tx_bytes", (offsetof(struct octeon_tx_stats, total_bytes_sent)) +
117 sizeof(struct octeon_rx_stats)},
118 {"tx_broadcast_pkts",
119 (offsetof(struct octeon_tx_stats, bcast_pkts_sent)) +
120 sizeof(struct octeon_rx_stats)},
121 {"tx_multicast_pkts",
122 (offsetof(struct octeon_tx_stats, mcast_pkts_sent)) +
123 sizeof(struct octeon_rx_stats)},
124 {"tx_flow_ctrl_pkts", (offsetof(struct octeon_tx_stats, ctl_sent)) +
125 sizeof(struct octeon_rx_stats)},
126 {"tx_fifo_err", (offsetof(struct octeon_tx_stats, fifo_err)) +
127 sizeof(struct octeon_rx_stats)},
128 {"tx_total_collisions", (offsetof(struct octeon_tx_stats,
130 sizeof(struct octeon_rx_stats)},
131 {"tx_tso", (offsetof(struct octeon_tx_stats, fw_tso)) +
132 sizeof(struct octeon_rx_stats)},
133 {"tx_vxlan_pkts", (offsetof(struct octeon_tx_stats, fw_tx_vxlan)) +
134 sizeof(struct octeon_rx_stats)},
137 #define LIO_NB_XSTATS RTE_DIM(rte_lio_stats_strings)
139 /* Get hw stats of the port */
141 lio_dev_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *xstats,
144 struct lio_device *lio_dev = LIO_DEV(eth_dev);
145 uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
146 struct octeon_link_stats *hw_stats;
147 struct lio_link_stats_resp *resp;
148 struct lio_soft_command *sc;
153 if (!lio_dev->intf_open) {
154 lio_dev_err(lio_dev, "Port %d down\n",
159 if (n < LIO_NB_XSTATS)
160 return LIO_NB_XSTATS;
162 resp_size = sizeof(struct lio_link_stats_resp);
163 sc = lio_alloc_soft_command(lio_dev, 0, resp_size, 0);
167 resp = (struct lio_link_stats_resp *)sc->virtrptr;
168 lio_prepare_soft_command(lio_dev, sc, LIO_OPCODE,
169 LIO_OPCODE_PORT_STATS, 0, 0, 0);
171 /* Setting wait time in seconds */
172 sc->wait_time = LIO_MAX_CMD_TIMEOUT / 1000;
174 retval = lio_send_soft_command(lio_dev, sc);
175 if (retval == LIO_IQ_SEND_FAILED) {
176 lio_dev_err(lio_dev, "failed to get port stats from firmware. status: %x\n",
181 while ((*sc->status_word == LIO_COMPLETION_WORD_INIT) && --timeout) {
182 lio_flush_iq(lio_dev, lio_dev->instr_queue[sc->iq_no]);
183 lio_process_ordered_list(lio_dev);
187 retval = resp->status;
189 lio_dev_err(lio_dev, "failed to get port stats from firmware\n");
193 lio_swap_8B_data((uint64_t *)(&resp->link_stats),
194 sizeof(struct octeon_link_stats) >> 3);
196 hw_stats = &resp->link_stats;
198 for (i = 0; i < LIO_NB_XSTATS; i++) {
201 *(uint64_t *)(((char *)hw_stats) +
202 rte_lio_stats_strings[i].offset);
205 lio_free_soft_command(sc);
207 return LIO_NB_XSTATS;
210 lio_free_soft_command(sc);
216 lio_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
217 struct rte_eth_xstat_name *xstats_names,
218 unsigned limit __rte_unused)
220 struct lio_device *lio_dev = LIO_DEV(eth_dev);
223 if (!lio_dev->intf_open) {
224 lio_dev_err(lio_dev, "Port %d down\n",
229 if (xstats_names == NULL)
230 return LIO_NB_XSTATS;
232 /* Note: limit checked in rte_eth_xstats_names() */
234 for (i = 0; i < LIO_NB_XSTATS; i++) {
235 snprintf(xstats_names[i].name, sizeof(xstats_names[i].name),
236 "%s", rte_lio_stats_strings[i].name);
239 return LIO_NB_XSTATS;
242 /* Reset hw stats for the port */
244 lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
246 struct lio_device *lio_dev = LIO_DEV(eth_dev);
247 struct lio_dev_ctrl_cmd ctrl_cmd;
248 struct lio_ctrl_pkt ctrl_pkt;
251 if (!lio_dev->intf_open) {
252 lio_dev_err(lio_dev, "Port %d down\n",
257 /* flush added to prevent cmd failure
258 * incase the queue is full
260 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
262 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
263 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
265 ctrl_cmd.eth_dev = eth_dev;
268 ctrl_pkt.ncmd.s.cmd = LIO_CMD_CLEAR_STATS;
269 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
271 ret = lio_send_ctrl_pkt(lio_dev, &ctrl_pkt);
273 lio_dev_err(lio_dev, "Failed to send clear stats command\n");
277 ret = lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd);
279 lio_dev_err(lio_dev, "Clear stats command timed out\n");
283 /* clear stored per queue stats */
284 RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
285 return (*eth_dev->dev_ops->stats_reset)(eth_dev);
288 /* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */
290 lio_dev_stats_get(struct rte_eth_dev *eth_dev,
291 struct rte_eth_stats *stats)
293 struct lio_device *lio_dev = LIO_DEV(eth_dev);
294 struct lio_droq_stats *oq_stats;
295 struct lio_iq_stats *iq_stats;
296 struct lio_instr_queue *txq;
297 struct lio_droq *droq;
303 for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
304 iq_no = lio_dev->linfo.txpciq[i].s.q_no;
305 txq = lio_dev->instr_queue[iq_no];
307 iq_stats = &txq->stats;
308 pkts += iq_stats->tx_done;
309 drop += iq_stats->tx_dropped;
310 bytes += iq_stats->tx_tot_bytes;
314 stats->opackets = pkts;
315 stats->obytes = bytes;
316 stats->oerrors = drop;
322 for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
323 oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
324 droq = lio_dev->droq[oq_no];
326 oq_stats = &droq->stats;
327 pkts += oq_stats->rx_pkts_received;
328 drop += (oq_stats->rx_dropped +
329 oq_stats->dropped_toomany +
330 oq_stats->dropped_nomem);
331 bytes += oq_stats->rx_bytes_received;
334 stats->ibytes = bytes;
335 stats->ipackets = pkts;
336 stats->ierrors = drop;
342 lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
344 struct lio_device *lio_dev = LIO_DEV(eth_dev);
345 struct lio_droq_stats *oq_stats;
346 struct lio_iq_stats *iq_stats;
347 struct lio_instr_queue *txq;
348 struct lio_droq *droq;
351 for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
352 iq_no = lio_dev->linfo.txpciq[i].s.q_no;
353 txq = lio_dev->instr_queue[iq_no];
355 iq_stats = &txq->stats;
356 memset(iq_stats, 0, sizeof(struct lio_iq_stats));
360 for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
361 oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
362 droq = lio_dev->droq[oq_no];
364 oq_stats = &droq->stats;
365 memset(oq_stats, 0, sizeof(struct lio_droq_stats));
373 lio_dev_info_get(struct rte_eth_dev *eth_dev,
374 struct rte_eth_dev_info *devinfo)
376 struct lio_device *lio_dev = LIO_DEV(eth_dev);
377 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
379 switch (pci_dev->id.subsystem_device_id) {
380 /* CN23xx 10G cards */
381 case PCI_SUBSYS_DEV_ID_CN2350_210:
382 case PCI_SUBSYS_DEV_ID_CN2360_210:
383 case PCI_SUBSYS_DEV_ID_CN2350_210SVPN3:
384 case PCI_SUBSYS_DEV_ID_CN2360_210SVPN3:
385 case PCI_SUBSYS_DEV_ID_CN2350_210SVPT:
386 case PCI_SUBSYS_DEV_ID_CN2360_210SVPT:
387 devinfo->speed_capa = ETH_LINK_SPEED_10G;
389 /* CN23xx 25G cards */
390 case PCI_SUBSYS_DEV_ID_CN2350_225:
391 case PCI_SUBSYS_DEV_ID_CN2360_225:
392 devinfo->speed_capa = ETH_LINK_SPEED_25G;
395 devinfo->speed_capa = ETH_LINK_SPEED_10G;
397 "Unknown CN23XX subsystem device id. Setting 10G as default link speed.\n");
401 devinfo->max_rx_queues = lio_dev->max_rx_queues;
402 devinfo->max_tx_queues = lio_dev->max_tx_queues;
404 devinfo->min_rx_bufsize = LIO_MIN_RX_BUF_SIZE;
405 devinfo->max_rx_pktlen = LIO_MAX_RX_PKTLEN;
407 devinfo->max_mac_addrs = 1;
409 devinfo->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM |
410 DEV_RX_OFFLOAD_UDP_CKSUM |
411 DEV_RX_OFFLOAD_TCP_CKSUM |
412 DEV_RX_OFFLOAD_VLAN_STRIP |
413 DEV_RX_OFFLOAD_RSS_HASH);
414 devinfo->tx_offload_capa = (DEV_TX_OFFLOAD_IPV4_CKSUM |
415 DEV_TX_OFFLOAD_UDP_CKSUM |
416 DEV_TX_OFFLOAD_TCP_CKSUM |
417 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM);
419 devinfo->rx_desc_lim = lio_rx_desc_lim;
420 devinfo->tx_desc_lim = lio_tx_desc_lim;
422 devinfo->reta_size = LIO_RSS_MAX_TABLE_SZ;
423 devinfo->hash_key_size = LIO_RSS_MAX_KEY_SZ;
424 devinfo->flow_type_rss_offloads = (ETH_RSS_IPV4 |
425 ETH_RSS_NONFRAG_IPV4_TCP |
427 ETH_RSS_NONFRAG_IPV6_TCP |
429 ETH_RSS_IPV6_TCP_EX);
434 lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
436 struct lio_device *lio_dev = LIO_DEV(eth_dev);
437 struct lio_dev_ctrl_cmd ctrl_cmd;
438 struct lio_ctrl_pkt ctrl_pkt;
440 PMD_INIT_FUNC_TRACE();
442 if (!lio_dev->intf_open) {
443 lio_dev_err(lio_dev, "Port %d down, can't set MTU\n",
448 /* flush added to prevent cmd failure
449 * incase the queue is full
451 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
453 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
454 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
456 ctrl_cmd.eth_dev = eth_dev;
459 ctrl_pkt.ncmd.s.cmd = LIO_CMD_CHANGE_MTU;
460 ctrl_pkt.ncmd.s.param1 = mtu;
461 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
463 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
464 lio_dev_err(lio_dev, "Failed to send command to change MTU\n");
468 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
469 lio_dev_err(lio_dev, "Command to change MTU timed out\n");
477 lio_dev_rss_reta_update(struct rte_eth_dev *eth_dev,
478 struct rte_eth_rss_reta_entry64 *reta_conf,
481 struct lio_device *lio_dev = LIO_DEV(eth_dev);
482 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
483 struct lio_rss_set *rss_param;
484 struct lio_dev_ctrl_cmd ctrl_cmd;
485 struct lio_ctrl_pkt ctrl_pkt;
488 if (!lio_dev->intf_open) {
489 lio_dev_err(lio_dev, "Port %d down, can't update reta\n",
494 if (reta_size != LIO_RSS_MAX_TABLE_SZ) {
496 "The size of hash lookup table configured (%d) doesn't match the number hardware can supported (%d)\n",
497 reta_size, LIO_RSS_MAX_TABLE_SZ);
501 /* flush added to prevent cmd failure
502 * incase the queue is full
504 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
506 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
507 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
509 rss_param = (struct lio_rss_set *)&ctrl_pkt.udd[0];
511 ctrl_cmd.eth_dev = eth_dev;
514 ctrl_pkt.ncmd.s.cmd = LIO_CMD_SET_RSS;
515 ctrl_pkt.ncmd.s.more = sizeof(struct lio_rss_set) >> 3;
516 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
518 rss_param->param.flags = 0xF;
519 rss_param->param.flags &= ~LIO_RSS_PARAM_ITABLE_UNCHANGED;
520 rss_param->param.itablesize = LIO_RSS_MAX_TABLE_SZ;
522 for (i = 0; i < (reta_size / RTE_RETA_GROUP_SIZE); i++) {
523 for (j = 0; j < RTE_RETA_GROUP_SIZE; j++) {
524 if ((reta_conf[i].mask) & ((uint64_t)1 << j)) {
525 index = (i * RTE_RETA_GROUP_SIZE) + j;
526 rss_state->itable[index] = reta_conf[i].reta[j];
531 rss_state->itable_size = LIO_RSS_MAX_TABLE_SZ;
532 memcpy(rss_param->itable, rss_state->itable, rss_state->itable_size);
534 lio_swap_8B_data((uint64_t *)rss_param, LIO_RSS_PARAM_SIZE >> 3);
536 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
537 lio_dev_err(lio_dev, "Failed to set rss hash\n");
541 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
542 lio_dev_err(lio_dev, "Set rss hash timed out\n");
550 lio_dev_rss_reta_query(struct rte_eth_dev *eth_dev,
551 struct rte_eth_rss_reta_entry64 *reta_conf,
554 struct lio_device *lio_dev = LIO_DEV(eth_dev);
555 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
558 if (reta_size != LIO_RSS_MAX_TABLE_SZ) {
560 "The size of hash lookup table configured (%d) doesn't match the number hardware can supported (%d)\n",
561 reta_size, LIO_RSS_MAX_TABLE_SZ);
565 num = reta_size / RTE_RETA_GROUP_SIZE;
567 for (i = 0; i < num; i++) {
568 memcpy(reta_conf->reta,
569 &rss_state->itable[i * RTE_RETA_GROUP_SIZE],
570 RTE_RETA_GROUP_SIZE);
578 lio_dev_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
579 struct rte_eth_rss_conf *rss_conf)
581 struct lio_device *lio_dev = LIO_DEV(eth_dev);
582 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
583 uint8_t *hash_key = NULL;
586 if (rss_state->hash_disable) {
587 lio_dev_info(lio_dev, "RSS disabled in nic\n");
588 rss_conf->rss_hf = 0;
593 hash_key = rss_conf->rss_key;
594 if (hash_key != NULL)
595 memcpy(hash_key, rss_state->hash_key, rss_state->hash_key_size);
598 rss_hf |= ETH_RSS_IPV4;
599 if (rss_state->tcp_hash)
600 rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
602 rss_hf |= ETH_RSS_IPV6;
603 if (rss_state->ipv6_tcp_hash)
604 rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
605 if (rss_state->ipv6_ex)
606 rss_hf |= ETH_RSS_IPV6_EX;
607 if (rss_state->ipv6_tcp_ex_hash)
608 rss_hf |= ETH_RSS_IPV6_TCP_EX;
610 rss_conf->rss_hf = rss_hf;
616 lio_dev_rss_hash_update(struct rte_eth_dev *eth_dev,
617 struct rte_eth_rss_conf *rss_conf)
619 struct lio_device *lio_dev = LIO_DEV(eth_dev);
620 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
621 struct lio_rss_set *rss_param;
622 struct lio_dev_ctrl_cmd ctrl_cmd;
623 struct lio_ctrl_pkt ctrl_pkt;
625 if (!lio_dev->intf_open) {
626 lio_dev_err(lio_dev, "Port %d down, can't update hash\n",
631 /* flush added to prevent cmd failure
632 * incase the queue is full
634 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
636 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
637 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
639 rss_param = (struct lio_rss_set *)&ctrl_pkt.udd[0];
641 ctrl_cmd.eth_dev = eth_dev;
644 ctrl_pkt.ncmd.s.cmd = LIO_CMD_SET_RSS;
645 ctrl_pkt.ncmd.s.more = sizeof(struct lio_rss_set) >> 3;
646 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
648 rss_param->param.flags = 0xF;
650 if (rss_conf->rss_key) {
651 rss_param->param.flags &= ~LIO_RSS_PARAM_HASH_KEY_UNCHANGED;
652 rss_state->hash_key_size = LIO_RSS_MAX_KEY_SZ;
653 rss_param->param.hashkeysize = LIO_RSS_MAX_KEY_SZ;
654 memcpy(rss_state->hash_key, rss_conf->rss_key,
655 rss_state->hash_key_size);
656 memcpy(rss_param->key, rss_state->hash_key,
657 rss_state->hash_key_size);
660 if ((rss_conf->rss_hf & LIO_RSS_OFFLOAD_ALL) == 0) {
661 /* Can't disable rss through hash flags,
662 * if it is enabled by default during init
664 if (!rss_state->hash_disable)
667 /* This is for --disable-rss during testpmd launch */
668 rss_param->param.flags |= LIO_RSS_PARAM_DISABLE_RSS;
670 uint32_t hashinfo = 0;
672 /* Can't enable rss if disabled by default during init */
673 if (rss_state->hash_disable)
676 if (rss_conf->rss_hf & ETH_RSS_IPV4) {
677 hashinfo |= LIO_RSS_HASH_IPV4;
683 if (rss_conf->rss_hf & ETH_RSS_NONFRAG_IPV4_TCP) {
684 hashinfo |= LIO_RSS_HASH_TCP_IPV4;
685 rss_state->tcp_hash = 1;
687 rss_state->tcp_hash = 0;
690 if (rss_conf->rss_hf & ETH_RSS_IPV6) {
691 hashinfo |= LIO_RSS_HASH_IPV6;
697 if (rss_conf->rss_hf & ETH_RSS_NONFRAG_IPV6_TCP) {
698 hashinfo |= LIO_RSS_HASH_TCP_IPV6;
699 rss_state->ipv6_tcp_hash = 1;
701 rss_state->ipv6_tcp_hash = 0;
704 if (rss_conf->rss_hf & ETH_RSS_IPV6_EX) {
705 hashinfo |= LIO_RSS_HASH_IPV6_EX;
706 rss_state->ipv6_ex = 1;
708 rss_state->ipv6_ex = 0;
711 if (rss_conf->rss_hf & ETH_RSS_IPV6_TCP_EX) {
712 hashinfo |= LIO_RSS_HASH_TCP_IPV6_EX;
713 rss_state->ipv6_tcp_ex_hash = 1;
715 rss_state->ipv6_tcp_ex_hash = 0;
718 rss_param->param.flags &= ~LIO_RSS_PARAM_HASH_INFO_UNCHANGED;
719 rss_param->param.hashinfo = hashinfo;
722 lio_swap_8B_data((uint64_t *)rss_param, LIO_RSS_PARAM_SIZE >> 3);
724 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
725 lio_dev_err(lio_dev, "Failed to set rss hash\n");
729 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
730 lio_dev_err(lio_dev, "Set rss hash timed out\n");
738 * Add vxlan dest udp port for an interface.
741 * Pointer to the structure rte_eth_dev
746 * On success return 0
747 * On failure return -1
750 lio_dev_udp_tunnel_add(struct rte_eth_dev *eth_dev,
751 struct rte_eth_udp_tunnel *udp_tnl)
753 struct lio_device *lio_dev = LIO_DEV(eth_dev);
754 struct lio_dev_ctrl_cmd ctrl_cmd;
755 struct lio_ctrl_pkt ctrl_pkt;
760 if (udp_tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN) {
761 lio_dev_err(lio_dev, "Unsupported tunnel type\n");
765 /* flush added to prevent cmd failure
766 * incase the queue is full
768 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
770 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
771 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
773 ctrl_cmd.eth_dev = eth_dev;
776 ctrl_pkt.ncmd.s.cmd = LIO_CMD_VXLAN_PORT_CONFIG;
777 ctrl_pkt.ncmd.s.param1 = udp_tnl->udp_port;
778 ctrl_pkt.ncmd.s.more = LIO_CMD_VXLAN_PORT_ADD;
779 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
781 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
782 lio_dev_err(lio_dev, "Failed to send VXLAN_PORT_ADD command\n");
786 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
787 lio_dev_err(lio_dev, "VXLAN_PORT_ADD command timed out\n");
795 * Remove vxlan dest udp port for an interface.
798 * Pointer to the structure rte_eth_dev
803 * On success return 0
804 * On failure return -1
807 lio_dev_udp_tunnel_del(struct rte_eth_dev *eth_dev,
808 struct rte_eth_udp_tunnel *udp_tnl)
810 struct lio_device *lio_dev = LIO_DEV(eth_dev);
811 struct lio_dev_ctrl_cmd ctrl_cmd;
812 struct lio_ctrl_pkt ctrl_pkt;
817 if (udp_tnl->prot_type != RTE_TUNNEL_TYPE_VXLAN) {
818 lio_dev_err(lio_dev, "Unsupported tunnel type\n");
822 /* flush added to prevent cmd failure
823 * incase the queue is full
825 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
827 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
828 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
830 ctrl_cmd.eth_dev = eth_dev;
833 ctrl_pkt.ncmd.s.cmd = LIO_CMD_VXLAN_PORT_CONFIG;
834 ctrl_pkt.ncmd.s.param1 = udp_tnl->udp_port;
835 ctrl_pkt.ncmd.s.more = LIO_CMD_VXLAN_PORT_DEL;
836 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
838 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
839 lio_dev_err(lio_dev, "Failed to send VXLAN_PORT_DEL command\n");
843 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
844 lio_dev_err(lio_dev, "VXLAN_PORT_DEL command timed out\n");
852 lio_dev_vlan_filter_set(struct rte_eth_dev *eth_dev, uint16_t vlan_id, int on)
854 struct lio_device *lio_dev = LIO_DEV(eth_dev);
855 struct lio_dev_ctrl_cmd ctrl_cmd;
856 struct lio_ctrl_pkt ctrl_pkt;
858 if (lio_dev->linfo.vlan_is_admin_assigned)
861 /* flush added to prevent cmd failure
862 * incase the queue is full
864 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
866 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
867 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
869 ctrl_cmd.eth_dev = eth_dev;
872 ctrl_pkt.ncmd.s.cmd = on ?
873 LIO_CMD_ADD_VLAN_FILTER : LIO_CMD_DEL_VLAN_FILTER;
874 ctrl_pkt.ncmd.s.param1 = vlan_id;
875 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
877 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
878 lio_dev_err(lio_dev, "Failed to %s VLAN port\n",
879 on ? "add" : "remove");
883 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
884 lio_dev_err(lio_dev, "Command to %s VLAN port timed out\n",
885 on ? "add" : "remove");
893 lio_hweight64(uint64_t w)
895 uint64_t res = w - ((w >> 1) & 0x5555555555555555ul);
898 (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
899 res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
900 res = res + (res >> 8);
901 res = res + (res >> 16);
903 return (res + (res >> 32)) & 0x00000000000000FFul;
907 lio_dev_link_update(struct rte_eth_dev *eth_dev,
908 int wait_to_complete __rte_unused)
910 struct lio_device *lio_dev = LIO_DEV(eth_dev);
911 struct rte_eth_link link;
914 memset(&link, 0, sizeof(link));
915 link.link_status = ETH_LINK_DOWN;
916 link.link_speed = ETH_SPEED_NUM_NONE;
917 link.link_duplex = ETH_LINK_HALF_DUPLEX;
918 link.link_autoneg = ETH_LINK_AUTONEG;
920 /* Return what we found */
921 if (lio_dev->linfo.link.s.link_up == 0) {
922 /* Interface is down */
923 return rte_eth_linkstatus_set(eth_dev, &link);
926 link.link_status = ETH_LINK_UP; /* Interface is up */
927 link.link_duplex = ETH_LINK_FULL_DUPLEX;
928 switch (lio_dev->linfo.link.s.speed) {
929 case LIO_LINK_SPEED_10000:
930 link.link_speed = ETH_SPEED_NUM_10G;
932 case LIO_LINK_SPEED_25000:
933 link.link_speed = ETH_SPEED_NUM_25G;
936 link.link_speed = ETH_SPEED_NUM_NONE;
937 link.link_duplex = ETH_LINK_HALF_DUPLEX;
940 return rte_eth_linkstatus_set(eth_dev, &link);
944 * \brief Net device enable, disable allmulticast
945 * @param eth_dev Pointer to the structure rte_eth_dev
948 * On success return 0
949 * On failure return negative errno
952 lio_change_dev_flag(struct rte_eth_dev *eth_dev)
954 struct lio_device *lio_dev = LIO_DEV(eth_dev);
955 struct lio_dev_ctrl_cmd ctrl_cmd;
956 struct lio_ctrl_pkt ctrl_pkt;
958 /* flush added to prevent cmd failure
959 * incase the queue is full
961 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
963 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
964 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
966 ctrl_cmd.eth_dev = eth_dev;
969 /* Create a ctrl pkt command to be sent to core app. */
970 ctrl_pkt.ncmd.s.cmd = LIO_CMD_CHANGE_DEVFLAGS;
971 ctrl_pkt.ncmd.s.param1 = lio_dev->ifflags;
972 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
974 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
975 lio_dev_err(lio_dev, "Failed to send change flag message\n");
979 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
980 lio_dev_err(lio_dev, "Change dev flag command timed out\n");
988 lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
990 struct lio_device *lio_dev = LIO_DEV(eth_dev);
992 if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
993 lio_dev_err(lio_dev, "Require firmware version >= %s\n",
994 LIO_VF_TRUST_MIN_VERSION);
998 if (!lio_dev->intf_open) {
999 lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
1004 lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
1005 return lio_change_dev_flag(eth_dev);
1009 lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
1011 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1013 if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
1014 lio_dev_err(lio_dev, "Require firmware version >= %s\n",
1015 LIO_VF_TRUST_MIN_VERSION);
1019 if (!lio_dev->intf_open) {
1020 lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
1025 lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
1026 return lio_change_dev_flag(eth_dev);
1030 lio_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
1032 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1034 if (!lio_dev->intf_open) {
1035 lio_dev_err(lio_dev, "Port %d down, can't enable multicast\n",
1040 lio_dev->ifflags |= LIO_IFFLAG_ALLMULTI;
1041 return lio_change_dev_flag(eth_dev);
1045 lio_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
1047 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1049 if (!lio_dev->intf_open) {
1050 lio_dev_err(lio_dev, "Port %d down, can't disable multicast\n",
1055 lio_dev->ifflags &= ~LIO_IFFLAG_ALLMULTI;
1056 return lio_change_dev_flag(eth_dev);
1060 lio_dev_rss_configure(struct rte_eth_dev *eth_dev)
1062 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1063 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
1064 struct rte_eth_rss_reta_entry64 reta_conf[8];
1065 struct rte_eth_rss_conf rss_conf;
1068 /* Configure the RSS key and the RSS protocols used to compute
1069 * the RSS hash of input packets.
1071 rss_conf = eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
1072 if ((rss_conf.rss_hf & LIO_RSS_OFFLOAD_ALL) == 0) {
1073 rss_state->hash_disable = 1;
1074 lio_dev_rss_hash_update(eth_dev, &rss_conf);
1078 if (rss_conf.rss_key == NULL)
1079 rss_conf.rss_key = lio_rss_key; /* Default hash key */
1081 lio_dev_rss_hash_update(eth_dev, &rss_conf);
1083 memset(reta_conf, 0, sizeof(reta_conf));
1084 for (i = 0; i < LIO_RSS_MAX_TABLE_SZ; i++) {
1085 uint8_t q_idx, conf_idx, reta_idx;
1087 q_idx = (uint8_t)((eth_dev->data->nb_rx_queues > 1) ?
1088 i % eth_dev->data->nb_rx_queues : 0);
1089 conf_idx = i / RTE_RETA_GROUP_SIZE;
1090 reta_idx = i % RTE_RETA_GROUP_SIZE;
1091 reta_conf[conf_idx].reta[reta_idx] = q_idx;
1092 reta_conf[conf_idx].mask |= ((uint64_t)1 << reta_idx);
1095 lio_dev_rss_reta_update(eth_dev, reta_conf, LIO_RSS_MAX_TABLE_SZ);
1099 lio_dev_mq_rx_configure(struct rte_eth_dev *eth_dev)
1101 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1102 struct lio_rss_ctx *rss_state = &lio_dev->rss_state;
1103 struct rte_eth_rss_conf rss_conf;
1105 switch (eth_dev->data->dev_conf.rxmode.mq_mode) {
1107 lio_dev_rss_configure(eth_dev);
1109 case ETH_MQ_RX_NONE:
1110 /* if mq_mode is none, disable rss mode. */
1112 memset(&rss_conf, 0, sizeof(rss_conf));
1113 rss_state->hash_disable = 1;
1114 lio_dev_rss_hash_update(eth_dev, &rss_conf);
1119 * Setup our receive queue/ringbuffer. This is the
1120 * queue the Octeon uses to send us packets and
1121 * responses. We are given a memory pool for our
1122 * packet buffers that are used to populate the receive
1126 * Pointer to the structure rte_eth_dev
1129 * @param num_rx_descs
1130 * Number of entries in the queue
1132 * Where to allocate memory
1134 * Pointer to the struction rte_eth_rxconf
1136 * Pointer to the packet pool
1139 * - On success, return 0
1140 * - On failure, return -1
1143 lio_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no,
1144 uint16_t num_rx_descs, unsigned int socket_id,
1145 const struct rte_eth_rxconf *rx_conf __rte_unused,
1146 struct rte_mempool *mp)
1148 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1149 struct rte_pktmbuf_pool_private *mbp_priv;
1150 uint32_t fw_mapped_oq;
1153 if (q_no >= lio_dev->nb_rx_queues) {
1154 lio_dev_err(lio_dev, "Invalid rx queue number %u\n", q_no);
1158 lio_dev_dbg(lio_dev, "setting up rx queue %u\n", q_no);
1160 fw_mapped_oq = lio_dev->linfo.rxpciq[q_no].s.q_no;
1162 /* Free previous allocation if any */
1163 if (eth_dev->data->rx_queues[q_no] != NULL) {
1164 lio_dev_rx_queue_release(eth_dev, q_no);
1165 eth_dev->data->rx_queues[q_no] = NULL;
1168 mbp_priv = rte_mempool_get_priv(mp);
1169 buf_size = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM;
1171 if (lio_setup_droq(lio_dev, fw_mapped_oq, num_rx_descs, buf_size, mp,
1173 lio_dev_err(lio_dev, "droq allocation failed\n");
1177 eth_dev->data->rx_queues[q_no] = lio_dev->droq[fw_mapped_oq];
1183 * Release the receive queue/ringbuffer. Called by
1187 * Pointer to Ethernet device structure.
1189 * Receive queue index.
1195 lio_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_no)
1197 struct lio_droq *droq = dev->data->rx_queues[q_no];
1202 lio_delete_droq_queue(droq->lio_dev, oq_no);
1207 * Allocate and initialize SW ring. Initialize associated HW registers.
1210 * Pointer to structure rte_eth_dev
1215 * @param num_tx_descs
1216 * Number of ringbuffer descriptors
1219 * NUMA socket id, used for memory allocations
1222 * Pointer to the structure rte_eth_txconf
1225 * - On success, return 0
1226 * - On failure, return -errno value
1229 lio_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no,
1230 uint16_t num_tx_descs, unsigned int socket_id,
1231 const struct rte_eth_txconf *tx_conf __rte_unused)
1233 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1234 int fw_mapped_iq = lio_dev->linfo.txpciq[q_no].s.q_no;
1237 if (q_no >= lio_dev->nb_tx_queues) {
1238 lio_dev_err(lio_dev, "Invalid tx queue number %u\n", q_no);
1242 lio_dev_dbg(lio_dev, "setting up tx queue %u\n", q_no);
1244 /* Free previous allocation if any */
1245 if (eth_dev->data->tx_queues[q_no] != NULL) {
1246 lio_dev_tx_queue_release(eth_dev, q_no);
1247 eth_dev->data->tx_queues[q_no] = NULL;
1250 retval = lio_setup_iq(lio_dev, q_no, lio_dev->linfo.txpciq[q_no],
1251 num_tx_descs, lio_dev, socket_id);
1254 lio_dev_err(lio_dev, "Runtime IQ(TxQ) creation failed.\n");
1258 retval = lio_setup_sglists(lio_dev, q_no, fw_mapped_iq,
1259 lio_dev->instr_queue[fw_mapped_iq]->nb_desc,
1263 lio_delete_instruction_queue(lio_dev, fw_mapped_iq);
1267 eth_dev->data->tx_queues[q_no] = lio_dev->instr_queue[fw_mapped_iq];
1273 * Release the transmit queue/ringbuffer. Called by
1277 * Pointer to Ethernet device structure.
1279 * Transmit queue index.
1285 lio_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_no)
1287 struct lio_instr_queue *tq = dev->data->tx_queues[q_no];
1288 uint32_t fw_mapped_iq_no;
1293 lio_delete_sglist(tq);
1295 fw_mapped_iq_no = tq->txpciq.s.q_no;
1296 lio_delete_instruction_queue(tq->lio_dev, fw_mapped_iq_no);
1301 * Api to check link state.
1304 lio_dev_get_link_status(struct rte_eth_dev *eth_dev)
1306 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1307 uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
1308 struct lio_link_status_resp *resp;
1309 union octeon_link_status *ls;
1310 struct lio_soft_command *sc;
1313 if (!lio_dev->intf_open)
1316 resp_size = sizeof(struct lio_link_status_resp);
1317 sc = lio_alloc_soft_command(lio_dev, 0, resp_size, 0);
1321 resp = (struct lio_link_status_resp *)sc->virtrptr;
1322 lio_prepare_soft_command(lio_dev, sc, LIO_OPCODE,
1323 LIO_OPCODE_INFO, 0, 0, 0);
1325 /* Setting wait time in seconds */
1326 sc->wait_time = LIO_MAX_CMD_TIMEOUT / 1000;
1328 if (lio_send_soft_command(lio_dev, sc) == LIO_IQ_SEND_FAILED)
1329 goto get_status_fail;
1331 while ((*sc->status_word == LIO_COMPLETION_WORD_INIT) && --timeout) {
1332 lio_flush_iq(lio_dev, lio_dev->instr_queue[sc->iq_no]);
1337 goto get_status_fail;
1339 ls = &resp->link_info.link;
1341 lio_swap_8B_data((uint64_t *)ls, sizeof(union octeon_link_status) >> 3);
1343 if (lio_dev->linfo.link.link_status64 != ls->link_status64) {
1344 if (ls->s.mtu < eth_dev->data->mtu) {
1345 lio_dev_info(lio_dev, "Lowered VF MTU to %d as PF MTU dropped\n",
1347 eth_dev->data->mtu = ls->s.mtu;
1349 lio_dev->linfo.link.link_status64 = ls->link_status64;
1350 lio_dev_link_update(eth_dev, 0);
1353 lio_free_soft_command(sc);
1358 lio_free_soft_command(sc);
1361 /* This function will be invoked every LSC_TIMEOUT ns (100ms)
1362 * and will update link state if it changes.
1365 lio_sync_link_state_check(void *eth_dev)
1367 struct lio_device *lio_dev =
1368 (((struct rte_eth_dev *)eth_dev)->data->dev_private);
1370 if (lio_dev->port_configured)
1371 lio_dev_get_link_status(eth_dev);
1373 /* Schedule periodic link status check.
1374 * Stop check if interface is close and start again while opening.
1376 if (lio_dev->intf_open)
1377 rte_eal_alarm_set(LIO_LSC_TIMEOUT, lio_sync_link_state_check,
1382 lio_dev_start(struct rte_eth_dev *eth_dev)
1384 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1385 uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
1388 lio_dev_info(lio_dev, "Starting port %d\n", eth_dev->data->port_id);
1390 if (lio_dev->fn_list.enable_io_queues(lio_dev))
1393 if (lio_send_rx_ctrl_cmd(eth_dev, 1))
1396 /* Ready for link status updates */
1397 lio_dev->intf_open = 1;
1400 /* Configure RSS if device configured with multiple RX queues. */
1401 lio_dev_mq_rx_configure(eth_dev);
1403 /* Before update the link info,
1404 * must set linfo.link.link_status64 to 0.
1406 lio_dev->linfo.link.link_status64 = 0;
1408 /* start polling for lsc */
1409 ret = rte_eal_alarm_set(LIO_LSC_TIMEOUT,
1410 lio_sync_link_state_check,
1413 lio_dev_err(lio_dev,
1414 "link state check handler creation failed\n");
1415 goto dev_lsc_handle_error;
1418 while ((lio_dev->linfo.link.link_status64 == 0) && (--timeout))
1421 if (lio_dev->linfo.link.link_status64 == 0) {
1423 goto dev_mtu_set_error;
1426 ret = lio_dev_mtu_set(eth_dev, eth_dev->data->mtu);
1428 goto dev_mtu_set_error;
1433 rte_eal_alarm_cancel(lio_sync_link_state_check, eth_dev);
1435 dev_lsc_handle_error:
1436 lio_dev->intf_open = 0;
1437 lio_send_rx_ctrl_cmd(eth_dev, 0);
1442 /* Stop device and disable input/output functions */
1444 lio_dev_stop(struct rte_eth_dev *eth_dev)
1446 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1448 lio_dev_info(lio_dev, "Stopping port %d\n", eth_dev->data->port_id);
1449 eth_dev->data->dev_started = 0;
1450 lio_dev->intf_open = 0;
1453 /* Cancel callback if still running. */
1454 rte_eal_alarm_cancel(lio_sync_link_state_check, eth_dev);
1456 lio_send_rx_ctrl_cmd(eth_dev, 0);
1458 lio_wait_for_instr_fetch(lio_dev);
1460 /* Clear recorded link status */
1461 lio_dev->linfo.link.link_status64 = 0;
1467 lio_dev_set_link_up(struct rte_eth_dev *eth_dev)
1469 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1471 if (!lio_dev->intf_open) {
1472 lio_dev_info(lio_dev, "Port is stopped, Start the port first\n");
1476 if (lio_dev->linfo.link.s.link_up) {
1477 lio_dev_info(lio_dev, "Link is already UP\n");
1481 if (lio_send_rx_ctrl_cmd(eth_dev, 1)) {
1482 lio_dev_err(lio_dev, "Unable to set Link UP\n");
1486 lio_dev->linfo.link.s.link_up = 1;
1487 eth_dev->data->dev_link.link_status = ETH_LINK_UP;
1493 lio_dev_set_link_down(struct rte_eth_dev *eth_dev)
1495 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1497 if (!lio_dev->intf_open) {
1498 lio_dev_info(lio_dev, "Port is stopped, Start the port first\n");
1502 if (!lio_dev->linfo.link.s.link_up) {
1503 lio_dev_info(lio_dev, "Link is already DOWN\n");
1507 lio_dev->linfo.link.s.link_up = 0;
1508 eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
1510 if (lio_send_rx_ctrl_cmd(eth_dev, 0)) {
1511 lio_dev->linfo.link.s.link_up = 1;
1512 eth_dev->data->dev_link.link_status = ETH_LINK_UP;
1513 lio_dev_err(lio_dev, "Unable to set Link Down\n");
1521 * Reset and stop the device. This occurs on the first
1522 * call to this routine. Subsequent calls will simply
1523 * return. NB: This will require the NIC to be rebooted.
1526 * Pointer to the structure rte_eth_dev
1532 lio_dev_close(struct rte_eth_dev *eth_dev)
1534 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1537 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1540 lio_dev_info(lio_dev, "closing port %d\n", eth_dev->data->port_id);
1542 if (lio_dev->intf_open)
1543 ret = lio_dev_stop(eth_dev);
1545 /* Reset ioq regs */
1546 lio_dev->fn_list.setup_device_regs(lio_dev);
1548 if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
1549 cn23xx_vf_ask_pf_to_do_flr(lio_dev);
1550 rte_delay_ms(LIO_PCI_FLR_WAIT);
1554 lio_dev->fn_list.free_mbox(lio_dev);
1556 /* Free glist resources */
1557 rte_free(lio_dev->glist_head);
1558 rte_free(lio_dev->glist_lock);
1559 lio_dev->glist_head = NULL;
1560 lio_dev->glist_lock = NULL;
1562 lio_dev->port_configured = 0;
1564 /* Delete all queues */
1565 lio_dev_clear_queues(eth_dev);
1571 * Enable tunnel rx checksum verification from firmware.
1574 lio_enable_hw_tunnel_rx_checksum(struct rte_eth_dev *eth_dev)
1576 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1577 struct lio_dev_ctrl_cmd ctrl_cmd;
1578 struct lio_ctrl_pkt ctrl_pkt;
1580 /* flush added to prevent cmd failure
1581 * incase the queue is full
1583 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
1585 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
1586 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
1588 ctrl_cmd.eth_dev = eth_dev;
1591 ctrl_pkt.ncmd.s.cmd = LIO_CMD_TNL_RX_CSUM_CTL;
1592 ctrl_pkt.ncmd.s.param1 = LIO_CMD_RXCSUM_ENABLE;
1593 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
1595 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
1596 lio_dev_err(lio_dev, "Failed to send TNL_RX_CSUM command\n");
1600 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
1601 lio_dev_err(lio_dev, "TNL_RX_CSUM command timed out\n");
1605 * Enable checksum calculation for inner packet in a tunnel.
1608 lio_enable_hw_tunnel_tx_checksum(struct rte_eth_dev *eth_dev)
1610 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1611 struct lio_dev_ctrl_cmd ctrl_cmd;
1612 struct lio_ctrl_pkt ctrl_pkt;
1614 /* flush added to prevent cmd failure
1615 * incase the queue is full
1617 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
1619 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
1620 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
1622 ctrl_cmd.eth_dev = eth_dev;
1625 ctrl_pkt.ncmd.s.cmd = LIO_CMD_TNL_TX_CSUM_CTL;
1626 ctrl_pkt.ncmd.s.param1 = LIO_CMD_TXCSUM_ENABLE;
1627 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
1629 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
1630 lio_dev_err(lio_dev, "Failed to send TNL_TX_CSUM command\n");
1634 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
1635 lio_dev_err(lio_dev, "TNL_TX_CSUM command timed out\n");
1639 lio_send_queue_count_update(struct rte_eth_dev *eth_dev, int num_txq,
1642 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1643 struct lio_dev_ctrl_cmd ctrl_cmd;
1644 struct lio_ctrl_pkt ctrl_pkt;
1646 if (strcmp(lio_dev->firmware_version, LIO_Q_RECONF_MIN_VERSION) < 0) {
1647 lio_dev_err(lio_dev, "Require firmware version >= %s\n",
1648 LIO_Q_RECONF_MIN_VERSION);
1652 /* flush added to prevent cmd failure
1653 * incase the queue is full
1655 lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
1657 memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
1658 memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
1660 ctrl_cmd.eth_dev = eth_dev;
1663 ctrl_pkt.ncmd.s.cmd = LIO_CMD_QUEUE_COUNT_CTL;
1664 ctrl_pkt.ncmd.s.param1 = num_txq;
1665 ctrl_pkt.ncmd.s.param2 = num_rxq;
1666 ctrl_pkt.ctrl_cmd = &ctrl_cmd;
1668 if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
1669 lio_dev_err(lio_dev, "Failed to send queue count control command\n");
1673 if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
1674 lio_dev_err(lio_dev, "Queue count control command timed out\n");
1682 lio_reconf_queues(struct rte_eth_dev *eth_dev, int num_txq, int num_rxq)
1684 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1687 if (lio_dev->nb_rx_queues != num_rxq ||
1688 lio_dev->nb_tx_queues != num_txq) {
1689 if (lio_send_queue_count_update(eth_dev, num_txq, num_rxq))
1691 lio_dev->nb_rx_queues = num_rxq;
1692 lio_dev->nb_tx_queues = num_txq;
1695 if (lio_dev->intf_open) {
1696 ret = lio_dev_stop(eth_dev);
1701 /* Reset ioq registers */
1702 if (lio_dev->fn_list.setup_device_regs(lio_dev)) {
1703 lio_dev_err(lio_dev, "Failed to configure device registers\n");
1711 lio_dev_configure(struct rte_eth_dev *eth_dev)
1713 struct lio_device *lio_dev = LIO_DEV(eth_dev);
1714 uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
1715 int retval, num_iqueues, num_oqueues;
1716 uint8_t mac[RTE_ETHER_ADDR_LEN], i;
1717 struct lio_if_cfg_resp *resp;
1718 struct lio_soft_command *sc;
1719 union lio_if_cfg if_cfg;
1722 PMD_INIT_FUNC_TRACE();
1724 if (eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
1725 eth_dev->data->dev_conf.rxmode.offloads |=
1726 DEV_RX_OFFLOAD_RSS_HASH;
1728 /* Inform firmware about change in number of queues to use.
1729 * Disable IO queues and reset registers for re-configuration.
1731 if (lio_dev->port_configured)
1732 return lio_reconf_queues(eth_dev,
1733 eth_dev->data->nb_tx_queues,
1734 eth_dev->data->nb_rx_queues);
1736 lio_dev->nb_rx_queues = eth_dev->data->nb_rx_queues;
1737 lio_dev->nb_tx_queues = eth_dev->data->nb_tx_queues;
1739 /* Set max number of queues which can be re-configured. */
1740 lio_dev->max_rx_queues = eth_dev->data->nb_rx_queues;
1741 lio_dev->max_tx_queues = eth_dev->data->nb_tx_queues;
1743 resp_size = sizeof(struct lio_if_cfg_resp);
1744 sc = lio_alloc_soft_command(lio_dev, 0, resp_size, 0);
1748 resp = (struct lio_if_cfg_resp *)sc->virtrptr;
1750 /* Firmware doesn't have capability to reconfigure the queues,
1751 * Claim all queues, and use as many required
1753 if_cfg.if_cfg64 = 0;
1754 if_cfg.s.num_iqueues = lio_dev->nb_tx_queues;
1755 if_cfg.s.num_oqueues = lio_dev->nb_rx_queues;
1756 if_cfg.s.base_queue = 0;
1758 if_cfg.s.gmx_port_id = lio_dev->pf_num;
1760 lio_prepare_soft_command(lio_dev, sc, LIO_OPCODE,
1761 LIO_OPCODE_IF_CFG, 0,
1762 if_cfg.if_cfg64, 0);
1764 /* Setting wait time in seconds */
1765 sc->wait_time = LIO_MAX_CMD_TIMEOUT / 1000;
1767 retval = lio_send_soft_command(lio_dev, sc);
1768 if (retval == LIO_IQ_SEND_FAILED) {
1769 lio_dev_err(lio_dev, "iq/oq config failed status: %x\n",
1771 /* Soft instr is freed by driver in case of failure. */
1772 goto nic_config_fail;
1775 /* Sleep on a wait queue till the cond flag indicates that the
1776 * response arrived or timed-out.
1778 while ((*sc->status_word == LIO_COMPLETION_WORD_INIT) && --timeout) {
1779 lio_flush_iq(lio_dev, lio_dev->instr_queue[sc->iq_no]);
1780 lio_process_ordered_list(lio_dev);
1784 retval = resp->status;
1786 lio_dev_err(lio_dev, "iq/oq config failed\n");
1787 goto nic_config_fail;
1790 strlcpy(lio_dev->firmware_version,
1791 resp->cfg_info.lio_firmware_version, LIO_FW_VERSION_LENGTH);
1793 lio_swap_8B_data((uint64_t *)(&resp->cfg_info),
1794 sizeof(struct octeon_if_cfg_info) >> 3);
1796 num_iqueues = lio_hweight64(resp->cfg_info.iqmask);
1797 num_oqueues = lio_hweight64(resp->cfg_info.oqmask);
1799 if (!(num_iqueues) || !(num_oqueues)) {
1800 lio_dev_err(lio_dev,
1801 "Got bad iqueues (%016lx) or oqueues (%016lx) from firmware.\n",
1802 (unsigned long)resp->cfg_info.iqmask,
1803 (unsigned long)resp->cfg_info.oqmask);
1804 goto nic_config_fail;
1807 lio_dev_dbg(lio_dev,
1808 "interface %d, iqmask %016lx, oqmask %016lx, numiqueues %d, numoqueues %d\n",
1809 eth_dev->data->port_id,
1810 (unsigned long)resp->cfg_info.iqmask,
1811 (unsigned long)resp->cfg_info.oqmask,
1812 num_iqueues, num_oqueues);
1814 lio_dev->linfo.num_rxpciq = num_oqueues;
1815 lio_dev->linfo.num_txpciq = num_iqueues;
1817 for (i = 0; i < num_oqueues; i++) {
1818 lio_dev->linfo.rxpciq[i].rxpciq64 =
1819 resp->cfg_info.linfo.rxpciq[i].rxpciq64;
1820 lio_dev_dbg(lio_dev, "index %d OQ %d\n",
1821 i, lio_dev->linfo.rxpciq[i].s.q_no);
1824 for (i = 0; i < num_iqueues; i++) {
1825 lio_dev->linfo.txpciq[i].txpciq64 =
1826 resp->cfg_info.linfo.txpciq[i].txpciq64;
1827 lio_dev_dbg(lio_dev, "index %d IQ %d\n",
1828 i, lio_dev->linfo.txpciq[i].s.q_no);
1831 lio_dev->linfo.hw_addr = resp->cfg_info.linfo.hw_addr;
1832 lio_dev->linfo.gmxport = resp->cfg_info.linfo.gmxport;
1833 lio_dev->linfo.link.link_status64 =
1834 resp->cfg_info.linfo.link.link_status64;
1836 /* 64-bit swap required on LE machines */
1837 lio_swap_8B_data(&lio_dev->linfo.hw_addr, 1);
1838 for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
1839 mac[i] = *((uint8_t *)(((uint8_t *)&lio_dev->linfo.hw_addr) +
1842 /* Copy the permanent MAC address */
1843 rte_ether_addr_copy((struct rte_ether_addr *)mac,
1844 ð_dev->data->mac_addrs[0]);
1846 /* enable firmware checksum support for tunnel packets */
1847 lio_enable_hw_tunnel_rx_checksum(eth_dev);
1848 lio_enable_hw_tunnel_tx_checksum(eth_dev);
1850 lio_dev->glist_lock =
1851 rte_zmalloc(NULL, sizeof(*lio_dev->glist_lock) * num_iqueues, 0);
1852 if (lio_dev->glist_lock == NULL)
1855 lio_dev->glist_head =
1856 rte_zmalloc(NULL, sizeof(*lio_dev->glist_head) * num_iqueues,
1858 if (lio_dev->glist_head == NULL) {
1859 rte_free(lio_dev->glist_lock);
1860 lio_dev->glist_lock = NULL;
1864 lio_dev_link_update(eth_dev, 0);
1866 lio_dev->port_configured = 1;
1868 lio_free_soft_command(sc);
1870 /* Reset ioq regs */
1871 lio_dev->fn_list.setup_device_regs(lio_dev);
1873 /* Free iq_0 used during init */
1874 lio_free_instr_queue0(lio_dev);
1879 lio_dev_err(lio_dev, "Failed retval %d\n", retval);
1880 lio_free_soft_command(sc);
1881 lio_free_instr_queue0(lio_dev);
1886 /* Define our ethernet definitions */
1887 static const struct eth_dev_ops liovf_eth_dev_ops = {
1888 .dev_configure = lio_dev_configure,
1889 .dev_start = lio_dev_start,
1890 .dev_stop = lio_dev_stop,
1891 .dev_set_link_up = lio_dev_set_link_up,
1892 .dev_set_link_down = lio_dev_set_link_down,
1893 .dev_close = lio_dev_close,
1894 .promiscuous_enable = lio_dev_promiscuous_enable,
1895 .promiscuous_disable = lio_dev_promiscuous_disable,
1896 .allmulticast_enable = lio_dev_allmulticast_enable,
1897 .allmulticast_disable = lio_dev_allmulticast_disable,
1898 .link_update = lio_dev_link_update,
1899 .stats_get = lio_dev_stats_get,
1900 .xstats_get = lio_dev_xstats_get,
1901 .xstats_get_names = lio_dev_xstats_get_names,
1902 .stats_reset = lio_dev_stats_reset,
1903 .xstats_reset = lio_dev_xstats_reset,
1904 .dev_infos_get = lio_dev_info_get,
1905 .vlan_filter_set = lio_dev_vlan_filter_set,
1906 .rx_queue_setup = lio_dev_rx_queue_setup,
1907 .rx_queue_release = lio_dev_rx_queue_release,
1908 .tx_queue_setup = lio_dev_tx_queue_setup,
1909 .tx_queue_release = lio_dev_tx_queue_release,
1910 .reta_update = lio_dev_rss_reta_update,
1911 .reta_query = lio_dev_rss_reta_query,
1912 .rss_hash_conf_get = lio_dev_rss_hash_conf_get,
1913 .rss_hash_update = lio_dev_rss_hash_update,
1914 .udp_tunnel_port_add = lio_dev_udp_tunnel_add,
1915 .udp_tunnel_port_del = lio_dev_udp_tunnel_del,
1916 .mtu_set = lio_dev_mtu_set,
1920 lio_check_pf_hs_response(void *lio_dev)
1922 struct lio_device *dev = lio_dev;
1924 /* check till response arrives */
1925 if (dev->pfvf_hsword.coproc_tics_per_us)
1928 cn23xx_vf_handle_mbox(dev);
1930 rte_eal_alarm_set(1, lio_check_pf_hs_response, lio_dev);
1934 * \brief Identify the LIO device and to map the BAR address space
1935 * @param lio_dev lio device
1938 lio_chip_specific_setup(struct lio_device *lio_dev)
1940 struct rte_pci_device *pdev = lio_dev->pci_dev;
1941 uint32_t dev_id = pdev->id.device_id;
1946 case LIO_CN23XX_VF_VID:
1947 lio_dev->chip_id = LIO_CN23XX_VF_VID;
1948 ret = cn23xx_vf_setup_device(lio_dev);
1953 lio_dev_err(lio_dev, "Unsupported Chip\n");
1957 lio_dev_info(lio_dev, "DEVICE : %s\n", s);
1963 lio_first_time_init(struct lio_device *lio_dev,
1964 struct rte_pci_device *pdev)
1968 PMD_INIT_FUNC_TRACE();
1970 /* set dpdk specific pci device pointer */
1971 lio_dev->pci_dev = pdev;
1973 /* Identify the LIO type and set device ops */
1974 if (lio_chip_specific_setup(lio_dev)) {
1975 lio_dev_err(lio_dev, "Chip specific setup failed\n");
1979 /* Initialize soft command buffer pool */
1980 if (lio_setup_sc_buffer_pool(lio_dev)) {
1981 lio_dev_err(lio_dev, "sc buffer pool allocation failed\n");
1985 /* Initialize lists to manage the requests of different types that
1986 * arrive from applications for this lio device.
1988 lio_setup_response_list(lio_dev);
1990 if (lio_dev->fn_list.setup_mbox(lio_dev)) {
1991 lio_dev_err(lio_dev, "Mailbox setup failed\n");
1995 /* Check PF response */
1996 lio_check_pf_hs_response((void *)lio_dev);
1998 /* Do handshake and exit if incompatible PF driver */
1999 if (cn23xx_pfvf_handshake(lio_dev))
2002 /* Request and wait for device reset. */
2003 if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
2004 cn23xx_vf_ask_pf_to_do_flr(lio_dev);
2005 /* FLR wait time doubled as a precaution. */
2006 rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
2009 if (lio_dev->fn_list.setup_device_regs(lio_dev)) {
2010 lio_dev_err(lio_dev, "Failed to configure device registers\n");
2014 if (lio_setup_instr_queue0(lio_dev)) {
2015 lio_dev_err(lio_dev, "Failed to setup instruction queue 0\n");
2019 dpdk_queues = (int)lio_dev->sriov_info.rings_per_vf;
2021 lio_dev->max_tx_queues = dpdk_queues;
2022 lio_dev->max_rx_queues = dpdk_queues;
2024 /* Enable input and output queues for this device */
2025 if (lio_dev->fn_list.enable_io_queues(lio_dev))
2031 lio_free_sc_buffer_pool(lio_dev);
2032 if (lio_dev->mbox[0])
2033 lio_dev->fn_list.free_mbox(lio_dev);
2034 if (lio_dev->instr_queue[0])
2035 lio_free_instr_queue0(lio_dev);
2041 lio_eth_dev_uninit(struct rte_eth_dev *eth_dev)
2043 struct lio_device *lio_dev = LIO_DEV(eth_dev);
2045 PMD_INIT_FUNC_TRACE();
2047 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2050 /* lio_free_sc_buffer_pool */
2051 lio_free_sc_buffer_pool(lio_dev);
2057 lio_eth_dev_init(struct rte_eth_dev *eth_dev)
2059 struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
2060 struct lio_device *lio_dev = LIO_DEV(eth_dev);
2062 PMD_INIT_FUNC_TRACE();
2064 eth_dev->rx_pkt_burst = &lio_dev_recv_pkts;
2065 eth_dev->tx_pkt_burst = &lio_dev_xmit_pkts;
2067 /* Primary does the initialization. */
2068 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2071 rte_eth_copy_pci_info(eth_dev, pdev);
2073 if (pdev->mem_resource[0].addr) {
2074 lio_dev->hw_addr = pdev->mem_resource[0].addr;
2076 PMD_INIT_LOG(ERR, "ERROR: Failed to map BAR0\n");
2080 lio_dev->eth_dev = eth_dev;
2081 /* set lio device print string */
2082 snprintf(lio_dev->dev_string, sizeof(lio_dev->dev_string),
2083 "%s[%02x:%02x.%x]", pdev->driver->driver.name,
2084 pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
2086 lio_dev->port_id = eth_dev->data->port_id;
2088 if (lio_first_time_init(lio_dev, pdev)) {
2089 lio_dev_err(lio_dev, "Device init failed\n");
2093 eth_dev->dev_ops = &liovf_eth_dev_ops;
2094 eth_dev->data->mac_addrs = rte_zmalloc("lio", RTE_ETHER_ADDR_LEN, 0);
2095 if (eth_dev->data->mac_addrs == NULL) {
2096 lio_dev_err(lio_dev,
2097 "MAC addresses memory allocation failed\n");
2098 eth_dev->dev_ops = NULL;
2099 eth_dev->rx_pkt_burst = NULL;
2100 eth_dev->tx_pkt_burst = NULL;
2104 rte_atomic64_set(&lio_dev->status, LIO_DEV_RUNNING);
2107 lio_dev->port_configured = 0;
2108 /* Always allow unicast packets */
2109 lio_dev->ifflags |= LIO_IFFLAG_UNICAST;
2115 lio_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
2116 struct rte_pci_device *pci_dev)
2118 return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct lio_device),
2123 lio_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
2125 return rte_eth_dev_pci_generic_remove(pci_dev,
2126 lio_eth_dev_uninit);
2129 /* Set of PCI devices this driver supports */
2130 static const struct rte_pci_id pci_id_liovf_map[] = {
2131 { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_VF_VID) },
2132 { .vendor_id = 0, /* sentinel */ }
2135 static struct rte_pci_driver rte_liovf_pmd = {
2136 .id_table = pci_id_liovf_map,
2137 .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
2138 .probe = lio_eth_dev_pci_probe,
2139 .remove = lio_eth_dev_pci_remove,
2142 RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd);
2143 RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map);
2144 RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio-pci");
2145 RTE_LOG_REGISTER_SUFFIX(lio_logtype_init, init, NOTICE);
2146 RTE_LOG_REGISTER_SUFFIX(lio_logtype_driver, driver, NOTICE);