virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.r.fastabend@intel.com>
To: Jens Osterkamp <jens@linux.vnet.ibm.com>
Cc: "chrisw@redhat.com" <chrisw@redhat.com>,
	"evb@yahoogroups.com" <evb@yahoogroups.com>,
	"e1000-eedc@lists.sourceforge.net"
	<e1000-eedc@lists.sourceforge.net>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [E1000-eedc] [PATCH 11/17] ECP implementation
Date: Mon, 02 Aug 2010 23:36:28 -0700	[thread overview]
Message-ID: <4C57B8EC.4000604@intel.com> (raw)
In-Reply-To: <1279881273-10261-12-git-send-email-jens@linux.vnet.ibm.com>

Jens Osterkamp wrote:
> This is the implementation of the edge control protocol (ECP) as specified
> in IEEE 802.1Qbg.
> 
> For this it extends the infrastructure defined lldpad to send and receive
> ECP frames with a new (yet to be defined) ethertype.
> Received frames are validated and analyzed before the content is handed to the
> upper layer protocol (ULP, VDP in this case) for further processing. Frames
> to be transmitted are compiled from VSI (guest interface) profiles registered
> on a interface.
> Reception and transmission of ECP frames is controlled by RX and TX state
> machines, timeouts are handled timeout functions.
> The patch still contains a lot of debug code to allow low-level protocol
> analysis.
> 
> Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
> ---
>  Makefile.am        |    2 +
>  ecp/ecp.c          |   77 +++++++
>  ecp/ecp.h          |   92 ++++++++
>  ecp/ecp_rx.c       |  597 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  ecp/ecp_tx.c       |  467 ++++++++++++++++++++++++++++++++++++++++
>  include/lldp_evb.h |    6 +
>  include/lldp_vdp.h |  157 ++++++++++++++
>  lldp/l2_packet.h   |    2 +
>  lldp/ports.h       |   25 ++-
>  lldp_evb.c         |    2 +
>  10 files changed, 1424 insertions(+), 3 deletions(-)
>  create mode 100644 ecp/ecp.c
>  create mode 100644 ecp/ecp.h
>  create mode 100644 ecp/ecp_rx.c
>  create mode 100644 ecp/ecp_tx.c
>  create mode 100644 include/lldp_vdp.h
> 

snip

> +
> +struct vdp_user_data {
> +       LIST_HEAD(vdp_head, vdp_data) head;
> +};
> +
> +struct lldp_module *vdp_register(void);
> +void vdp_unregister(struct lldp_module *mod);
> +struct vdp_data *vdp_data(char *ifname);
> +struct packed_tlv *vdp_gettlv(struct port *port, struct vsi_profile *profile);
> +void vdp_vsi_sm_station(struct vsi_profile *profile);
> +struct vsi_profile *vdp_add_profile(struct vsi_profile *profile);
> +
> +#define MAC_ADDR_STRLEN                18
> +#define INSTANCE_STRLEN                32
> +
> +#define PRINT_PROFILE(s, p)    \
> +{ int c; \
> +  c = sprintf(s, "\nmode: %i\n", p->mode); s += c; \
> +  c = sprintf(s, "response: %i\n", p->response); s += c; \
> +  c = sprintf(s, "state: %i\n", p->state); s += c; \
> +  c = sprintf(s, "mgrid: %i\n", p->mgrid); s += c; \
> +  c = sprintf(s, "id: %x%x%x\n", p->id[2], p->id[1], p->id[0]); \
> +  s += c; \
> +  c = sprintf(s, "version: %i\n", p->version); s += c; \
> +  char instance[INSTANCE_STRLEN+2]; \
> +  instance2str(p->instance, instance, sizeof(instance)); \
> +  c = sprintf(s, "instance: %s\n", &instance); s += c; \
> +  char macbuf[MAC_ADDR_STRLEN+1]; \
> +  mac2str(p->mac, macbuf, MAC_ADDR_STRLEN); \
> +  c = sprintf(s, "mac: %s\n", macbuf); s += c; \
> +  c = sprintf(s, "vlan: %i\n\n", p->vlan); s += c; \
> +}
> +
> +#endif /* _LLDP_VDP_H */
> diff --git a/lldp/l2_packet.h b/lldp/l2_packet.h
> index 16f3683..0962429 100644
> --- a/lldp/l2_packet.h
> +++ b/lldp/l2_packet.h
> @@ -36,6 +36,8 @@
> 
>  #define ETH_P_LLDP 0x88cc
> 
> +/* TODO: use extended ethertype until final ethertype is available */
> +#define ETH_P_ECP 0x88b7
> 
>  #define ETH_FRAME_LEN   1514
> 
> diff --git a/lldp/ports.h b/lldp/ports.h
> index 0138efe..c2e18ec 100644
> --- a/lldp/ports.h
> +++ b/lldp/ports.h
> @@ -136,21 +136,40 @@ struct porttlvs{
>         struct unpacked_tlv *last_peer;
>  };
> 
> +struct ecp {
> +       struct l2_packet_data *l2;
> +       int sequence;
> +       int retries;
> +       int ackReceived;
> +       int ackTimerExpired;
> +       u16 lastSequence;
> +       u16 seqECPDU;
> +       struct portrx rx;
> +       struct porttx tx;
> +       struct portstats stats;
> +};
> +


