X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbonding%2Frte_eth_bond_pmd.c;h=54987d96b34d74a3030ea459c2ac3540690754a4;hb=437dbd2fd4289c32e2937a1e7dbe95645457dfff;hp=57327de770bb605ab5bb7dcae6f2c89ad83f48a2;hpb=fb0379bc5db3733127312e79db318192d3052715;p=dpdk.git diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 57327de770..54987d96b3 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -7,8 +7,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -473,17 +473,13 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #ifdef RTE_LIBRTE_BOND_DEBUG_ALB #define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \ rte_log(RTE_LOG_DEBUG, bond_logtype, \ - "%s port:%d SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X SrcIP:%s " \ - "DstMAC:%02X:%02X:%02X:%02X:%02X:%02X DstIP:%s %s %d\n", \ + "%s port:%d SrcMAC:" RTE_ETHER_ADDR_PRT_FMT " SrcIP:%s " \ + "DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d\n", \ info, \ port, \ - eth_h->s_addr.addr_bytes[0], eth_h->s_addr.addr_bytes[1], \ - eth_h->s_addr.addr_bytes[2], eth_h->s_addr.addr_bytes[3], \ - eth_h->s_addr.addr_bytes[4], eth_h->s_addr.addr_bytes[5], \ + RTE_ETHER_ADDR_BYTES(ð_h->s_addr), \ src_ip, \ - eth_h->d_addr.addr_bytes[0], eth_h->d_addr.addr_bytes[1], \ - eth_h->d_addr.addr_bytes[2], eth_h->d_addr.addr_bytes[3], \ - eth_h->d_addr.addr_bytes[4], eth_h->d_addr.addr_bytes[5], \ + RTE_ETHER_ADDR_BYTES(ð_h->d_addr), \ dst_ip, \ arp_op, ++burstnumber) #endif @@ -1728,6 +1724,17 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, slave_eth_dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + slave_eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = + bonded_eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + + if (bonded_eth_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_JUMBO_FRAME) + slave_eth_dev->data->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + else + slave_eth_dev->data->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; + nb_rx_queues = bonded_eth_dev->data->nb_rx_queues; nb_tx_queues = bonded_eth_dev->data->nb_tx_queues; @@ -1794,12 +1801,13 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, != 0) return errval; - if (bond_ethdev_8023ad_flow_verify(bonded_eth_dev, - slave_eth_dev->data->port_id) != 0) { + errval = bond_ethdev_8023ad_flow_verify(bonded_eth_dev, + slave_eth_dev->data->port_id); + if (errval != 0) { RTE_BOND_LOG(ERR, - "rte_eth_tx_queue_setup: port=%d queue_id %d, err (%d)", - slave_eth_dev->data->port_id, q_id, errval); - return -1; + "bond_ethdev_8023ad_flow_verify: port=%d, err (%d)", + slave_eth_dev->data->port_id, errval); + return errval; } if (internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id] != NULL) @@ -1807,8 +1815,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id], &flow_error); - bond_ethdev_8023ad_flow_set(bonded_eth_dev, + errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev, slave_eth_dev->data->port_id); + if (errval != 0) { + RTE_BOND_LOG(ERR, + "bond_ethdev_8023ad_flow_set: port=%d, err (%d)", + slave_eth_dev->data->port_id, errval); + return errval; + } } /* Start device */ @@ -2049,11 +2063,12 @@ bond_ethdev_free_queues(struct rte_eth_dev *dev) } } -void +int bond_ethdev_stop(struct rte_eth_dev *eth_dev) { struct bond_dev_private *internals = eth_dev->data->dev_private; uint16_t i; + int ret; if (internals->mode == BONDING_MODE_8023AD) { struct port *port; @@ -2092,10 +2107,17 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) internals->active_slave_count, slave_id) != internals->active_slave_count) { internals->slaves[i].last_link_status = 0; - rte_eth_dev_stop(slave_id); + ret = rte_eth_dev_stop(slave_id); + if (ret != 0) { + RTE_BOND_LOG(ERR, "Failed to stop device on port %u", + slave_id); + return ret; + } deactivate_slave(eth_dev, slave_id); } } + + return 0; } int @@ -2137,6 +2159,9 @@ bond_ethdev_close(struct rte_eth_dev *dev) */ rte_mempool_free(internals->mode6.mempool); + if (internals->kvlist != NULL) + rte_kvargs_free(internals->kvlist); + return 0; } @@ -3089,14 +3114,11 @@ bond_ethdev_mac_address_set(struct rte_eth_dev *dev, } static int -bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused, - enum rte_filter_type type, enum rte_filter_op op, void *arg) +bond_flow_ops_get(struct rte_eth_dev *dev __rte_unused, + const struct rte_flow_ops **ops) { - if (type == RTE_ETH_FILTER_GENERIC && op == RTE_ETH_FILTER_GET) { - *(const void **)arg = &bond_flow_ops; - return 0; - } - return -ENOTSUP; + *ops = &bond_flow_ops; + return 0; } static int @@ -3188,7 +3210,7 @@ const struct eth_dev_ops default_dev_ops = { .mac_addr_set = bond_ethdev_mac_address_set, .mac_addr_add = bond_ethdev_mac_addr_add, .mac_addr_remove = bond_ethdev_mac_addr_remove, - .filter_ctrl = bond_filter_ctrl + .flow_ops_get = bond_flow_ops_get }; static int @@ -3226,7 +3248,8 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) } eth_dev->dev_ops = &default_dev_ops; - eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC; + eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC | + RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; rte_spinlock_init(&internals->lock); rte_spinlock_init(&internals->lsc_lock); @@ -3316,8 +3339,9 @@ bond_probe(struct rte_vdev_device *dev) const char *name; struct bond_dev_private *internals; struct rte_kvargs *kvlist; - uint8_t bonding_mode, socket_id/*, agg_mode*/; - int arg_count, port_id; + uint8_t bonding_mode; + int arg_count, port_id; + int socket_id; uint8_t agg_mode; struct rte_eth_dev *eth_dev; @@ -3424,6 +3448,7 @@ bond_remove(struct rte_vdev_device *dev) struct rte_eth_dev *eth_dev; struct bond_dev_private *internals; const char *name; + int ret = 0; if (!dev) return -EINVAL; @@ -3446,12 +3471,12 @@ bond_remove(struct rte_vdev_device *dev) return -EBUSY; if (eth_dev->data->dev_started == 1) { - bond_ethdev_stop(eth_dev); + ret = bond_ethdev_stop(eth_dev); bond_ethdev_close(eth_dev); } rte_eth_dev_release_port(eth_dev); - return 0; + return ret; } /* this part will resolve the slave portids after all the other pdev and vdev @@ -3757,4 +3782,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding, "up_delay= " "down_delay="); -RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE); +/* We can't use RTE_LOG_REGISTER_DEFAULT because of the forced name for + * this library, see meson.build. + */ +RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);