aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_output.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2019-05-06 08:51:56 -0700
committerDave Barach <openvpp@barachs.net>2019-07-31 16:33:15 +0000
commit4208a4ce8d72d3fb6428527cde1fba7b397bd6f7 (patch)
tree3a04e358925ab7215c7d358fbf62b6c1eb33b25f /src/vnet/interface_output.c
parent83832e7ced8be8b7de394415feaba70c32e3c38d (diff)
devices interface tests: vhosst GSO support
Add gso option in create vhost interface to support gso and checksum offload. Tested with the following startup options in qemu: csum=on,gso=on,guest_csum=on,guest_tso4=on,guest_tso6=on,guest_ufo=on, host_tso4=on,host_tso6=on,host_ufo=on Type: feature Change-Id: I9ba1ee33677a694c4a0dfe66e745b098995902b8 Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'src/vnet/interface_output.c')
-rw-r--r--src/vnet/interface_output.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 1a9f5dbab8f..884c00d93cf 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -224,10 +224,6 @@ calc_checksums (vlib_main_t * vm, vlib_buffer_t * b)
ip6_tcp_udp_icmp_compute_checksum (vm, b, ip6, &bogus);
}
}
-
- b->flags &= ~VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
- b->flags &= ~VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
- b->flags &= ~VNET_BUFFER_F_OFFLOAD_IP_CKSUM;
}
static_always_inline u16
: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#ifndef included_vnet_dhcp_packet_h
#define included_vnet_dhcp_packet_h

/*
 * DHCP packet format
 *
 * Copyright (c) 2013 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <vnet/ip/ip6_packet.h>

// #define DHCP_VRF_NAME_MAX_LEN L3VM_MAX_NAME_STR_LEN
// #define DHCPV6_MAX_VRF_NAME_LEN L3VM_MAX_NAME_STR_LEN
#define DHCP_MAX_RELAY_ADDR    16
#define PROTO_UDP 17
#define DHCPV6_CLIENT_PORT 546
#define DHCPV6_SERVER_PORT 547
#define HOP_COUNT_LIMIT  32
#define DHCPV6_CISCO_ENT_NUM 9

/*
 * DHCPv6 message types
 */
typedef enum dhcpv6_msg_type_{
    DHCPV6_MSG_SOLICIT              = 1,
    DHCPV6_MSG_ADVERTISE            = 2,
    DHCPV6_MSG_REQUEST              = 3,
    DHCPV6_MSG_CONFIRM              = 4,
    DHCPV6_MSG_RENEW                = 5,
    DHCPV6_MSG_REBIND               = 6,
    DHCPV6_MSG_REPLY                = 7,
    DHCPV6_MSG_RELEASE              = 8,
    DHCPV6_MSG_DECLINE              = 9,
    DHCPV6_MSG_RECONFIGURE          = 10,
    DHCPV6_MSG_INFORMATION_REQUEST  = 11,
    DHCPV6_MSG_RELAY_FORW           = 12,
    DHCPV6_MSG_RELAY_REPL           = 13,
} dhcpv6_msg_type_t;

/*
 * DHCPv6 options types
 */
enum {
    DHCPV6_OPTION_CLIENTID      = 1,
    DHCPV6_OPTION_SERVERID      = 2,
    DHCPV6_OPTION_IA_NA         = 3,
    DHCPV6_OPTION_IA_TA         = 4,
    DHCPV6_OPTION_IAADDR        = 5,
    DHCPV6_OPTION_ORO           = 6,
    DHCPV6_OPTION_PREFERENCE    = 7,
    DHCPV6_OPTION_ELAPSED_TIME  = 8,
    DHCPV6_OPTION_RELAY_MSG     = 9,
    DHCPV6_OPTION_AUTH          = 11,
    DHCPV6_OPTION_UNICAST       = 12,
    DHCPV6_OPTION_STATUS_CODE   = 13,
    DHCPV6_OPTION_RAPID_COMMIT  = 14,
    DHCPV6_OPTION_USER_CLASS    = 15,
    DHCPV6_OPTION_VENDOR_CLASS  = 16,
    DHCPV6_OPTION_VENDOR_OPTS   = 17,
    DHCPV6_OPTION_INTERFACE_ID  = 18, // relay agent fills this
    DHCPV6_OPTION_RECONF_MSG    = 19,
    DHCPV6_OPTION_RECONF_ACCEPT = 20,
    DHCPV6_OPTION_REMOTEID      = 37, // relay agent fills this
    DHCPV6_OPTION_VSS      = 68, // relay agent fills this
    DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS = 79, 
    DHCPV6_OPTION_MAX
};

