[ovs-dev] [connmgr 14/15] ofproto: New function ofconn_pktbuf_retrieve().

Ethan Jackson ethan at nicira.com
Tue Mar 22 01:03:23 UTC 2011


Looks Good.

On Tue, Mar 15, 2011 at 11:36 AM, Ben Pfaff <blp at nicira.com> wrote:
> This helps to increase the level of abstraction of "struct ofconn",
> in preparation for moving it from ofproto.c into a new file.
> ---
>  ofproto/ofproto.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 1778d84..ae1d289 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -357,6 +357,10 @@ static enum ofconn_type ofconn_get_type(const struct ofconn *);
>  static enum nx_role ofconn_get_role(const struct ofconn *);
>  static void ofconn_set_role(struct ofconn *, enum nx_role);
>
> +static int ofconn_pktbuf_retrieve(struct ofconn *, uint32_t id,
> +                                  struct ofpbuf **bufferp, uint16_t *in_port);
> +
> +
>  static void queue_tx(struct ofpbuf *msg, const struct ofconn *ofconn,
>                      struct rconn_packet_counter *counter);
>
> @@ -1945,6 +1949,13 @@ ofconn_set_role(struct ofconn *ofconn, enum nx_role role)
>  {
>     ofconn->role = role;
>  }
> +
> +static int
> +ofconn_pktbuf_retrieve(struct ofconn *ofconn, uint32_t id,
> +                       struct ofpbuf **bufferp, uint16_t *in_port)
> +{
> +    return pktbuf_retrieve(ofconn->pktbuf, id, bufferp, in_port);
> +}
>
>  static void
>  ofservice_reconfigure(struct ofservice *ofservice,
> @@ -3223,8 +3234,8 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
>
>     /* Get payload. */
>     if (opo->buffer_id != htonl(UINT32_MAX)) {
> -        error = pktbuf_retrieve(ofconn->pktbuf, ntohl(opo->buffer_id),
> -                                &buffer, &in_port);
> +        error = ofconn_pktbuf_retrieve(ofconn, ntohl(opo->buffer_id),
> +                                       &buffer, &in_port);
>         if (error || !buffer) {
>             return error;
>         }
> @@ -3985,8 +3996,8 @@ add_flow(struct ofconn *ofconn, struct flow_mod *fm)
>
>     error = 0;
>     if (fm->buffer_id != UINT32_MAX) {
> -        error = pktbuf_retrieve(ofconn->pktbuf, fm->buffer_id,
> -                                &packet, &in_port);
> +        error = ofconn_pktbuf_retrieve(ofconn, fm->buffer_id,
> +                                       &packet, &in_port);
>     } else {
>         packet = NULL;
>         in_port = UINT16_MAX;
> @@ -4021,7 +4032,7 @@ send_buffered_packet(struct ofconn *ofconn,
>         return 0;
>     }
>
> -    error = pktbuf_retrieve(ofconn->pktbuf, buffer_id, &packet, &in_port);
> +    error = ofconn_pktbuf_retrieve(ofconn, buffer_id, &packet, &in_port);
>     if (error) {
>         return error;
>     }
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list