I didn’t have any issues in rebasing. Will be sending out the v2 in a bit.
-- Nithin > On Sep 23, 2015, at 7:50 AM, Alin Serdean <aserd...@cloudbasesolutions.com> > wrote: > > I could not get the patch to apply. You will probably need to rebase. > > Other comments inline. > > Alin. > >> -----Mesaj original----- >> De la: dev [mailto:dev-boun...@openvswitch.org] În numele Nithin Raju >> Trimis: Tuesday, September 15, 2015 9:52 PM >> Către: dev@openvswitch.org >> Subiect: [ovs-dev] [PATCH 1/4] datapath-windows: move packet read code >> to User.c >> >> Simple code motion. >> >> Signed-off-by: Nithin Raju <nit...@vmware.com> >> --- >> datapath-windows/ovsext/Datapath.c | 118 >> ++----------------------------------- >> datapath-windows/ovsext/User.c | 108 >> +++++++++++++++++++++++++++++++++ >> datapath-windows/ovsext/User.h | 7 +++ >> 3 files changed, 120 insertions(+), 113 deletions(-) >> >> diff --git a/datapath-windows/ovsext/Datapath.c b/datapath- >> windows/ovsext/Datapath.c >> index b7bbf80..409c4bb 100644 >> --- a/datapath-windows/ovsext/Datapath.c >> +++ b/datapath-windows/ovsext/Datapath.c >> @@ -89,11 +89,8 @@ typedef struct _NETLINK_FAMILY { >> >> /* Handlers for the various netlink commands. */ static NetlinkCmdHandler >> OvsPendEventCmdHandler, >> - OvsPendPacketCmdHandler, >> OvsSubscribeEventCmdHandler, >> - OvsSubscribePacketCmdHandler, >> OvsReadEventCmdHandler, >> - OvsReadPacketCmdHandler, >> OvsNewDpCmdHandler, >> OvsGetDpCmdHandler, >> OvsSetDpCmdHandler; >> @@ -102,7 +99,10 @@ NetlinkCmdHandler OvsGetNetdevCmdHandler, >> OvsGetVportCmdHandler, >> OvsSetVportCmdHandler, >> OvsNewVportCmdHandler, >> - OvsDeleteVportCmdHandler; >> + OvsDeleteVportCmdHandler, >> + OvsPendPacketCmdHandler, >> + OvsSubscribePacketCmdHandler, >> + OvsReadPacketCmdHandler; >> >> static NTSTATUS HandleGetDpTransaction(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> UINT32 *replyLen); @@ -1591,112 >> +1591,4 @@ >> OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, >> >> cleanup: >> return status; >> -} > [Alin Gabriel Serdean: ] Miss delete probably :). >> - >> -/* >> - * >> -------------------------------------------------------------------------- >> - * Handler for reading missed pacckets from the driver event queue. This >> - * handler is executed when user modes issues a socket receive on a socket >> - * >> -------------------------------------------------------------------------- >> - */ >> -static NTSTATUS >> -OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> - UINT32 *replyLen) >> -{ >> -#ifdef DBG >> - POVS_MESSAGE msgOut = (POVS_MESSAGE)usrParamsCtx- >>> outputBuffer; >> -#endif >> - POVS_OPEN_INSTANCE instance = >> - (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> - NTSTATUS status; >> - >> - ASSERT(usrParamsCtx->devOp == OVS_READ_DEV_OP); >> - >> - /* Should never read events with a dump socket */ >> - ASSERT(instance->dumpState.ovsMsg == NULL); >> - >> - /* Must have an packet queue */ >> - ASSERT(instance->packetQueue != NULL); >> - >> - /* Output buffer has been validated while validating read dev op. */ >> - ASSERT(msgOut != NULL && usrParamsCtx->outputLength >= sizeof >> *msgOut); >> - >> - /* Read a packet from the instance queue */ >> - status = OvsReadDpIoctl(instance->fileObject, usrParamsCtx- >>> outputBuffer, >> - usrParamsCtx->outputLength, replyLen); >> - return status; >> -} >> - >> -/* >> - * >> -------------------------------------------------------------------------- >> - * Handler for the subscription for a packet queue >> - * >> -------------------------------------------------------------------------- >> - */ >> -static NTSTATUS >> -OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> - UINT32 *replyLen) >> -{ >> - NDIS_STATUS status; >> - BOOLEAN rc; >> - UINT8 join; >> - UINT32 pid; >> - const NL_POLICY policy[] = { >> - [OVS_NL_ATTR_PACKET_PID] = {.type = NL_A_U32 }, >> - [OVS_NL_ATTR_PACKET_SUBSCRIBE] = {.type = NL_A_U8 } >> - }; >> - PNL_ATTR attrs[ARRAY_SIZE(policy)]; >> - >> - UNREFERENCED_PARAMETER(replyLen); >> - >> - POVS_OPEN_INSTANCE instance = >> - (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> - POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer; >> - >> - rc = NlAttrParse(&msgIn->nlMsg, sizeof (*msgIn), >> - NlMsgAttrsLen((PNL_MSG_HDR)msgIn), policy, ARRAY_SIZE(policy), >> - attrs, ARRAY_SIZE(attrs)); >> - if (!rc) { >> - status = STATUS_INVALID_PARAMETER; >> - goto done; >> - } >> - >> - join = NlAttrGetU8(attrs[OVS_NL_ATTR_PACKET_PID]); >> - pid = NlAttrGetU32(attrs[OVS_NL_ATTR_PACKET_PID]); >> - >> - /* The socket subscribed with must be the same socket we perform >> receive*/ >> - ASSERT(pid == instance->pid); >> - >> - status = OvsSubscribeDpIoctl(instance, pid, join); >> - >> - /* >> - * XXX Need to add this instance to a global data structure >> - * which hold all packet based instances. The data structure (hash) >> - * should be searched through the pid field of the instance for >> - * placing the missed packet into the correct queue >> - */ >> -done: >> - return status; >> -} >> - >> -/* >> - * >> -------------------------------------------------------------------------- >> - * Handler for queueing an IRP used for missed packet notification. The IRP >> is >> - * completed when a packet received and mismatched. STATUS_PENDING is >> returned >> - * on success. User mode keep a pending IRP at all times. >> - * >> -------------------------------------------------------------------------- >> - */ >> -static NTSTATUS >> -OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> - UINT32 *replyLen) >> -{ >> - UNREFERENCED_PARAMETER(replyLen); >> - >> - POVS_OPEN_INSTANCE instance = >> - (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> - >> - /* >> - * XXX access to packet queue must be through acquiring a lock as user >> mode >> - * could unsubscribe and the instnace will be freed. >> - */ >> - return OvsWaitDpIoctl(usrParamsCtx->irp, instance->fileObject); >> -} >> +} >> \ No newline at end of file > [Alin Gabriel Serdean: ] Could you also add a newline to the file. >> diff --git a/datapath-windows/ovsext/User.c b/datapath- >> windows/ovsext/User.c index 8045e9a..0bbf690 100644 >> --- a/datapath-windows/ovsext/User.c >> +++ b/datapath-windows/ovsext/User.c >> @@ -1156,3 +1156,111 @@ fail: >> OvsFreeMemoryWithTag(elem, OVS_USER_POOL_TAG); >> return NULL; >> } >> + >> +/* >> + * >> +----------------------------------------------------------------------- >> +--- >> + * Handler for the subscription for a packet queue >> + * >> +----------------------------------------------------------------------- >> +--- >> + */ >> +NTSTATUS >> +OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen) { >> + NDIS_STATUS status; >> + BOOLEAN rc; >> + UINT8 join; >> + UINT32 pid; >> + const NL_POLICY policy[] = { >> + [OVS_NL_ATTR_PACKET_PID] = {.type = NL_A_U32 }, >> + [OVS_NL_ATTR_PACKET_SUBSCRIBE] = {.type = NL_A_U8 } >> + }; >> + PNL_ATTR attrs[ARRAY_SIZE(policy)]; >> + >> + UNREFERENCED_PARAMETER(replyLen); >> + >> + POVS_OPEN_INSTANCE instance = >> + (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> + POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer; >> + >> + rc = NlAttrParse(&msgIn->nlMsg, sizeof (*msgIn), >> + NlMsgAttrsLen((PNL_MSG_HDR)msgIn), policy, ARRAY_SIZE(policy), >> + attrs, ARRAY_SIZE(attrs)); >> + if (!rc) { >> + status = STATUS_INVALID_PARAMETER; >> + goto done; >> + } >> + >> + join = NlAttrGetU8(attrs[OVS_NL_ATTR_PACKET_PID]); >> + pid = NlAttrGetU32(attrs[OVS_NL_ATTR_PACKET_PID]); >> + >> + /* The socket subscribed with must be the same socket we perform >> receive*/ >> + ASSERT(pid == instance->pid); >> + >> + status = OvsSubscribeDpIoctl(instance, pid, join); >> + >> + /* >> + * XXX Need to add this instance to a global data structure >> + * which hold all packet based instances. The data structure (hash) >> + * should be searched through the pid field of the instance for >> + * placing the missed packet into the correct queue >> + */ >> +done: >> + return status; >> +} >> + >> +/* >> + * >> +----------------------------------------------------------------------- >> +--- >> + * Handler for queueing an IRP used for missed packet notification. The >> +IRP is >> + * completed when a packet received and mismatched. STATUS_PENDING >> is >> +returned >> + * on success. User mode keep a pending IRP at all times. >> + * >> +----------------------------------------------------------------------- >> +--- >> + */ >> +NTSTATUS >> +OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen) { >> + UNREFERENCED_PARAMETER(replyLen); >> + >> + POVS_OPEN_INSTANCE instance = >> + (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> + >> + /* >> + * XXX access to packet queue must be through acquiring a lock as user >> mode >> + * could unsubscribe and the instnace will be freed. >> + */ >> + return OvsWaitDpIoctl(usrParamsCtx->irp, instance->fileObject); } >> + >> +/* >> + * >> +----------------------------------------------------------------------- >> +--- >> + * Handler for reading missed pacckets from the driver event queue. >> +This >> + * handler is executed when user modes issues a socket receive on a >> +socket >> + * >> +----------------------------------------------------------------------- >> +--- >> + */ >> +NTSTATUS >> +OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen) { #ifdef DBG >> + POVS_MESSAGE msgOut = (POVS_MESSAGE)usrParamsCtx- >>> outputBuffer; >> +#endif >> + POVS_OPEN_INSTANCE instance = >> + (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance; >> + NTSTATUS status; >> + >> + ASSERT(usrParamsCtx->devOp == OVS_READ_DEV_OP); >> + >> + /* Should never read events with a dump socket */ >> + ASSERT(instance->dumpState.ovsMsg == NULL); >> + >> + /* Must have an packet queue */ >> + ASSERT(instance->packetQueue != NULL); >> + >> + /* Output buffer has been validated while validating read dev op. */ >> + ASSERT(msgOut != NULL && usrParamsCtx->outputLength >= sizeof >> + *msgOut); >> + >> + /* Read a packet from the instance queue */ >> + status = OvsReadDpIoctl(instance->fileObject, usrParamsCtx- >>> outputBuffer, >> + usrParamsCtx->outputLength, replyLen); >> + return status; >> +} >> \ No newline at end of file > [Alin Gabriel Serdean: ] Could you also add a new line here as well. >> diff --git a/datapath-windows/ovsext/User.h b/datapath- >> windows/ovsext/User.h index 139b0ca..8b80ded 100644 >> --- a/datapath-windows/ovsext/User.h >> +++ b/datapath-windows/ovsext/User.h >> @@ -118,4 +118,11 @@ OvsAddPidInstance(POVS_SWITCH_CONTEXT >> switchContext, UINT32 pid, VOID >> OvsDelPidInstance(POVS_SWITCH_CONTEXT switchContext, UINT32 pid); >> >> +NTSTATUS OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen); NTSTATUS >> +OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen); NTSTATUS >> +OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT >> usrParamsCtx, >> + UINT32 *replyLen); >> + >> #endif /* __USER_H_ */ >> -- >> 1.8.5.6 >> >> _______________________________________________ >> dev mailing list >> dev@openvswitch.org >> https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailman_listinfo_dev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=pNHQcdr7B40b4h6Yb7FIedI1dnBsxdDuTLBYD3JqV80&m=-Y4hlW7yhN-E0_PMVwjFLop-42cI4ONzZjK1l0XaURs&s=O3P3RWIneV68cIa1tGn_X2GvhyrhX9ETt5dvuewMJrw&e= >> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev