*
* Originally based upon librte_pmd_pcap code:
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
unsigned int framenum;
struct rte_mempool *mb_pool;
+ uint8_t in_port;
volatile unsigned long rx_pkts;
volatile unsigned long err_pkts;
ppd->tp_status = TP_STATUS_KERNEL;
if (++framenum >= framecount)
framenum = 0;
+ mbuf->port = pkt_q->in_port;
/* account for the receive frame */
bufs[i] = mbuf;
}
/* kick-off transmits */
- sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0);
+ if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1)
+ return 0; /* error sending -- no packets transmitted */
pkt_q->framenum = framenum;
pkt_q->tx_pkts += num_tx;
}
dev->data->rx_queues[rx_queue_id] = pkt_q;
+ pkt_q->in_port = dev->data->port_id;
return 0;
}
struct rte_kvargs *kvlist)
{
struct rte_eth_dev_data *data = NULL;
- struct rte_pci_device *pci_dev = NULL;
struct rte_kvargs_pair *pair = NULL;
struct ifreq ifr;
size_t ifnamelen;
if (data == NULL)
goto error_early;
- pci_dev = rte_zmalloc_socket(name, sizeof(*pci_dev), 0, numa_node);
- if (pci_dev == NULL)
- goto error_early;
-
*internals = rte_zmalloc_socket(name, sizeof(**internals),
0, numa_node);
if (*internals == NULL)
/*
* now put it all together
* - store queue data in internals,
- * - store numa_node info in pci_driver
- * - point eth_dev_data to internals and pci_driver
+ * - store numa_node in eth_dev
+ * - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
data->dev_link = pmd_link;
data->mac_addrs = &(*internals)->eth_addr;
- pci_dev->numa_node = numa_node;
-
(*eth_dev)->data = data;
(*eth_dev)->dev_ops = &ops;
- (*eth_dev)->pci_dev = pci_dev;
+ (*eth_dev)->driver = NULL;
+ (*eth_dev)->data->dev_flags = 0;
+ (*eth_dev)->data->drv_name = drivername;
+ (*eth_dev)->data->kdrv = RTE_KDRV_NONE;
+ (*eth_dev)->data->numa_node = numa_node;
return 0;
}
rte_free(*internals);
error_early:
- rte_free(pci_dev);
rte_free(data);
return -1;
}