Hi Ferruh,

   Thanks for your comments, I have added min_mtu & max_mtu to 
hinic_dev_infos_get interface, which will be shown in Patch V3.

Best regards
Xiaoyun Wang

在 2019/9/27 2:47, Ferruh Yigit 写道:
On 9/25/2019 3:30 PM, Xiaoyun wang wrote:
When enable allmulticast mode, all multicast packets
can be received. This patch also adds support for mtu set,
the range of MTU is from 256 to 9600.

Signed-off-by: Xiaoyun wang <cloud.wangxiao...@huawei.com>
<...>

+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);
+
+       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));
+
+       if (mtu < HINIC_MIN_MTU_SIZE || mtu > HINIC_MAX_MTU_SIZE) {
+               PMD_DRV_LOG(ERR, "Invalid mtu: %d, must between %d and %d",
+                               mtu, HINIC_MIN_MTU_SIZE, HINIC_MAX_MTU_SIZE);
+               return -EINVAL;
+       }
+
+       ret = hinic_set_port_mtu(nic_dev->hwdev, mtu);
+       if (ret) {
+               PMD_DRV_LOG(ERR, "Set port mtu failed, ret: %d", ret);
+               return ret;
+       }
+
+       /* update max frame size */
+       dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu);
+       nic_dev->mtu_size = mtu;
+
+       return ret;
+}
There are (relatively) new 'min_mtu' & 'max_mtu' in 'struct rte_eth_dev_info',
since MTU is enabled you may prefer to set them in "hinic_dev_infos_get()'

Reply via email to