From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B9DAA04BC; Fri, 9 Oct 2020 05:48:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 24FC61BEE3; Fri, 9 Oct 2020 05:48:48 +0200 (CEST) Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id C67331BE8A for ; Fri, 9 Oct 2020 05:48:45 +0200 (CEST) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E7D67C33B37D905B5016; Fri, 9 Oct 2020 11:48:43 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Fri, 9 Oct 2020 11:48:34 +0800 To: Ferruh Yigit , CC: , , , References: <1599534347-20430-1-git-send-email-humin29@huawei.com> <1602151376-23766-1-git-send-email-humin29@huawei.com> <1602151376-23766-4-git-send-email-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: <5345d216-0b3b-07cb-1f59-bcaa232a21a8@huawei.com> Date: Fri, 9 Oct 2020 11:48:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH V16 3/3] app/testpmd: add FEC command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Ferruh, I have fixed it, and send the patch. Please check it out, thanks. https://patches.dpdk.org/patch/80097/ 在 2020/10/8 23:57, Ferruh Yigit 写道: > On 10/8/2020 11:02 AM, Min Hu (Connor) wrote: >> This commit adds testpmd capability to query and config FEC >> function of device. This includes: >> - show FEC capabilities, example: >>     testpmd> show port 0 fec capabilities >> - show FEC mode, example: >>     testpmd> show port 0 fec_mode >> - config FEC mode, example: >>     testpmd> set port fec_mode auto|off|rs|baser >> >>     where: >> >>     auto|off|rs|baser are four kinds of FEC mode which dev >>     support according to MAC link speed. >> >> Signed-off-by: Min Hu (Connor) >> Reviewed-by: Wei Hu (Xavier) >> Reviewed-by: Chengwen Feng >> Reviewed-by: Chengchang Tang > > <...> > >> +static const struct { >> +    uint32_t speed; >> +    const char *name; >> +} eth_speed_name[] = { >> +    { >> +        .speed = ETH_SPEED_NUM_10G, >> +        .name = "Speed 10G", >> +    }, >> +    { >> +        .speed = ETH_SPEED_NUM_25G, >> +        .name = "Speed 25G", >> +    }, >> +    { >> +        .speed = ETH_SPEED_NUM_40G, >> +        .name = "Speed 40G", >> +    }, >> +    { >> +        .speed = ETH_SPEED_NUM_50G, >> +        .name = "Speed 50G", >> +    }, >> +    { >> +        .speed = ETH_SPEED_NUM_100G, >> +        .name = "Speed 100G", >> +    }, >> +    { >> +        .speed = ETH_SPEED_NUM_200G, >> +        .name = "Speed 200G", >> +    }, >> +}; >> + >>   static void >>   print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) >>   { >> @@ -2969,6 +3021,45 @@ set_tx_pkt_split(const char *name) >>       printf("unknown value: \"%s\"\n", name); >>   } >> +int >> +parse_fec_mode(const char *name, uint32_t *mode) >> +{ >> +    uint8_t i; >> + >> +    for (i = 0; i < RTE_DIM(fec_mode_name); i++) { >> +        if (strcmp(fec_mode_name[i].name, name) == 0) { >> +            *mode = RTE_ETH_FEC_MODE_TO_CAPA(fec_mode_name[i].mode); >> +            return 0; >> +        } >> +    } >> +    return -1; >> +} >> + >> +void >> +show_fec_capability(unsigned int num, struct rte_eth_fec_capa >> *speed_fec_capa) >> +{ >> +    unsigned int i, j, k; >> + >> +    printf("FEC capabilities:\n"); >> + >> +    for (i = 0; i < num; i++) { >> +        for (j = 0; j < RTE_DIM(eth_speed_name); j++) { >> +            if (eth_speed_name[j].speed == >> +                        speed_fec_capa[i].speed) { >> +                printf("%s : ", eth_speed_name[j].name); >> +                break; >> +            } >> +        } >> + >> +        for (k = RTE_ETH_FEC_AUTO; k < RTE_DIM(fec_mode_name); k++) { >> +            if (RTE_ETH_FEC_MODE_TO_CAPA(k) & >> +                        speed_fec_capa[i].capa) >> +                printf("%s ", fec_mode_name[k].name); >> +        } >> +        printf("\n"); >> +    } >> +} > > Hi Connor, > > Sorry for catching this late, but there is a new > 'rte_eth_link_speed_to_str()' API in the ethdev, which may enable > removing above global 'eth_speed_name' array [1]. > > I will proceed with this patchset, but can you please send an > increamental patch to use the 'rte_eth_link_speed_to_str()'? > If it comes before the next-net pulled I can squash it, if not it can > stay as individual patch. > > Thanks, > ferruh > > > [1] >     printf("%s : ", rte_eth_link_speed_to_str(speed_fec_capa[i].speed)); > > .