aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/.gitignore
AgeCommit message (Expand)AuthorFilesLines
2021-10-15fix(Terraform): Bug fixes and lint tweakspmikus1-0/+2
2021-09-07Terraform: Cleanuppmikus1-2/+2
2021-09-06Terraform: Cleanuppmikus1-0/+34
al.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #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 */ }
/*
 * Copyright (c) 2015 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.
 */
#ifndef __VIRTIO_STD_H__
#define __VIRTIO_STD_H__

#define foreach_virtio_net_features                                           \
  _ (VIRTIO_NET_F_CSUM, 0)	 /* Host handles pkts w/ partial csum */      \
  _ (VIRTIO_NET_F_GUEST_CSUM, 1) /* Guest handles pkts w/ partial csum */     \
  _ (VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,                                        \
     2)				     /* Dynamic offload configuration. */     \
  _ (VIRTIO_NET_F_MTU, 3)	     /* Initial MTU advice. */                \
  _ (VIRTIO_NET_F_MAC, 5)	     /* Host has given MAC address. */        \
  _ (VIRTIO_NET_F_GSO, 6)	     /* Host handles pkts w/ any GSO. */      \
  _ (VIRTIO_NET_F_GUEST_TSO4, 7)     /* Guest can handle TSOv4 in. */         \
  _ (VIRTIO_NET_F_GUEST_TSO6, 8)     /* Guest can handle TSOv6 in. */         \
  _ (VIRTIO_NET_F_GUEST_ECN, 9)	     /* Guest can handle TSO[6] w/ ECN in. */ \
  _ (VIRTIO_NET_F_GUEST_UFO, 10)     /* Guest can handle UFO in. */           \
  _ (VIRTIO_NET_F_HOST_TSO4, 11)     /* Host can handle TSOv4 in. */          \
  _ (VIRTIO_NET_F_HOST_TSO6, 12)     /* Host can handle TSOv6 in. */          \
  _ (VIRTIO_NET_F_HOST_ECN, 13)	     /* Host can handle TSO[6] w/ ECN in. */  \
  _ (VIRTIO_NET_F_HOST_UFO, 14)	     /* Host can handle UFO in. */            \
  _ (VIRTIO_NET_F_MRG_RXBUF, 15)     /* Host can merge receive buffers. */    \
  _ (VIRTIO_NET_F_STATUS, 16)	     /* virtio_net_config.status available */ \
  _ (VIRTIO_NET_F_CTRL_VQ, 17)	     /* Control channel available */          \
  _ (VIRTIO_NET_F_CTRL_RX, 18)	     /* Control channel RX mode support */    \
  _ (VIRTIO_NET_F_CTRL_VLAN, 19)     /* Control channel VLAN filtering */     \
  _ (VIRTIO_NET_F_CTRL_RX_EXTRA, 20) /* Extra RX mode control support */      \
  _ (VIRTIO_NET_F_GUEST_ANNOUNCE,                                             \
     21)		  /* Guest can announce device on the network */      \
  _ (VIRTIO_NET_F_MQ, 22) /* Device supports Receive Flow Steering */         \
  _ (VIRTIO_NET_F_CTRL_MAC_ADDR, 23) /* Set MAC address */                    \
  _ (VIRTIO_F_NOTIFY_ON_EMPTY, 24)                                            \
  _ (VHOST_F_LOG_ALL, 26) /* Log all write descriptors */                     \
  _ (VIRTIO_F_ANY_LAYOUT,                                                     \
     27) /* Can the device handle any descriptor layout */                    \
  _ (VIRTIO_RING_F_INDIRECT_DESC,                                             \
     28) /* Support indirect buffer descriptors */                            \
  _ (VIRTIO_RING_F_EVENT_IDX,                                                 \
     29) /* The Guest publishes the used index for which it expects an        \
	  * interrupt at the end of the avail ring. Host should ignore the    \
	  * avail->flags field. */                                            \
  /* The Host publishes the avail index for which it expects a kick           \
   * at the end of the used ring. Guest should ignore the used->flags field.  \
   */                                                                         \
  _ (VHOST_USER_F_PROTOCOL_FEATURES, 30)                                      \
  _ (VIRTIO_F_VERSION_1, 32) /* v1.0 compliant. */                            \
  _ (VIRTIO_F_IOMMU_PLATFORM, 33)                                             \
  _ (VIRTIO_F_RING_PACKED, 34)                                                \
  _ (VIRTIO_F_IN_ORDER, 35) /* all buffers are used by the device in the */   \
  /* same order in which they have been made available */                     \
  _ (VIRTIO_F_ORDER_PLATFORM, 36) /* memory accesses by the driver and the */ \
  /* device are ordered in a way described by the platfor */                  \
  _ (VIRTIO_F_NOTIFICATION_DATA,                                              \
     38) /* the driver passes extra data (besides */                          \
  /* identifying the virtqueue) in its device notifications. */               \
  _ (VIRTIO_NET_F_SPEED_DUPLEX, 63) /* Device set linkspeed and duplex */

