The memcpy operation overwrites the device info fields set
by ethdev API and leaves the device field undefined.
Thus, replaces memcpy by only updating the required fields
at the driver layer.
error log: testpmd> show port info 1
**** Infos for port 1 ****
MAC address: 00:00:00:00:00:00
Device name: net_softnic0
Segmentation fault.
port_infos_display (port_id=1) at /dpdk/app/test-pmd/config.c:418
if (dev_info.device->devargs && dev_info.device->devargs->args)
Fixes:
cc6d421574fe ("net/softnic: add softnic PMD")
Cc: stable@dpdk.org
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
.msg_handle_arg = NULL,
};
-static const struct rte_eth_dev_info pmd_dev_info = {
- .min_rx_bufsize = 0,
- .max_rx_pktlen = UINT32_MAX,
- .max_rx_queues = UINT16_MAX,
- .max_tx_queues = UINT16_MAX,
- .rx_desc_lim = {
- .nb_max = UINT16_MAX,
- .nb_min = 0,
- .nb_align = 1,
- },
- .tx_desc_lim = {
- .nb_max = UINT16_MAX,
- .nb_min = 0,
- .nb_align = 1,
- },
-};
-
static int pmd_softnic_logtype;
#define PMD_LOG(level, fmt, args...) \
pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_dev_info *dev_info)
{
- memcpy(dev_info, &pmd_dev_info, sizeof(*dev_info));
+ dev_info->max_rx_pktlen = UINT32_MAX;
+ dev_info->max_rx_queues = UINT16_MAX;
+ dev_info->max_tx_queues = UINT16_MAX;
}
static int