summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-04-24 14:34:09 -0700
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-04-24 15:44:57 -0700
commit87ca6bff33a59f3375fed04c8313ffcf3609aeb1 (patch)
tree2d69094b126f464252bba87827f199b14df50f07
parentefc932f5d576b672c1f6a263446354053e314413 (diff)
libwimaxll: wimaxll_recv() doesn't use -ENODATA internally
wimaxll_revc() was returning -ENODATA when an unknown message was received from the kernel -- this really makes no sense as there is nothing the client can really do about it. As well, if no callback was executed, it is considered to be still not a failure (and thus, don't return -EINPROGRESS). Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rw-r--r--include/wimaxll.h5
-rw-r--r--lib/op-open.c18
2 files changed, 13 insertions, 10 deletions
diff --git a/include/wimaxll.h b/include/wimaxll.h
index c2469f2..87253bb 100644
--- a/include/wimaxll.h
+++ b/include/wimaxll.h
@@ -242,6 +242,11 @@ struct nlattr;
*
* Callbacks are always passed a pointer to a private context as set
* by the application.
+ *
+ * Callbacks can return -%EBUSY to have wimaxll_recv() stop processing
+ * messages and pass control to the caller (which will see it
+ * returning -%EBUSY). Callbacks *SHOULD NOT* return -%EINPROGRESS, as
+ * it is used internally by wimaxll_recv().
*/
diff --git a/lib/op-open.c b/lib/op-open.c
index a81af81..73019d9 100644
--- a/lib/op-open.c
+++ b/lib/op-open.c
@@ -108,10 +108,8 @@ static
*
* Called by nl_recvmsgs() when a valid message is received. We
* multiplex and handle messages that are known to the library. If the
- * message is unknown, do nothing other than setting -ENODATA.
- *
- * In wimaxll_recv(), -ENODATA is considered a retryable error --
- * effectively, the message is skipped.
+ * message is unknown, do nothing other than maybe printing an error
+ * message.
*
* The wimaxll_gnl_handle_*() functions need to return:
*
@@ -153,7 +151,7 @@ int wimaxll_gnl_cb(struct nl_msg *msg, void *_ctx)
default:
d_printf(3, wmx, "E: %s: received unknown gnl message %d\n",
__func__, gnl_hdr->cmd);
- result = -ENODATA;
+ result = 0;
}
if (result == -EBUSY) { /* stop signal from the user's callback */
result_nl = NL_STOP;
@@ -197,9 +195,7 @@ int wimaxll_recv_fd(struct wimaxll_handle *wmx)
* implementation of the callback). On error, a negative errno
* code:
*
- * -%EINPROGRESS: the message was not received.
- *
- * -%ENODATA: messages were received, but none of the known types.
+ * -%EBUSY: callback instructed to stop processing messages
*
* Read one or more messages from a multicast group and for each valid
* one, execute the callbacks set in the multi cast handle.
@@ -247,13 +243,15 @@ ssize_t wimaxll_recv(struct wimaxll_handle *wmx)
result = nl_recvmsgs(wmx->nlh_rx, cb);
d_printf(3, wmx, "I: ctx.result %zd result %zd\n",
ctx.result, result);
- } while ((ctx.result == -EINPROGRESS || ctx.result == -ENODATA)
+ } while ((ctx.result == -EINPROGRESS)
&& result > 0);
if (result < 0)
wimaxll_msg(wmx, "E: %s: nl_recvmgsgs failed: %zd\n",
__func__, result);
- else
+ else if (ctx.result != -EINPROGRESS)
result = ctx.result;
+ else
+ result = 0;
/* No complains on error; the kernel might just be sending an
* error out; pass it through. */
d_fnend(3, wmx, "(wmx %p) = %zd\n", wmx, result);