typedef enum
{
#define _(f, n) f = n,
  foreach_virtio_net_features
#undef _
} vnet_virtio_net_feature_t;

#define VIRTIO_FEATURE(X) (1ULL << X)

#define VRING_MAX_SIZE 32768

#define VRING_DESC_F_NEXT     1
#define VRING_DESC_F_WRITE    2
#define VRING_DESC_F_INDIRECT 4

#define VRING_DESC_F_AVAIL (1 << 7)
#define VRING_DESC_F_USED  (1 << 15)

#define foreach_virtio_event_idx_flags                                        \
  _ (VRING_EVENT_F_ENABLE, 0)                                                 \
  _ (VRING_EVENT_F_DISABLE, 1)                                                \
  _ (VRING_EVENT_F_DESC, 2)

typedef enum
{
#define _(f, n) f = n,
  foreach_virtio_event_idx_flags
#undef _
} vnet_virtio_event_idx_flags_t;

#define VRING_USED_F_NO_NOTIFY	   1
#define VRING_AVAIL_F_NO_INTERRUPT 1

typedef struct
{
  u64 addr;
  u32 len;
  u16 flags;
  u16 next;
} vnet_virtio_vring_desc_t;

typedef struct
{
  u16 flags;
  u16 idx;
  u16 ring[0];
  /*  u16 used_event; */
} vnet_virtio_vring_avail_t;

typedef struct
{
  u32 id;
  u32 len;
} vnet_virtio_vring_used_elem_t;

typedef struct
{
  u16 flags;
  u16 idx;
  vnet_virtio_vring_used_elem_t ring[0];
  /* u16 avail_event; */
} vnet_virtio_vring_used_t;

typedef CLIB_PACKED (struct {
  u64 addr;  // packet data buffer address
  u32 len;   // packet data buffer size
  u16 id;    // buffer id
  u16 flags; // flags
}) vnet_virtio_vring_packed_desc_t;

STATIC_ASSERT_SIZEOF (vnet_virtio_vring_packed_desc_t, 16);

typedef CLIB_PACKED (struct {
  u16 off_wrap;
  u16 flags;
}) vnet_virtio_vring_desc_event_t;

#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
#define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */

#define VIRTIO_NET_HDR_GSO_NONE	 0    /* Not a GSO frame */
#define VIRTIO_NET_HDR_GSO_TCPV4 1    /* GSO frame, IPv4 TCP (TSO) */
#define VIRTIO_NET_HDR_GSO_UDP	 3    /* GSO frame, IPv4 UDP (UFO) */
#define VIRTIO_NET_HDR_GSO_TCPV6 4    /* GSO frame, IPv6 TCP */
#define VIRTIO_NET_HDR_GSO_ECN	 0x80 /* TCP has ECN set */

typedef CLIB_PACKED (struct {
  u8 flags;
  u8 gso_type;
  u16 hdr_len;	   /* Ethernet + IP + tcp/udp hdrs */
  u16 gso_size;	   /* Bytes to append to hdr_len per frame */
  u16 csum_start;  /* Position to start checksumming from */
  u16 csum_offset; /* Offset after that to place checksum */
  u16 num_buffers; /* Number of merged rx buffers */
}) vnet_virtio_net_hdr_v1_t;

typedef CLIB_PACKED (struct {
  u8 flags;
  u8 gso_type;
  u16 hdr_len;
  u16 gso_size;
  u16 csum_start;
  u16 csum_offset;
}) vnet_virtio_net_hdr_t;

typedef CLIB_PACKED (struct {
  vnet_virtio_net_hdr_t hdr;
  u16 num_buffers;
}) vnet_virtio_net_hdr_mrg_rxbuf_t;

#endif

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */