Skip to content
Snippets Groups Projects
Commit 2d355d54 authored by Florian Pose's avatar Florian Pose
Browse files

Implemented poll(); receiving on generic device also works.

parent b8bfb6c0
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,7 @@ typedef struct {
int ec_gen_device_open(ec_gen_device_t *);
int ec_gen_device_stop(ec_gen_device_t *);
int ec_gen_device_start_xmit(ec_gen_device_t *, struct sk_buff *);
void ec_gen_device_poll(ec_gen_device_t *);
/*****************************************************************************/
......@@ -107,6 +108,8 @@ static int ec_gen_netdev_start_xmit(
void ec_gen_poll(struct net_device *dev)
{
ec_gen_device_t *gendev = *((ec_gen_device_t **) netdev_priv(dev));
ec_gen_device_poll(gendev);
}
/*****************************************************************************/
......@@ -271,6 +274,35 @@ int ec_gen_device_start_xmit(
/*****************************************************************************/
/** Polls the device.
*/
void ec_gen_device_poll(
ec_gen_device_t *dev
)
{
struct msghdr msg;
struct kvec iov;
char buf[2000]; // FIXME
int ret, budget = 10; // FIXME
iov.iov_base = buf;
iov.iov_len = 2000;
memset(&msg, 0, sizeof(msg));
do {
ret = kernel_recvmsg(dev->socket, &msg, &iov, 1, iov.iov_len,
MSG_DONTWAIT);
if (ret > 0) {
ecdev_receive(dev->ecdev, buf, ret);
} else if (ret < 0) {
break;
}
budget--;
} while (budget);
}
/*****************************************************************************/
/** Offer device.
*/
int offer_device(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment