summaryrefslogtreecommitdiff
path: root/lib/netdev-windows.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Move lib/poll-loop.h to include/openvswitchXiao Liang2017-11-031-1/+1
| | | | | | | | Poll-loop is the core to implement main loop. It should be available in libopenvswitch. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Use xmalloc instead of malloc in some Windows code.Shashank Ram2017-05-191-12/+2
| | | | | | | | xmalloc checks if the size is valid before allocating memory, and also if the allocation was successful. Signed-off-by: Shashank Ram <rams@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windows: Broken internal netdevsAlin Serdean2017-02-221-1/+4
| | | | | | | | | | | | | Commit fa07525f9cf3fa698ebc23ea09da477d3d881a87 fixed error logging for for regular netdevs, however it overlooked "internal" netdevs. This patch allows "internal" netdev objects to be created and passed to dpif_port_add(). Reported-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <Nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windows: netdev report error if query failedAlin Serdean2017-02-081-1/+1
| | | | | | | | | | | | | | The netdev Windows construct uses query_netdev to see if a port exists in the datapath, in the case an error occurred in the reply message we returned 0, meaning netdev_open was successful. This patch fixes fixes that problem. Reported-at: https://github.com/openvswitch/ovs-issues/issues/125 Reported-by: Shashank Ram <rams@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-By: Shashank Ram <rams@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windows: Incorrect check while fetching adapter addressesAlin Serdean2016-12-201-3/+3
| | | | | | | | | | | | | | Checking for ERROR_INSUFFICIENT_BUFFER is incorrect per MSFT documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx Also, the initial call to GetAdaptersAddresses was wrong. In the case of a successful return 'all_addr' was not allocated leading to a crash. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-by: Lior Baram <lior.baram@hpe.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* netdev-windows: use bitwise comparison for flagsAlin Serdean2016-11-041-2/+2
| | | | | | | | | Use bitwise comparison when checking flags set by the kernel for the device. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* netdev-windows: fix ofpbuf initializationAlin Serdean2016-11-041-1/+1
| | | | | | | | | | | | | | | | | | | ofpbuf_const_initializer takes only two parameters see: https://github.com/openvswitch/ovs/blob/master/include/openvswitch/ofpbuf.h#L96 the compiler only gives the following warning: lib/netdev-windows.c(229) : warning C4020: 'ofpbuf_const_initializer' : too many actual parameters which in result will put junk data into "ofpbuf b". This patch fixes the initialization. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-221-1/+1
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* netdev: New field 'is_pmd' in netdev_class.Ilya Maximets2016-03-161-0/+1
| | | | | | | Made to simplify creation of derived classes. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* ofpbuf: New function ofpbuf_const_initializer().Ben Pfaff2016-02-191-11/+7
| | | | | | | | | | | | | | | A number of times I've looked at code and thought that it would be easier to understand if I could write an initializer instead of ofpbuf_use_const(). This commit adds a function for that purpose and adapts a lot of code to use it, in the places where I thought it made the code better. In theory this could improve code generation since the new function can be inlined whereas ofpbuf_use_const() isn't. But I guess that's probably insignificant; the intent of this change is code readability. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* netdev-windows: Fix typo in call to memcpy().Nithin Raju2015-08-311-1/+1
| | | | | | | | This fixes a build error introduced by commit 74ff3298c (userspace: Define and use struct eth_addr.) Signed-off-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* userspace: Define and use struct eth_addr.Jarno Rajahalme2015-08-281-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Define struct eth_addr and use it instead of a uint8_t array for all ethernet addresses in OVS userspace. The struct is always the right size, and it can be assigned without an explicit memcpy, which makes code more readable. "struct eth_addr" is a good type name for this as many utility functions are already named accordingly. struct eth_addr can be accessed as bytes as well as ovs_be16's, which makes the struct 16-bit aligned. All use seems to be 16-bit aligned, so some algorithms on the ethernet addresses can be made a bit more efficient making use of this fact. As the struct fits into a register (in 64-bit systems) we pass it by value when possible. This patch also changes the few uses of Linux specific ETH_ALEN to OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no longer needed. This work stemmed from a desire to make all struct flow members assignable for unrelated exploration purposes. However, I think this might be a nice code readability improvement by itself. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
* netdev-windows: Add ARP lookup and next hop functionality.Alin Serdean2015-05-261-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | This patch implements two functionalities needed for an active manager: 1. ARP lookup 2. Next hop The first uses the Windows GetIpNetTable() function: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365956%28v=vs.85%29.aspx The second one uses GetAdaptersAddresses() function: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915%28v=vs.85%29.aspx Both API's are found in the Iphlpapi library. We need to add this library when compiling. Documentation and appveyor config has been updated to match the use of the new library. Tested using opendaylight. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/63 Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-windows: Fix broken compilation.Gurucharan Shetty2015-03-051-1/+1
| | | | | | | | Commit 6fd6ed71cb9f(ofpbuf: Simplify ofpbuf API.) removed ofpbuf_size and ofpbuf_data. They still had reference from netdev-windows. Fix them. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* netdev-windows: Fix bugs in flag update and MAC address copy functions.Nithin Raju2014-10-281-17/+33
| | | | | | | | | | | | | | | | | The .update_flags function in netdev-windows was dummy. But we need to return the existing flags for link status to be shown as up in the confdb. There was a bug in copying the MAC address. We fix these two issues in this patch. Signed-off-by: Nithin Raju <nithin@vmware.com> Co-Authored-by: Ankur Sharma <ankursharma@vmware.com> Signed-off-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Use magic ETH_ADDR_LEN instead of 6 for Ethernet address length.Wang Sheng-Hui2014-10-221-2/+5
| | | | | | | | | ETH_ADDR_LEN is defined in lib/packets.h, valued 6. Use this macro instead of magic number 6 to represent the length of eth mac address. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: netdev-windows fixes for vswitchd bringup.Ankur Sharma2014-10-171-1/+29
| | | | | | | | | | Added the handlers for update_flags and set_etheraddr. These handlers were needed for vswitchd bringup on windows platform. Signed-off-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib/netdev-windows.c: nuke the init function.Nithin Raju2014-10-081-6/+6
| | | | | | | | | | | The init function is not allowed to call into the kernel datapath while running unit tests since the kernel datapath is not loaded. Instead of making the function dummy, it is better to not have it at all. Reported-by: Gurucharan Shetty <gshetty@nicira.com> Signed-off-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* netdev-windows: add code to query netdev informationNithin Raju2014-10-061-5/+224
| | | | | | | | | | | | | | | | | Primary goals of netdev-windows.c are: 1) To query the 'network device' information of a vport such as MTU, etc. 2) Monitor changes to the 'network device' information such as link status. In this change, we implement only #1. #2 can also be implemented, but it does not seem to be required for the purposes of implement 'ovs-dpctl.exe show'. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-windows: New module.Nithin Raju2014-10-061-0/+137
In this patch, we add a lib/netdev-windows.c which mostly contains stub code and in subsequent patches, would use the netlink interface to query netdev information for a vport. The code implements netdev functionality for "internal" and "system" types of vports. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>