[ovs-dev] [PATCH 8/9] datapath-windows: Update OvsReadEventCmdHandler in Datapath.c to support different events
Paul Boca
pboca at cloudbasesolutions.com
Fri Jul 22 10:56:19 UTC 2016
Besides some alignment issues, looks god.
Acked-by: Paul Boca <pboca at cloudbasesolutions.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces at openvswitch.org] On Behalf Of Sairam
> Venugopal
> Sent: Thursday, July 14, 2016 2:39 AM
> To: dev at openvswitch.org
> Subject: [ovs-dev] [PATCH 8/9] datapath-windows: Update
> OvsReadEventCmdHandler in Datapath.c to support different events
>
> OvsReadEventCmdHandler must now reflect the right event being read. If the
> event is a Conntrack related event, then convert the entry to netlink
> format and send it to userspace. If it's Vport event, retain the existing
> workflow.
>
> Signed-off-by: Sairam Venugopal <vsairam at vmware.com>
> ---
> datapath-windows/ovsext/Datapath.c | 59
> +++++++++++++++++++++++++++++---------
> 1 file changed, 45 insertions(+), 14 deletions(-)
>
> diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-
> windows/ovsext/Datapath.c
> index a5a0b35..fff788a 100644
> --- a/datapath-windows/ovsext/Datapath.c
> +++ b/datapath-windows/ovsext/Datapath.c
> @@ -1674,7 +1674,6 @@
> OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
> #endif
> NL_BUFFER nlBuf;
> NTSTATUS status;
> - OVS_VPORT_EVENT_ENTRY eventEntry;
>
> ASSERT(usrParamsCtx->devOp == OVS_READ_DEV_OP);
>
> @@ -1687,21 +1686,53 @@
> OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
> /* Output buffer has been validated while validating read dev op. */
> ASSERT(msgOut != NULL && usrParamsCtx->outputLength >= sizeof
> *msgOut);
>
> - NlBufInit(&nlBuf, usrParamsCtx->outputBuffer, usrParamsCtx-
> >outputLength);
> + if (instance->protocol == NETLINK_NETFILTER) {
> + if (!instance->mcastMask) {
> + status = STATUS_SUCCESS;
> + *replyLen = 0;
> + goto cleanup;
> + }
>
> - /* remove an event entry from the event queue */
> - status = OvsRemoveVportEventEntry(usrParamsCtx->ovsInstance,
> - &eventEntry);
> - if (status != STATUS_SUCCESS) {
> - /* If there were not elements, read should return no data. */
> - status = STATUS_SUCCESS;
> - *replyLen = 0;
> - goto cleanup;
> - }
> + OVS_CT_EVENT_ENTRY ctEventEntry;
> + status = OvsRemoveCtEventEntry(usrParamsCtx->ovsInstance,
> &ctEventEntry);
[Paul Boca] This exceeds the 80 columns limit
>
> - status = OvsPortFillInfo(usrParamsCtx, &eventEntry, &nlBuf);
> - if (status == NDIS_STATUS_SUCCESS) {
> - *replyLen = NlBufSize(&nlBuf);
> + if (status != STATUS_SUCCESS) {
> + /* If there were not elements, read should return no data. */
> + status = STATUS_SUCCESS;
> + *replyLen = 0;
> + goto cleanup;
> + }
> +
> + status = OvsCreateNlMsgFromCtEntry(&ctEventEntry.entry,
> + usrParamsCtx->outputBuffer,
> + usrParamsCtx->outputLength,
> + ctEventEntry.type,
> + 0,
> + usrParamsCtx->ovsInstance->pid,
> + NFNETLINK_V0,
> + 0);
> + if (status == NDIS_STATUS_SUCCESS) {
> + *replyLen = msgOut->nlMsg.nlmsgLen;
> + }
> + } else if (instance->protocol == NETLINK_GENERIC) {
> + NlBufInit(&nlBuf, usrParamsCtx->outputBuffer, usrParamsCtx-
> >outputLength);
[Paul Boca] Same
> +
> + OVS_VPORT_EVENT_ENTRY eventEntry;
> + /* remove vport event entry from the vport event queue */
> + status = OvsRemoveVportEventEntry(usrParamsCtx->ovsInstance,
> &eventEntry);
[Paul Boca] This exceeds the 80 columns limit also
> + if (status != STATUS_SUCCESS) {
> + /* If there were not elements, read should return no data. */
> + status = STATUS_SUCCESS;
> + *replyLen = 0;
> + goto cleanup;
> + }
> +
> + status = OvsPortFillInfo(usrParamsCtx, &eventEntry, &nlBuf);
> + if (status == NDIS_STATUS_SUCCESS) {
> + *replyLen = NlBufSize(&nlBuf);
> + }
> + } else {
> + status = STATUS_INVALID_PARAMETER;
> }
>
> cleanup:
> --
> 2.9.0.windows.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list