This structure is ecp specific and should be part of the ecp module.  Not in 
ports.h.

>  struct port {
>         char *ifname;
>         u8 hw_resetting;
>         u8 portEnabled;
>         u8 prevPortEnabled;
>         u8 adminStatus;
> -       u8 rxChanges;
> -       u16   lldpdu;
> +
> +       /* protocol specific */
>         struct l2_packet_data *l2;
>         struct portrx rx;
>         struct porttx tx;
> -       struct porttlvs tlvs;
>         struct portstats stats;
>         struct porttimers timers;
> +       u8 rxChanges;
> +       u16   lldpdu;
>         struct msap msap;
> +
> +       /* not sure */
> +       struct porttlvs tlvs;
> +
> +       struct ecp ecp;
>         struct port *next;
>  };
> 

This adds ecp knowledge into the generic port structure I want to keep the port 
structure module agnostic.  dcbx addresses the same issue by using the module 
data space.  evb should use a similar scheme and create this structure at 
ifup(). Any reason why this can't work?

> diff --git a/lldp_evb.c b/lldp_evb.c
> index bce01b6..b1b7edc 100644
> --- a/lldp_evb.c
> +++ b/lldp_evb.c
> @@ -354,6 +354,8 @@ static void evb_statemachine(struct evb_data *ed, struct tlv_info_evb *tie)
>                  * different parameters ? Check parameters. switch state back to
>                  * EVB_CONFIGURE ? */
>                 printf("%s: state -> EVB_CONFIRMATION\n", __func__);
> +               if (ed->tie->scap & LLDP_EVB_CAPABILITY_PROTOCOL_ECP)
> +                       ecp_init(ed->ifname);
>                 break;
>         default:
>                 fprintf(stderr, "EVB statemachine reached invalid state !\n");
> --
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> E1000-eedc mailing list
> E1000-eedc@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/e1000-eedc

  reply	other threads:[~2010-08-03  6:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 10:34 implementation of IEEE 802.1Qbg in lldpad Jens Osterkamp
2010-07-23 10:34 ` [PATCH 01/17] consolidation of MIN and MAX macros in common.h Jens Osterkamp
2010-07-23 10:34 ` [PATCH 02/17] implementation of IEEE 802.1Qbg in lldpad, part 1 Jens Osterkamp
2010-07-23 10:34 ` [PATCH 03/17] support for getting and setting EVB TLV parameters Jens Osterkamp
2010-07-23 10:34 ` [PATCH 04/17] BUGFIX: check in correct positions Jens Osterkamp
2010-07-23 10:34 ` [PATCH 05/17] remove VDPL and proper config save and restore Jens Osterkamp
2010-07-23 10:34 ` [PATCH 06/17] BUGFIX: agree to max of rte Jens Osterkamp
2010-07-23 10:34 ` [PATCH 07/17] BUGFIX: avoid compile warnings Jens Osterkamp
2010-07-23 10:34 ` [PATCH 08/17] BUGFIX: fix formatting in include/lldp_evb_clif.h Jens Osterkamp
2010-07-23 10:34 ` [PATCH 09/17] BUGFIX: check for existence of ifup Jens Osterkamp
2010-07-23 10:34 ` [PATCH 10/17] allow to set both supported forwarding modes Jens Osterkamp
2010-07-23 10:34 ` [PATCH 11/17] ECP implementation Jens Osterkamp
2010-08-03  6:36   ` John Fastabend [this message]
2010-08-03 12:02     ` [E1000-eedc] " Jens Osterkamp
2010-07-23 10:34 ` [PATCH 12/17] implementation of vdp Jens Osterkamp
2010-07-23 10:34 ` [PATCH 13/17] VDP commandline interface Jens Osterkamp
2010-07-23 10:34 ` [PATCH 14/17] add libnl dependency to configure.ac Jens Osterkamp
2010-07-23 10:34 ` [PATCH 15/17] use connect instead of bind Jens Osterkamp
2010-07-23 10:34 ` [PATCH 16/17] lldpad support for libvirt netlink message Jens Osterkamp
2010-08-03  7:52   ` [E1000-eedc] " John Fastabend
2010-08-03 11:59     ` Jens Osterkamp
2010-07-23 10:34 ` [PATCH 17/17] do not use macv[tap/lan] interfaces as ports Jens Osterkamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C57B8EC.4000604@intel.com \
    --to=john.r.fastabend@intel.com \
    --cc=chrisw@redhat.com \
    --cc=e1000-eedc@lists.sourceforge.net \
    --cc=evb@yahoogroups.com \
    --cc=jens@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).