nicira-ext: Support matching ARP source and target hardware addresses.
[sliver-openvswitch.git] / include / openflow / nicira-ext.h
index 330ae97..c5b0a7c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
  *
  * This extension attempts to address the problem by adding a generic "error
  * vendor extension".  The extension works as follows: use NXET_VENDOR as type
- * and NXVC_VENDOR_CODE as code, followed by struct nx_vendor_error with
+ * and NXVC_VENDOR_ERROR as code, followed by struct nx_vendor_error with
  * vendor-specific details, followed by at least 64 bytes of the failed
  * request.
  *
@@ -76,7 +76,7 @@ struct nx_vendor_error {
  * that duplicate the current ones' meanings. */
 
 /* Additional "code" values for OFPET_BAD_REQUEST. */
-enum {
+enum nx_bad_request_code {
 /* Nicira Extended Match (NXM) errors. */
 
     /* Generic error code used when there is an error in an NXM sent to the
@@ -103,7 +103,7 @@ enum {
 };
 
 /* Additional "code" values for OFPET_FLOW_MOD_FAILED. */
-enum {
+enum nx_flow_mod_failed_code {
     /* Generic hardware error. */
     NXFMFC_HARDWARE = 0x100,
 
@@ -312,9 +312,9 @@ OFP_ASSERT(sizeof(struct nx_action_set_tunnel64) == 24);
  * Ethernet+IPv4 ARP packet for which the source Ethernet address inside the
  * ARP packet differs from the source Ethernet address in the Ethernet header.
  *
- * This is useful because OpenFlow does not provide a way to match on the
- * Ethernet addresses inside ARP packets, so there is no other way to drop
- * spoofed ARPs other than sending every ARP packet to a controller. */
+ * (This  action  is  deprecated in  favor of defining flows using the
+ * NXM_NX_ARP_SHA flow match and will likely be removed in a future version
+ * of Open vSwitch.) */
 struct nx_action_drop_spoofed_arp {
     ovs_be16 type;                  /* OFPAT_VENDOR. */
     ovs_be16 len;                   /* Length is 16. */
@@ -386,6 +386,8 @@ OFP_ASSERT(sizeof(struct nx_action_pop_queue) == 16);
  *   - NXM_OF_ARP_SPA
  *   - NXM_OF_ARP_TPA
  *   - NXM_NX_TUN_ID
+ *   - NXM_NX_ARP_SHA
+ *   - NXM_NX_ARP_THA
  *   - NXM_NX_REG(idx) for idx in the switch's accepted range.
  *
  * The following nxm_header values are potentially acceptable as 'dst':
@@ -430,9 +432,9 @@ OFP_ASSERT(sizeof(struct nx_action_reg_move) == 24);
  * starts at 0 for the least-significant bit, 1 for the next most significant
  * bit, and so on.
  *
- * 'dst' is an nxm_header with nxm_hasmask=0.  It must be one of the following:
- *
- *   - NXM_NX_REG(idx) for idx in the switch's accepted range.
+ * 'dst' is an nxm_header with nxm_hasmask=0.  See the documentation for
+ * NXAST_REG_MOVE, above, for the permitted fields and for the side effects of
+ * loading them.
  *
  * The 'ofs' and 'n_bits' fields are combined into a single 'ofs_nbits' field
  * to avoid enlarging the structure by another 8 bytes.  To allow 'n_bits' to
@@ -1038,6 +1040,17 @@ enum nx_mp_algorithm {
 #define NXM_NX_TUN_ID     NXM_HEADER  (0x0001, 16, 8)
 #define NXM_NX_TUN_ID_W   NXM_HEADER_W(0x0001, 16, 8)
 
+/* For an Ethernet+IP ARP packet, the source or target hardware address
+ * in the ARP header.  Always 0 otherwise.
+ *
+ * Prereqs: NXM_OF_ETH_TYPE must match 0x0806 exactly.
+ *
+ * Format: 48-bit Ethernet MAC address.
+ *
+ * Masking: Not maskable. */
+#define NXM_NX_ARP_SHA    NXM_HEADER  (0x0001, 17, 6)
+#define NXM_NX_ARP_THA    NXM_HEADER  (0x0001, 18, 6)
+
 /* ## --------------------- ## */
 /* ## Requests and replies. ## */
 /* ## --------------------- ## */