Skip to content

Commit

Permalink
Initial structure for "bridge" and "802.1q" implementation
Browse files Browse the repository at this point in the history
* the naming is quite poor: I chose "linux" to indicate that we are
using the modules that are already in linux;

Signed-off-by: Claudiu Ghioc <claudiu.ghioc@gmail.com>
  • Loading branch information
claudiughioc committed May 1, 2013
1 parent 011b28e commit 48f072e
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 1 deletion.
9 changes: 9 additions & 0 deletions userspace/switch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ CFLAGS = -fPIC -g

ifndef IMPL
IMPL = lisa
#IMPL = linux
endif

ifneq ($(MAKECMDGOALS), clean)
$(info ********* Building $(IMPL) switch middleware *********)
endif

ifeq ($(IMPL), lisa)
SW_API_IMPL_DIR = lisa
CFLAGS += -DLiSA
LIB_OBJS = $(SW_API_IMPL_DIR)/util_lisa.o $(SW_API_IMPL_DIR)/lisa.o
endif

ifeq ($(IMPL), linux)
SW_API_IMPL_DIR = linux
CFLAGS += -DLinux
LIB_OBJS = $(SW_API_IMPL_DIR)/util_linux.o $(SW_API_IMPL_DIR)/linux.o
endif

include $(TOP_DIR)/scripts/Makefile.includes
INC = $(LINUX_INC) \
$(TOP_DIR)/include \
Expand Down
21 changes: 21 additions & 0 deletions userspace/switch/linux/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TOP_DIR := $(shell pwd)/../../
CFLAGS = -fPIC -g



include $(TOP_DIR)/scripts/Makefile.includes
INC = $(LINUX_INC) \
$(TOP_DIR)/switch \
$(TOP_DIR)/include

# LiSA Middleware
SRCS = util_linux.c linux.c

include $(TOP_DIR)/scripts/Makefile.variables
include $(TOP_DIR)/scripts/Makefile.rules

.DEFAULT_GOAL = all

all: $(OBJS)

dep: $(DEPS)
20 changes: 20 additions & 0 deletions userspace/switch/linux/linux.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <linux/net_switch.h>
#include <errno.h>

#include "switch.h"
#include "util_linux.h"
#include "linux.h"

/**
* TODO Create a bridge
*/
static int linux_init(struct switch_operations *sw_ops)
{
return 0;
}

struct linux_context lnx_ctx = {
.sw_ops = (struct switch_operations) {
.backend_init = linux_init
}
};
15 changes: 15 additions & 0 deletions userspace/switch/linux/linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef _LINUX_H
#define _LINUX_H

#include <unistd.h>
#include <linux/sockios.h>

#include "sw_api.h"

struct linux_context {
struct switch_operations sw_ops;
};

extern struct linux_context lnx_ctx;

#endif
Empty file.
Empty file.
1 change: 0 additions & 1 deletion userspace/switch/lisa/lisa.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define _LISA_H

#include <unistd.h>

#include <linux/sockios.h>

#include "sw_api.h"
Expand Down
7 changes: 7 additions & 0 deletions userspace/switch/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
#include "mm.h"
#include "switch.h"
#include "sw_api.h"

#ifdef LiSA
#include "lisa.h"
#endif

#ifdef Linux
#include "linux.h"
#endif

/*
* Switch shared memory structure
Expand Down

0 comments on commit 48f072e

Please sign in to comment.