/*
* DHCPv6 status codes
 */
enum {
    DHCPV6_STATUS_SUCCESS       = 0,
    DHCPV6_STATUS_UNSPEC_FAIL   = 1,
    DHCPV6_STATUS_NOADDRS_AVAIL = 2,
    DHCPV6_STATUS_NO_BINDING    = 3,
    DHCPV6_STATUS_NOT_ONLINK    = 4,
    DHCPV6_STATUS_USE_MULTICAST = 5,
};

/*
 * DHCPv6 DUID types
 */
enum {
    DHCPV6_DUID_LLT =   1,  /* DUID Based on Link-layer Address Plus Time */
    DHCPV6_DUID_EN =    2,  /* DUID Based on Enterprise Number */
    DHCPV6_DUID_LL =    3,  /* DUID Based on Link-layer Address */
};

//Structure for DHCPv6 payload from client
typedef struct dhcpv6_hdr_ {
    union {
        u8 msg_type; //DHCP msg type
        u32 xid;     // transaction id
    }u;
    u8  data[0];
} dhcpv6_header_t;



typedef CLIB_PACKED (struct dhcpv6_relay_ctx_ {
    dhcpv6_header_t *pkt;
    u32  pkt_len;
    u32  dhcpv6_len; //DHCPv6 payload load
//    if_ordinal iod;
    u32 if_index;
    u32 ctx_id;
    char ctx_name[32+1];
    u8 dhcp_msg_type;
}) dhcpv6_relay_ctx_t;

//Structure for DHCPv6 RELAY-FORWARD and DHCPv6 RELAY-REPLY pkts
typedef CLIB_PACKED (struct dhcpv6_relay_hdr_ {
    u8           msg_type;
    u8           hop_count;
    ip6_address_t    link_addr;
    ip6_address_t    peer_addr;
    u8           data[0];
}) dhcpv6_relay_hdr_t;

typedef enum dhcp_stats_action_type_ {
    DHCP_STATS_ACTION_FORWARDED=1,
    DHCP_STATS_ACTION_RECEIVED,
    DHCP_STATS_ACTION_DROPPED
} dhcp_stats_action_type_t;
//Generic counters for a packet
typedef  struct dhcp_stats_counters_ {
    u64  rx_pkts; //counter for received pkts
    u64  tx_pkts; //counter for forwarded pkts
    u64  drops;   //counter for dropped pkts
} dhcp_stats_counters_t;


typedef enum dhcpv6_stats_drop_reason_ {
    DHCPV6_RELAY_PKT_DROP_RELAYDISABLE = 1,
    DHCPV6_RELAY_PKT_DROP_MAX_HOPS,
    DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL,
    DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF,
    DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT,
    DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL,
    DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT,
} dhcpv6_stats_drop_reason_t;

typedef CLIB_PACKED (struct {
  u16 option;
  u16 length;
  u8 data[0];
}) dhcpv6_option_t;

typedef CLIB_PACKED (struct {
  dhcpv6_option_t opt;
  u32 int_idx;
}) dhcpv6_int_id_t;

typedef CLIB_PACKED (struct {
  dhcpv6_option_t opt;
  u8 data[8];  // data[0]:type, data[1..7]: VPN ID
}) dhcpv6_vss_t;

typedef CLIB_PACKED (struct {
  dhcpv6_option_t opt;
  u32 ent_num;
  u32 rmt_id;
}) dhcpv6_rmt_id_t;

typedef CLIB_PACKED (struct {
  dhcpv6_option_t opt;
  u16 link_type;
  u8 data[6];  // data[0]:data[5]: MAC address
}) dhcpv6_client_mac_t;


#endif /* included_vnet_dhcp_packet_h */