aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMarvin Liu <yong.liu@intel.com>2022-08-17 09:38:40 +0800
committerDamjan Marion <dmarion@0xa5.net>2022-08-25 19:05:40 +0000
commitabd5669422c5805da5135496d5e5a394fa5aa602 (patch)
treea464eb14b5e04b19042e92bb83ca7b8567731f19 /build
parent9a6ad01c0d443f002eafa709813d021bf0c98eac (diff)
vlib: introduce DMA infrastructure
This patch introduces DMA infrastructure into vlib. This is well known that large amount of memory movements will drain core resource. Nowadays more and more hardware accelerators were designed out for freeing core from this burden. Meanwhile some restrictions still remained when utilizing hardware accelerators, e.g. cross numa throughput will have a significant drop compared to same node. Normally the number of hardware accelerator instances will less than cores number, not to mention that applications number will even beyond the number of cores. Some hardware may support share virtual address with cores, while others are not. Here we introduce new DMA infrastructure which can fulfill the requirements of vpp applications like session and memif and in the meantime dealing with hardware limitations. Here is some design backgrounds: Backend is the abstract of resource which allocated from DMA device and can do some basic operations like configuration, DMA copy and result query. Config is the abstract of application DMA requirement. Application need to request an unique config index from DMA infrastructure. This unique config index is associated with backend resource. Two options cpu fallback and barrier before last can be specified in config. DMA transfer will be performed by CPU when backend is busy if cpu fallback option is enabled. DMA transfer callback will be in order if barrier before last option is enabled. We constructs all the stuffs that DMA transfer request needed into DMA batch. It contains the pattern of DMA descriptors and function pointers for submission and callback. One DMA transfer request need multiple times batch update and one time batch submission. DMA backends will assigned to config's workers threads equally. Lock will be used for thread-safety if same backends assigned to multiple threads. Backend node will check all the pending requests in worker thread and do callback with the pointer of DMA batch if transfer completed. Application can utilize cookie in DMA batch for selves usage. DMA architecture: +----------+ +----------+ +----------+ +----------+ | Config1 | | Config2 | | Config1 | | Config2 | +----------+ +----------+ +----------+ +----------+ || || || || +-------------------------+ +-------------------------+ | DMA polling thread A | | DMA polling thread B | +-------------------------+ +-------------------------+ || || +----------+ +----------+ | Backend1 | | Backend2 | +----------+ +----------+ Type: feature Signed-off-by: Marvin Liu <yong.liu@intel.com> Change-Id: I1725e0c26687985aac29618c9abe4f5e0de08ebf
Diffstat (limited to 'build')
0 files changed, 0 insertions, 0 deletions
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) 2005-2016 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.
 */

/*
 * typedefs and so forth
 */
#include <sys/types.h>
#include <gtk-2.0/gtk/gtk.h>
#include <stdio.h>
#include "props.h"

typedef char boolean;
typedef unsigned long long ulonglong;

/*
 * main.c
 */

GtkWidget *g_mainwindow;
GtkWidget *g_mainvbox;
GtkWidget *g_mainhbox;

/*
 * pointsel.c
 */
void point_selector_init(void);
boolean read_event_definitions (char *filename);
char *sxerox(char *);
void pointsel_about(char *);
void pointsel_next_snapshot(void);
void initialize_events(void);
void finalize_events(void);

#define NEVENTS 100000

typedef struct event_def_ {
    ulong event;
    char *name;
    char *format;
    boolean selected;
    boolean is_clib;
    char pad[2];
} event_def_t;

event_def_t *find_event_definition (ulong code);

event_def_t g_eventdefs[NEVENTS];

/*
 * config params
 */
int c_maxpointsel;        /* max # points shown in selector dlg */
gint c_view1_draw_width;
gint c_view1_draw_height;

/*
 * menu1.c
 */

void menu1_init(void);
void modal_dialog (char *label_text, char *retry_text, char *default_value, 
                   boolean (*cb)(char *));
void infobox(char *label_text, char *text);
/*
 * view1.c
 */
GdkFont *g_font;
GdkColor fg_black, bg_white;
void view1_init(void);
void view1_display(void);
void view1_read_events_callback(void);
void view1_display_when_idle(void);
void view1_print_callback(GtkToggleButton *item, gpointer data);
void view1_about(char *);
void set_pid_ax_width(int width);
void set_window_title(const char *filename);

enum view1_tbox_fn {
    TBOX_DRAW_BOXED = 1,        /* note: order counts */
	TBOX_DRAW_EVENT,
    TBOX_DRAW_PLAIN,
    TBOX_PRINT_BOXED,
	TBOX_PRINT_EVENT,
    TBOX_PRINT_PLAIN,           /* end restriction */
    TBOX_GETRECT_BOXED,
	TBOX_GETRECT_EVENT,
    TBOX_GETRECT_PLAIN,
};

enum view1_line_fn {
    LINE_DRAW_BLACK = 1,
    LINE_DRAW_WHITE,
    LINE_PRINT,
};

GdkRectangle *tbox (char *s, int x, int y, enum view1_tbox_fn function);
void line (int x1, int y1, int x2, int y2, enum view1_line_fn function);
gint view1_handle_key_press_event (GtkWidget *widget, GdkEventKey *event);

/*
 * events.c
 */

void events_about (char *);

typedef struct raw_event {
    unsigned long time[2];
    unsigned long pid;
    unsigned long code;
    unsigned long datum;
} raw_event_t;

void event_init(void);
char *mapfile (char *file, ulong *sizep);
boolean unmapfile (char *addr, ulong size);
void read_events (char *);
int find_event_index (ulonglong t);
int read_cpel_file(char *file);
int read_clib_file(char *file);
void cpel_event_init(ulong);
void add_event_from_cpel_file(ulong, char * , char *);
void add_event_from_clib_file(unsigned int event, char *name, 
                              unsigned int vec_index);
void add_cpel_event(ulonglong delta, ulong, ulong, ulong);
void add_clib_event(double delta, unsigned short track, 
                    unsigned short event, unsigned int index);
void cpel_event_finalize(void);
void *get_clib_event (unsigned int datum);

typedef struct pid_data {
    struct pid_data *next;
    ulong pid_value;            /* The actual pid value */
    ulong pid_index;            /* Index in pid sort order */
} pid_data_t;
    
#define EVENT_FLAG_SELECT 	0x00000001 /* This event is selected */
#define EVENT_FLAG_SEARCHRSLT   0x00000002 /* This event is the search rslt */
#define EVENT_FLAG_CLIB         0x00000004 /* clib event */

typedef struct pid_sort {
    struct pid_data *pid;
    ulong pid_value;
    /*
     * This is a bit of a hack, since this is used only by the view:
     */
    unsigned color_index;
} pid_sort_t;

typedef struct event {
    ulonglong time;
    ulong code;
    pid_data_t *pid;
    ulong datum;
    ulong flags;
} event_t;


boolean g_little_endian;
event_t *g_events;
ulong g_nevents;
pid_sort_t *g_pids;
pid_sort_t *g_original_pids;
int g_npids;
pid_data_t *g_pid_data_list;

#define PIDHASH_NBUCKETS	20021 /* Should be prime */

boolean ticks_per_ns_set;
double ticks_per_ns;

/*
 * version.c
 */
const char *version_string;
const char *minor_v_string;

/*
 * cpel.c
 */
char *get_track_label(unsigned long);
int widest_track_format;
char *strtab_ref(unsigned long);