kni: minor changes
Signed-off-by: Intel
This commit is contained in:
parent
c1f86306a0
commit
abc3630ed3
2
lib/librte_eal/linuxapp/kni/Makefile
Executable file → Normal file
2
lib/librte_eal/linuxapp/kni/Makefile
Executable file → Normal file
@ -41,7 +41,9 @@ MODULE = rte_kni
|
||||
#
|
||||
MODULE_CFLAGS += -I$(SRCDIR) --param max-inline-insns-single=50
|
||||
MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/ethtool/igb
|
||||
MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
|
||||
MODULE_CFLAGS += -Wall -Werror
|
||||
MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
|
||||
|
||||
# this lib needs main eal
|
||||
DEPDIRS-y += lib/librte_eal/linuxapp/eal
|
||||
|
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_82598.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_api.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_api.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_x540.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_x540.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_x540.h
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_x540.h
Executable file → Normal file
1
lib/librte_eal/linuxapp/kni/kni_dev.h
Executable file → Normal file
1
lib/librte_eal/linuxapp/kni/kni_dev.h
Executable file → Normal file
@ -37,6 +37,7 @@
|
||||
/**
|
||||
* A structure describing the private information for a kni device.
|
||||
*/
|
||||
|
||||
struct kni_dev {
|
||||
/* kni list */
|
||||
struct list_head list;
|
||||
|
0
lib/librte_eal/linuxapp/kni/kni_ethtool.c
Executable file → Normal file
0
lib/librte_eal/linuxapp/kni/kni_ethtool.c
Executable file → Normal file
20
lib/librte_eal/linuxapp/kni/kni_misc.c
Executable file → Normal file
20
lib/librte_eal/linuxapp/kni/kni_misc.c
Executable file → Normal file
@ -258,7 +258,6 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
|
||||
|
||||
kni->req_q = phys_to_virt(dev_info.req_phys);
|
||||
kni->resp_q = phys_to_virt(dev_info.resp_phys);
|
||||
|
||||
kni->sync_va = dev_info.sync_va;
|
||||
kni->sync_kva = phys_to_virt(dev_info.sync_phys);
|
||||
|
||||
@ -298,13 +297,13 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
|
||||
(PCI_SLOT(pci->devfn) == dev_info.devid) &&
|
||||
(PCI_FUNC(pci->devfn) == dev_info.function)) {
|
||||
found_pci = pci;
|
||||
|
||||
switch (dev_info.device_id) {
|
||||
#define RTE_PCI_DEV_ID_DECL_IGB(vend, dev) case (dev):
|
||||
#include <rte_pci_dev_ids.h>
|
||||
ret = igb_kni_probe(found_pci, &lad_dev);
|
||||
break;
|
||||
#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) case (dev):
|
||||
#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) \
|
||||
case (dev):
|
||||
#include <rte_pci_dev_ids.h>
|
||||
ret = ixgbe_kni_probe(found_pci, &lad_dev);
|
||||
break;
|
||||
@ -313,12 +312,12 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
|
||||
break;
|
||||
}
|
||||
|
||||
KNI_DBG("PCI found: pci=0x%p, lad_dev=0x%p\n", pci, lad_dev);
|
||||
KNI_DBG("PCI found: pci=0x%p, lad_dev=0x%p\n",
|
||||
pci, lad_dev);
|
||||
if (ret == 0) {
|
||||
kni->lad_dev = lad_dev;
|
||||
kni_set_ethtool_ops(kni->net_dev);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
KNI_ERR("Device not supported by ethtool");
|
||||
kni->lad_dev = NULL;
|
||||
}
|
||||
@ -327,17 +326,16 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
|
||||
kni->device_id = dev_info.device_id;
|
||||
break;
|
||||
}
|
||||
pci = pci_get_device(dev_info.vendor_id, dev_info.device_id,
|
||||
pci);
|
||||
pci = pci_get_device(dev_info.vendor_id,
|
||||
dev_info.device_id, pci);
|
||||
}
|
||||
|
||||
if (pci)
|
||||
pci_dev_put(pci);
|
||||
|
||||
ret = register_netdev(net_dev);
|
||||
if (ret) {
|
||||
KNI_ERR("error %i registering device \"%s\"\n", ret,
|
||||
dev_info.name);
|
||||
KNI_ERR("error %i registering device \"%s\"\n",
|
||||
ret, dev_info.name);
|
||||
free_netdev(net_dev);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
8
lib/librte_eal/linuxapp/kni/kni_net.c
Executable file → Normal file
8
lib/librte_eal/linuxapp/kni/kni_net.c
Executable file → Normal file
@ -572,14 +572,10 @@ kni_net_change_mtu(struct net_device *dev, int new_mtu)
|
||||
void
|
||||
kni_net_poll_resp(struct kni_dev *kni)
|
||||
{
|
||||
int i = kni_fifo_count(kni->resp_q);
|
||||
|
||||
if (i) {
|
||||
if (kni_fifo_count(kni->resp_q))
|
||||
wake_up_interruptible(&kni->wq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* It can be called to process the request.
|
||||
*/
|
||||
@ -621,7 +617,6 @@ kni_net_process_request(struct kni_dev *kni, struct rte_kni_request *req)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
memcpy(req, kni->sync_kva, sizeof(struct rte_kni_request));
|
||||
ret = 0;
|
||||
|
||||
@ -726,4 +721,3 @@ kni_net_config_lo_mode(char *lo_str)
|
||||
} else
|
||||
KNI_PRINT("Incognizant parameter, loopback disabled");
|
||||
}
|
||||
|
||||
|
6
lib/librte_kni/rte_kni.c
Executable file → Normal file
6
lib/librte_kni/rte_kni.c
Executable file → Normal file
@ -403,7 +403,7 @@ kni_allocate_mbufs(struct rte_kni *kni)
|
||||
uint8_t
|
||||
rte_kni_get_port_id(struct rte_kni *kni)
|
||||
{
|
||||
if (kni == NULL)
|
||||
if (!kni)
|
||||
return ~0x0;
|
||||
|
||||
return kni->port_id;
|
||||
@ -421,13 +421,13 @@ rte_kni_info_get(uint8_t port_id)
|
||||
|
||||
rte_snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%d", port_id);
|
||||
mz = rte_memzone_lookup(mz_name);
|
||||
if (NULL == mz)
|
||||
if (!mz)
|
||||
return NULL;
|
||||
|
||||
kni = mz->addr;
|
||||
if (0 == kni->port_in_use)
|
||||
return NULL;
|
||||
|
||||
|
||||
return kni;
|
||||
}
|
||||
|
||||
|
@ -79,19 +79,19 @@ struct rte_kni_ops {
|
||||
* The mbuf size to store a packet.
|
||||
*
|
||||
* @return
|
||||
* - The pointer to the context of a kni interface.
|
||||
* - The pointer to the context of a KNI interface.
|
||||
* - NULL indicate error.
|
||||
*/
|
||||
extern struct rte_kni *rte_kni_create(uint8_t port_id, unsigned mbuf_size,
|
||||
struct rte_mempool *pktmbuf_pool, struct rte_kni_ops *ops);
|
||||
|
||||
/**
|
||||
* Release kni interface according to the context. It will also release the
|
||||
* paired KNI interface in kernel space. All processing on the specific kni
|
||||
* Release KNI interface according to the context. It will also release the
|
||||
* paired KNI interface in kernel space. All processing on the specific KNI
|
||||
* context need to be stopped before calling this interface.
|
||||
*
|
||||
* @param kni
|
||||
* The pointer to the context of an existant kni interface.
|
||||
* The pointer to the context of an existant KNI interface.
|
||||
*
|
||||
* @return
|
||||
* - 0 indicates success.
|
||||
@ -105,22 +105,22 @@ extern int rte_kni_release(struct rte_kni *kni);
|
||||
* Finally constructs the response mbuf and puts it back to the resp_q.
|
||||
*
|
||||
* @param kni
|
||||
* The pointer to the context of an existant kni interface.
|
||||
* The pointer to the context of an existant KNI interface.
|
||||
*
|
||||
* @return
|
||||
* - 0
|
||||
* - 0
|
||||
* - negative value indicates failure.
|
||||
*/
|
||||
extern int rte_kni_handle_request(struct rte_kni *kni);
|
||||
|
||||
/**
|
||||
* Retrieve a burst of packets from a kni interface. The retrieved packets are
|
||||
* Retrieve a burst of packets from a KNI interface. The retrieved packets are
|
||||
* stored in rte_mbuf structures whose pointers are supplied in the array of
|
||||
* mbufs, and the maximum number is indicated by num. It handles the freeing of
|
||||
* the mbufs in the free queue of kni interface.
|
||||
* the mbufs in the free queue of KNI interface.
|
||||
*
|
||||
* @param kni
|
||||
* The kni interface context.
|
||||
* The KNI interface context.
|
||||
* @param mbufs
|
||||
* The array to store the pointers of mbufs.
|
||||
* @param num
|
||||
@ -133,13 +133,13 @@ extern unsigned rte_kni_rx_burst(struct rte_kni *kni,
|
||||
struct rte_mbuf **mbufs, unsigned num);
|
||||
|
||||
/**
|
||||
* Send a burst of packets to a kni interface. The packets to be sent out are
|
||||
* Send a burst of packets to a KNI interface. The packets to be sent out are
|
||||
* stored in rte_mbuf structures whose pointers are supplied in the array of
|
||||
* mbufs, and the maximum number is indicated by num. It handles allocating
|
||||
* the mbufs for kni interface alloc queue.
|
||||
* the mbufs for KNI interface alloc queue.
|
||||
*
|
||||
* @param kni
|
||||
* The kni interface context.
|
||||
* The KNI interface context.
|
||||
* @param mbufs
|
||||
* The array to store the pointers of mbufs.
|
||||
* @param num
|
||||
@ -152,10 +152,10 @@ extern unsigned rte_kni_tx_burst(struct rte_kni *kni,
|
||||
struct rte_mbuf **mbufs, unsigned num);
|
||||
|
||||
/**
|
||||
* Get the port id from kni interface.
|
||||
* Get the port id from KNI interface.
|
||||
*
|
||||
* @param kni
|
||||
* The kni interface context.
|
||||
* The KNI interface context.
|
||||
*
|
||||
* @return
|
||||
* On success: The port id.
|
||||
@ -164,23 +164,23 @@ extern unsigned rte_kni_tx_burst(struct rte_kni *kni,
|
||||
extern uint8_t rte_kni_get_port_id(struct rte_kni *kni);
|
||||
|
||||
/**
|
||||
* Get kni context information of the port.
|
||||
* Get the KNI context of the specific port.
|
||||
*
|
||||
* @port_id
|
||||
* @param port_id
|
||||
* the port id.
|
||||
*
|
||||
* @return
|
||||
* On success: Pointer to kni interface.
|
||||
* On success: Pointer to KNI interface.
|
||||
* On failure: NULL
|
||||
*/
|
||||
extern struct rte_kni * rte_kni_info_get(uint8_t port_id);
|
||||
|
||||
/**
|
||||
* Register kni request handling for a specified port,and it can
|
||||
* Register KNI request handling for a specified port,and it can
|
||||
* be called by master process or slave process.
|
||||
*
|
||||
* @param kni
|
||||
* pointer to struct rte_kni.
|
||||
* pointer to struct rte_kni.
|
||||
* @param ops
|
||||
* ponter to struct rte_kni_ops.
|
||||
*
|
||||
@ -192,10 +192,10 @@ extern int rte_kni_register_handlers(struct rte_kni *kni,
|
||||
struct rte_kni_ops *ops);
|
||||
|
||||
/**
|
||||
* Unregister kni request handling for a specified port.
|
||||
* Unregister KNI request handling for a specified port.
|
||||
*
|
||||
* @param kni
|
||||
* pointer to struct rte_kni.
|
||||
* @param kni
|
||||
* pointer to struct rte_kni.
|
||||
*
|
||||
* @return
|
||||
* On success: 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user