diff options
Diffstat (limited to 'drivers/net/octeontx')
-rw-r--r-- | drivers/net/octeontx/Makefile | 3 | ||||
-rw-r--r-- | drivers/net/octeontx/base/octeontx_bgx.c | 22 | ||||
-rw-r--r-- | drivers/net/octeontx/base/octeontx_pkivf.c | 10 | ||||
-rw-r--r-- | drivers/net/octeontx/base/octeontx_pkivf.h | 10 | ||||
-rw-r--r-- | drivers/net/octeontx/octeontx_ethdev.c | 102 | ||||
-rw-r--r-- | drivers/net/octeontx/octeontx_ethdev.h | 4 |
6 files changed, 63 insertions, 88 deletions
diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile index 3e4a1066..885f1768 100644 --- a/drivers/net/octeontx/Makefile +++ b/drivers/net/octeontx/Makefile @@ -10,6 +10,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_octeontx.a CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ EXPORT_MAP := rte_pmd_octeontx_version.map @@ -46,7 +47,7 @@ endif CFLAGS_octeontx_ethdev.o += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring -LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_common_octeontx LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeontx/base/octeontx_bgx.c index 8576d8ed..0e238826 100644 --- a/drivers/net/octeontx/base/octeontx_bgx.c +++ b/drivers/net/octeontx/base/octeontx_bgx.c @@ -19,7 +19,7 @@ octeontx_bgx_port_open(int port, octeontx_mbox_bgx_port_conf_t *conf) hdr.msg = MBOX_BGX_PORT_OPEN; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_conf, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_conf, len); if (res < 0) return -EACCES; @@ -49,7 +49,7 @@ octeontx_bgx_port_close(int port) hdr.msg = MBOX_BGX_PORT_CLOSE; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -66,7 +66,7 @@ octeontx_bgx_port_start(int port) hdr.msg = MBOX_BGX_PORT_START; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -83,7 +83,7 @@ octeontx_bgx_port_stop(int port) hdr.msg = MBOX_BGX_PORT_STOP; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -103,7 +103,7 @@ octeontx_bgx_port_get_config(int port, octeontx_mbox_bgx_port_conf_t *conf) hdr.vfid = port; memset(&bgx_conf, 0, sizeof(octeontx_mbox_bgx_port_conf_t)); - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_conf, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_conf, len); if (res < 0) return -EACCES; @@ -135,7 +135,7 @@ octeontx_bgx_port_status(int port, octeontx_mbox_bgx_port_status_t *stat) hdr.msg = MBOX_BGX_PORT_GET_STATUS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_stat, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_stat, len); if (res < 0) return -EACCES; @@ -156,7 +156,7 @@ octeontx_bgx_port_stats(int port, octeontx_mbox_bgx_port_stats_t *stats) hdr.msg = MBOX_BGX_PORT_GET_STATS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_stats, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_stats, len); if (res < 0) return -EACCES; @@ -181,7 +181,7 @@ octeontx_bgx_port_stats_clr(int port) hdr.msg = MBOX_BGX_PORT_CLR_STATS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -200,7 +200,7 @@ octeontx_bgx_port_link_status(int port) hdr.msg = MBOX_BGX_PORT_GET_LINK_STATUS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &link, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &link, len); if (res < 0) return -EACCES; @@ -219,7 +219,7 @@ octeontx_bgx_port_promisc_set(int port, int en) hdr.vfid = port; prom = en ? 1 : 0; - res = octeontx_ssovf_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0); + res = octeontx_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0); if (res < 0) return -EACCES; @@ -237,7 +237,7 @@ octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr) hdr.msg = MBOX_BGX_PORT_SET_MACADDR; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, mac_addr, len, NULL, 0); + res = octeontx_mbox_send(&hdr, mac_addr, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c index 58a7f110..1babea0e 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.c +++ b/drivers/net/octeontx/base/octeontx_pkivf.c @@ -19,7 +19,7 @@ octeontx_pki_port_open(int port) hdr.msg = MBOX_PKI_PORT_OPEN; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; return res; @@ -38,7 +38,7 @@ octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg) hdr.msg = MBOX_PKI_PORT_HASH_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &h_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &h_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -58,7 +58,7 @@ octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg) hdr.msg = MBOX_PKI_PORT_PKTBUF_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &b_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &b_cfg, len, NULL, 0); if (res < 0) return -EACCES; return res; @@ -77,7 +77,7 @@ octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_CREATE_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -99,7 +99,7 @@ octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg) hdr.msg = MBOX_PKI_PORT_ERRCHK_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &e_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &e_cfg, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/drivers/net/octeontx/base/octeontx_pkivf.h b/drivers/net/octeontx/base/octeontx_pkivf.h index d036054c..764aff53 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.h +++ b/drivers/net/octeontx/base/octeontx_pkivf.h @@ -422,7 +422,7 @@ octeontx_pki_port_modify_qos(int port, pki_mod_qos_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_MODIFY_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -442,7 +442,7 @@ octeontx_pki_port_delete_qos(int port, pki_del_qos_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_DELETE_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -464,7 +464,7 @@ octeontx_pki_port_close(int port) hdr.msg = MBOX_PKI_PORT_CLOSE; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; @@ -486,7 +486,7 @@ octeontx_pki_port_start(int port) hdr.msg = MBOX_PKI_PORT_START; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; @@ -508,7 +508,7 @@ octeontx_pki_port_stop(int port) hdr.msg = MBOX_PKI_PORT_STOP; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index b739c0b3..1eb453b2 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -122,7 +122,7 @@ octeontx_port_open(struct octeontx_nic *nic) int res; res = 0; - + memset(&bgx_port_conf, 0x0, sizeof(bgx_port_conf)); PMD_INIT_FUNC_TRACE(); res = octeontx_bgx_port_open(nic->port_id, &bgx_port_conf); @@ -283,34 +283,14 @@ octeontx_dev_configure(struct rte_eth_dev *dev) return -EINVAL; } - if (!rxmode->hw_strip_crc) { + if (!(rxmode->offloads & DEV_RX_OFFLOAD_CRC_STRIP)) { PMD_INIT_LOG(NOTICE, "can't disable hw crc strip"); - rxmode->hw_strip_crc = 1; - } - - if (rxmode->hw_ip_checksum) { - PMD_INIT_LOG(NOTICE, "rxcksum not supported"); - rxmode->hw_ip_checksum = 0; - } - - if (rxmode->split_hdr_size) { - octeontx_log_err("rxmode does not support split header"); - return -EINVAL; + rxmode->offloads |= DEV_RX_OFFLOAD_CRC_STRIP; } - if (rxmode->hw_vlan_filter) { - octeontx_log_err("VLAN filter not supported"); - return -EINVAL; - } - - if (rxmode->hw_vlan_extend) { - octeontx_log_err("VLAN extended not supported"); - return -EINVAL; - } - - if (rxmode->enable_lro) { - octeontx_log_err("LRO not supported"); - return -EINVAL; + if (!(txmode->offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) { + PMD_INIT_LOG(NOTICE, "cant disable lockfree tx"); + txmode->offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE; } if (conf->link_speeds & ETH_LINK_SPEED_FIXED) { @@ -488,20 +468,6 @@ octeontx_dev_promisc_disable(struct rte_eth_dev *dev) octeontx_port_promisc_set(nic, 0); } -static inline int -octeontx_atomic_write_link_status(struct rte_eth_dev *dev, - struct rte_eth_link *link) -{ - struct rte_eth_link *dst = &dev->data->dev_link; - struct rte_eth_link *src = link; - - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) - return -1; - - return 0; -} - static int octeontx_port_link_status(struct octeontx_nic *nic) { @@ -532,7 +498,6 @@ octeontx_dev_link_update(struct rte_eth_dev *dev, struct rte_eth_link link; int res; - res = 0; PMD_INIT_FUNC_TRACE(); res = octeontx_port_link_status(nic); @@ -566,6 +531,7 @@ octeontx_dev_link_update(struct rte_eth_dev *dev, case OCTEONTX_LINK_SPEED_RESERVE1: case OCTEONTX_LINK_SPEED_RESERVE2: default: + link.link_speed = ETH_SPEED_NUM_NONE; octeontx_log_err("incorrect link speed %d", nic->speed); break; } @@ -573,7 +539,7 @@ octeontx_dev_link_update(struct rte_eth_dev *dev, link.link_duplex = ETH_LINK_FULL_DUPLEX; link.link_autoneg = ETH_LINK_AUTONEG; - return octeontx_atomic_write_link_status(dev, &link); + return rte_eth_linkstatus_set(dev, &link); } static int @@ -594,7 +560,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) octeontx_port_stats_clr(nic); } -static void +static int octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) { @@ -605,6 +571,8 @@ octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, if (ret != 0) octeontx_log_err("failed to set MAC address on port %d", nic->port_id); + + return ret; } static void @@ -619,28 +587,25 @@ octeontx_dev_info(struct rte_eth_dev *dev, ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G; - dev_info->driver_name = RTE_STR(rte_octeontx_pmd); dev_info->max_mac_addrs = 1; dev_info->max_rx_pktlen = PKI_MAX_PKTLEN; dev_info->max_rx_queues = 1; dev_info->max_tx_queues = PKO_MAX_NUM_DQ; dev_info->min_rx_bufsize = 0; - dev_info->pci_dev = NULL; dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_free_thresh = 0, .rx_drop_en = 0, + .offloads = OCTEONTX_RX_OFFLOADS, }; dev_info->default_txconf = (struct rte_eth_txconf) { .tx_free_thresh = 0, - .txq_flags = - ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS | - ETH_TXQ_FLAGS_NOXSUMS, + .offloads = OCTEONTX_TX_OFFLOADS, }; - dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MT_LOCKFREE; + dev_info->rx_offload_capa = OCTEONTX_RX_OFFLOADS; + dev_info->tx_offload_capa = OCTEONTX_TX_OFFLOADS; } static void @@ -744,7 +709,7 @@ octeontx_dev_tx_queue_release(void *tx_queue) static int octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, - const struct rte_eth_txconf *tx_conf) + const struct rte_eth_txconf *tx_conf __rte_unused) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); struct octeontx_txq *txq = NULL; @@ -753,7 +718,6 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, RTE_SET_USED(nb_desc); RTE_SET_USED(socket_id); - RTE_SET_USED(tx_conf); dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx; @@ -1039,7 +1003,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, char octtx_name[OCTEONTX_MAX_NAME_LEN]; struct octeontx_nic *nic = NULL; struct rte_eth_dev *eth_dev = NULL; - struct rte_eth_dev_data *data = NULL; + struct rte_eth_dev_data *data; const char *name = rte_vdev_device_name(dev); PMD_INIT_FUNC_TRACE(); @@ -1052,16 +1016,10 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, eth_dev->tx_pkt_burst = octeontx_xmit_pkts; eth_dev->rx_pkt_burst = octeontx_recv_pkts; + rte_eth_dev_probing_finish(eth_dev); return 0; } - data = rte_zmalloc_socket(octtx_name, sizeof(*data), 0, socket_id); - if (data == NULL) { - octeontx_log_err("failed to allocate devdata"); - res = -ENOMEM; - goto err; - } - nic = rte_zmalloc_socket(octtx_name, sizeof(*nic), 0, socket_id); if (nic == NULL) { octeontx_log_err("failed to allocate nic structure"); @@ -1097,11 +1055,9 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->data->numa_node = dev->device.numa_node; - rte_memcpy(data, (eth_dev)->data, sizeof(*data)); + data = eth_dev->data; data->dev_private = nic; - data->port_id = eth_dev->data->port_id; - snprintf(data->name, sizeof(data->name), "%s", eth_dev->data->name); nic->ev_queues = 1; nic->ev_ports = 1; @@ -1120,7 +1076,6 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, goto err; } - eth_dev->data = data; eth_dev->dev_ops = &octeontx_dev_ops; /* Finally save ethdev pointer to the NIC structure */ @@ -1146,10 +1101,11 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, rte_octeontx_pchan_map[(nic->base_ochan >> 8) & 0x7] [(nic->base_ochan >> 4) & 0xF] = data->port_id; + rte_eth_dev_probing_finish(eth_dev); return data->port_id; err: - if (port) + if (nic) octeontx_port_close(nic); if (eth_dev != NULL) { @@ -1188,7 +1144,6 @@ octeontx_remove(struct rte_vdev_device *dev) rte_free(eth_dev->data->mac_addrs); rte_free(eth_dev->data->dev_private); - rte_free(eth_dev->data); rte_eth_dev_release_port(eth_dev); rte_event_dev_close(nic->evdev); } @@ -1210,12 +1165,27 @@ octeontx_probe(struct rte_vdev_device *dev) struct rte_event_dev_config dev_conf; const char *eventdev_name = "event_octeontx"; struct rte_event_dev_info info; + struct rte_eth_dev *eth_dev; struct octeontx_vdev_init_params init_params = { OCTEONTX_VDEV_DEFAULT_MAX_NR_PORT }; dev_name = rte_vdev_device_name(dev); + + if (rte_eal_process_type() == RTE_PROC_SECONDARY && + strlen(rte_vdev_device_args(dev)) == 0) { + eth_dev = rte_eth_dev_attach_secondary(dev_name); + if (!eth_dev) { + RTE_LOG(ERR, PMD, "Failed to probe %s\n", dev_name); + return -1; + } + /* TODO: request info from primary to set up Rx and Tx */ + eth_dev->dev_ops = &octeontx_dev_ops; + rte_eth_dev_probing_finish(eth_dev); + return 0; + } + res = octeontx_parse_vdev_init_params(&init_params, dev); if (res < 0) return -EINVAL; diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index 10e42e14..14f16969 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -28,6 +28,10 @@ #define OCTEONTX_MAX_BGX_PORTS 4 #define OCTEONTX_MAX_LMAC_PER_BGX 4 +#define OCTEONTX_RX_OFFLOADS (DEV_RX_OFFLOAD_CRC_STRIP \ + | DEV_RX_OFFLOAD_CHECKSUM) +#define OCTEONTX_TX_OFFLOADS DEV_TX_OFFLOAD_MT_LOCKFREE + static inline struct octeontx_nic * octeontx_pmd_priv(struct rte_eth_dev *dev) { |