[dpdk-dev] [PATCH 1/3] kcp: add kernel control path kernel module
ferruh.yigit at intel.com
Thu Jan 28 14:50:38 CET 2016
On Thu, Jan 28, 2016 at 09:49:49AM +0000, Remy Horton wrote:
> Comments inline
> On 27/01/2016 16:24, Ferruh Yigit wrote:
> > This kernel module is based on KNI module, but this one is stripped
> > version of it and only for control messages, no data transfer
> > functionality provided.
> > This Linux kernel module helps userspace application create virtual
> > interfaces and when a control command issued into that virtual
> > interface, module pushes the command to the userspace and gets the
> > response back for the caller application.
> > Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> > ---
> > + net_dev = alloc_netdev(sizeof(struct kcp_dev), name,
> > +#ifdef NET_NAME_UNKNOWN
> > + NET_NAME_UNKNOWN,
> > +#endif
> > + kcp_net_init);
> Something doesn't feel quite right here. In cases where NET_NAME_UNKNOWN is
> undefined, is the signature for alloc_netdev different?
Yes, this is because of API change between kernel versions,
when NET_NAME_* introduced, alloc_netdev() also updated to have this.
> > +MODULE_LICENSE("Dual BSD/GPL");
> > +MODULE_AUTHOR("Intel Corporation");
> > +MODULE_DESCRIPTION("Kernel Module for managing kcp devices");
> I'm not up to speed on this area, but some of the file headers only mention
> GPL/LGPL. This correct?
This is because a header file (rte_kcp_common.h) shared by this kernel module and user-space application is dual licensed (BSD + GPL)
I mimicked this from exiting KNI.
> > + nlmsg_unicast(nl_sock, skb, pid);
> > + KCP_DBG("Sent cmd:%d port:%d\n", cmd_id, port_id);
> > +
> > + /*nlmsg_free(skb);*/
> > +
> > + return 0;
> > +}
> Oops.. :)
> Possible memory leak, or is *skb statically allocated?
No leak, not statically allocated, but taken care by nlmsg_unicast()
But commented code needs to be removed.
More information about the dev