summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_read.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/handle_read.c')
-rw-r--r--VNFs/DPPD-PROX/handle_read.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/handle_read.c b/VNFs/DPPD-PROX/handle_read.c
new file mode 100644
index 00000000..9a06a2b1
--- /dev/null
+++ b/VNFs/DPPD-PROX/handle_read.c
@@ -0,0 +1,78 @@
+/*
+// Copyright (c) 2010-2017 Intel Corporation
+//
+// 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 <rte_ip.h>
+
+#include "task_base.h"
+#include "task_init.h"
+#include "defines.h"
+#include "prefetch.h"
+#include "log.h"
+
+struct task_read {
+ struct task_base base;
+};
+
+static int handle_read_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts)
+{
+ struct task_read *task = (struct task_read *)tbase;
+ uint8_t out[MAX_PKT_BURST];
+ uint16_t j;
+ uint64_t *first;
+
+#ifdef PROX_PREFETCH_OFFSET
+ for (j = 0; j < PROX_PREFETCH_OFFSET && j < n_pkts; ++j) {
+ PREFETCH0(mbufs[j]);
+ }
+ for (j = 1; j < PROX_PREFETCH_OFFSET && j < n_pkts; ++j) {
+ PREFETCH0(rte_pktmbuf_mtod(mbufs[j - 1], void *));
+ }
+#endif
+ for (j = 0; j + PREFETCH_OFFSET < n_pkts; ++j) {
+#ifdef PROX_PREFETCH_OFFSET
+ PREFETCH0(mbufs[j + PREFETCH_OFFSET]);
+ PREFETCH0(rte_pktmbuf_mtod(mbufs[j + PREFETCH_OFFSET - 1], void *));
+#endif
+ first = rte_pktmbuf_mtod(mbufs[j], uint64_t *);
+ out[j] = *first != 0? 0: OUT_DISCARD;
+ }
+#ifdef PROX_PREFETCH_OFFSET
+ prefetch_nta(rte_pktmbuf_mtod(mbufs[n_pkts - 1], void *));
+ for (; j < n_pkts; ++j) {
+ first = rte_pktmbuf_mtod(mbufs[j], uint64_t *);
+ out[j] = *first != 0? 0: OUT_DISCARD;
+ }
+#endif
+
+ return task->base.tx_pkt(&task->base, mbufs, n_pkts, out);
+}
+
+static void init_task_read(__attribute__((unused)) struct task_base *tbase,
+ __attribute__((unused)) struct task_args *targ)
+{
+}
+
+static struct task_init task_init_read = {
+ .mode_str = "read",
+ .init = init_task_read,
+ .handle = handle_read_bulk,
+ .size = sizeof(struct task_read)
+};
+
+__attribute__((constructor)) static void reg_task_read(void)
+{
+ reg_task(&task_init_read);
+}
{ 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 */ }
heat_template_version: pike

description: >
  MongoDb service deployment using puppet

parameters:
  #Parameters not used EndpointMap
  ServiceNetMap:
    default: {}
    description: Mapping of service_name -> network name. Typically set
                 via parameter_defaults in the resource registry.  This
                 mapping overrides those in ServiceNetMapDefaults.
    type: json
  DefaultPasswords:
    default: {}
    type: json
  RoleName:
    default: ''
    description: Role name on which the service is applied
    type: string
  RoleParameters:
    default: {}
    description: Parameters specific to the role
    type: json
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  MongodbMemoryLimit:
    default: '20G'
    description: Limit the amount of memory mongodb uses with systemd.
    type: string
  MongoDbLoggingSource:
    type: json
    description: Fluentd logging configuration for mongodb.
    default:
      tag: database.mongodb
      path: /var/log/mongodb/mongodb.log
      format: >-
        /(?<time>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d+\+\d{4})
        (?<message>.*)$/

resources:
  MongoDbBase:
    type: ./mongodb-base.yaml
    properties:
      ServiceNetMap: {get_param: ServiceNetMap}
      DefaultPasswords: {get_param: DefaultPasswords}
      EndpointMap: {get_param: EndpointMap}
      RoleName: {get_param: RoleName}
      RoleParameters: {get_param: RoleParameters}

outputs:
  role_data:
    description: Service mongodb using composable services.
    value:
      service_name: mongodb
      logging_groups:
        - mongodb
      logging_source: {get_param: MongoDbLoggingSource}
      config_settings:
        map_merge:
          - get_attr: [MongoDbBase, role_data, config_settings]
          - tripleo::profile::base::database::mongodb::mongodb_replset: {get_attr: [MongoDbBase, aux_parameters, rplset_name]}
            tripleo::profile::base::database::mongodb::memory_limit: {get_param: MongodbMemoryLimit}
            mongodb::server::service_manage: True
            tripleo.mongodb.firewall_rules:
              '101 mongodb_config':
                dport: 27019
              '102 mongodb_sharding':
                dport: 27018
              '103 mongod':
                dport: 27017
            # NOTE: bind IP is found in Heat replacing the network name with the
            # local node IP for the given network; replacement examples
            # (eg. for internal_api):
            # internal_api -> IP
            # internal_api_uri -> [IP]
            # internal_api_subnet - > IP/CIDR
            mongodb::server::bind_ip: {get_param: [ServiceNetMap, MongodbNetwork]}
      step_config: |
        include ::tripleo::profile::base::database::mongodb
      upgrade_tasks:
        - name: Stop mongodb service
          tags: step2
          service: name=mongod state=stopped
        - name: Start mongodb service
          tags: step4
          service: name=mongod state=started