X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fhinic%2Fhinic_pmd_ethdev.c;h=2f0f33a8dadb2648bb0b8ca1aa77f296d5d15dd2;hb=39395b9d41aff5488db4924df94098abbe4d4e8c;hp=cfbca6405374e3b1e951d5f96caa3536948d6e40;hpb=54faba2295bdc5406cbbbe150189619c7b552fe8;p=dpdk.git diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index cfbca64053..2f0f33a8da 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -354,7 +354,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev) return err; } - /*clear fdir filter flag in function table*/ + /* clear fdir filter flag in function table */ hinic_free_fdir_filter(nic_dev); return HINIC_OK; @@ -440,7 +440,7 @@ static int hinic_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } nic_dev->rxqs[queue_idx] = rxq; - /* alloc rx sq hw wqepage*/ + /* alloc rx sq hw wqe page */ rc = hinic_create_rq(hwdev, queue_idx, rq_depth, socket_id); if (rc) { PMD_DRV_LOG(ERR, "Create rxq[%d] failed, dev_name: %s, rq_depth: %d", @@ -1529,8 +1529,9 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev) static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { - int ret = 0; struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); + uint32_t frame_size; + int ret = 0; PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, max_pkt_len: %d", dev->data->port_id, mtu, HINIC_MTU_TO_PKTLEN(mtu)); @@ -1548,7 +1549,15 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) } /* update max frame size */ - dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu); + frame_size = HINIC_MTU_TO_PKTLEN(mtu); + if (frame_size > RTE_ETHER_MAX_LEN) + dev->data->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + else + dev->data->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; + + dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size; nic_dev->mtu_size = mtu; return ret; @@ -2026,12 +2035,12 @@ static int hinic_rss_conf_get(struct rte_eth_dev *dev, } /** - * DPDK callback to update the RETA indirection table. + * DPDK callback to update the RSS redirection table. * * @param dev * Pointer to Ethernet device structure. * @param reta_conf - * Pointer to RETA configuration structure array. + * Pointer to RSS reta configuration data. * @param reta_size * Size of the RETA table. * @@ -2066,16 +2075,16 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev, for (i = 0; i < reta_size; i++) { idx = i / RTE_RETA_GROUP_SIZE; shift = i % RTE_RETA_GROUP_SIZE; - if (reta_conf[idx].mask & (1ULL << shift)) - indirtbl[i] = reta_conf[idx].reta[shift]; - } - for (i = 0 ; i < reta_size; i++) { - if (indirtbl[i] >= nic_dev->num_rq) { - PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d", - i, nic_dev->num_rq); - goto disable_rss; + if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) { + PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d " + "exceeds the maximum rxq num: %d", i, + reta_conf[idx].reta[shift], nic_dev->num_rq); + return -EINVAL; } + + if (reta_conf[idx].mask & (1ULL << shift)) + indirtbl[i] = reta_conf[idx].reta[shift]; } err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl); @@ -2093,14 +2102,13 @@ disable_rss: return HINIC_ERROR; } - /** - * DPDK callback to get the RETA indirection table. + * DPDK callback to get the RSS indirection table. * * @param dev * Pointer to Ethernet device structure. * @param reta_conf - * Pointer to RETA configuration structure array. + * Pointer to RSS reta configuration data. * @param reta_size * Size of the RETA table. * @@ -2300,8 +2308,7 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev, for (i = 0; i < HINIC_VPORT_XSTATS_NUM; i++) { snprintf(xstats_names[count].name, sizeof(xstats_names[count].name), - "%s", - hinic_vport_stats_strings[i].name); + "%s", hinic_vport_stats_strings[i].name); count++; } @@ -2312,13 +2319,13 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev, for (i = 0; i < HINIC_PHYPORT_XSTATS_NUM; i++) { snprintf(xstats_names[count].name, sizeof(xstats_names[count].name), - "%s", - hinic_phyport_stats_strings[i].name); + "%s", hinic_phyport_stats_strings[i].name); count++; } return count; } + /** * DPDK callback to set mac address * @@ -2483,19 +2490,19 @@ allmulti: } /** - * DPDK callback to manage filter operations + * DPDK callback to manage filter control operations * * @param dev * Pointer to Ethernet device structure. * @param filter_type - * Filter type. + * Filter type, which just supports generic type. * @param filter_op - * Operation to perform. + * Filter operation to perform. * @param arg * Pointer to operation-specific structure. * * @return - * 0 on success, negative errno value on failure. + * 0 on success, negative error value otherwise. */ static int hinic_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, @@ -2803,8 +2810,12 @@ static int hinic_nic_dev_create(struct rte_eth_dev *eth_dev) } /* get nic capability */ - if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap)) + if (!hinic_support_nic(nic_dev->hwdev, &nic_dev->nic_cap)) { + PMD_DRV_LOG(ERR, "Hw doesn't support nic, dev_name: %s", + eth_dev->data->name); + rc = -EINVAL; goto nic_check_fail; + } /* init root cla and function table */ rc = hinic_init_nicio(nic_dev->hwdev);