Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Feb 2012 22:10:11 GMT
From:      dfilter@FreeBSD.ORG (dfilter service)
To:        freebsd-net@FreeBSD.org
Subject:   Re: kern/164901: commit references a PR
Message-ID:  <201202222210.q1MMABsY047493@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/164901; it has been noted by GNATS.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164901: commit references a PR
Date: Wed, 22 Feb 2012 22:01:45 +0000 (UTC)

 Author: thompsa
 Date: Wed Feb 22 22:01:30 2012
 New Revision: 232008
 URL: http://svn.freebsd.org/changeset/base/232008
 
 Log:
   Using the flowid in the mbuf assumes the network card is giving a good hash for
   the traffic flow, this may not be the case giving poor traffic distribution.
   Add a sysctl which allows us to fall back to our own flow hash code.
   
   PR:		kern/164901
   Submitted by:	Eugene Grosbein
   MFC after:	1 week
 
 Modified:
   head/sys/net/ieee8023ad_lacp.c
   head/sys/net/if_lagg.c
   head/sys/net/if_lagg.h
 
 Modified: head/sys/net/ieee8023ad_lacp.c
 ==============================================================================
 --- head/sys/net/ieee8023ad_lacp.c	Wed Feb 22 21:47:50 2012	(r232007)
 +++ head/sys/net/ieee8023ad_lacp.c	Wed Feb 22 22:01:30 2012	(r232008)
 @@ -812,7 +812,7 @@ lacp_select_tx_port(struct lagg_softc *s
  		return (NULL);
  	}
  
 -	if (m->m_flags & M_FLOWID)
 +	if (sc->use_flowid && (m->m_flags & M_FLOWID))
  		hash = m->m_pkthdr.flowid;
  	else
  		hash = lagg_hashmbuf(m, lsc->lsc_hashkey);
 
 Modified: head/sys/net/if_lagg.c
 ==============================================================================
 --- head/sys/net/if_lagg.c	Wed Feb 22 21:47:50 2012	(r232007)
 +++ head/sys/net/if_lagg.c	Wed Feb 22 22:01:30 2012	(r232008)
 @@ -262,6 +262,8 @@ lagg_clone_create(struct if_clone *ifc, 
  	struct ifnet *ifp;
  	int i, error = 0;
  	static const u_char eaddr[6];	/* 00:00:00:00:00:00 */
 +	struct sysctl_oid *oid;
 +	char num[14];			/* sufficient for 32 bits */
  
  	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
  	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
 @@ -270,6 +272,15 @@ lagg_clone_create(struct if_clone *ifc, 
  		return (ENOSPC);
  	}
  
 +	sysctl_ctx_init(&sc->ctx);
 +	snprintf(num, sizeof(num), "%u", unit);
 +	sc->use_flowid = 1;
 +	oid = SYSCTL_ADD_NODE(&sc->ctx, &SYSCTL_NODE_CHILDREN(_net_link, lagg),
 +		OID_AUTO, num, CTLFLAG_RD, NULL, "");
 +	SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
 +		"use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, sc->use_flowid,
 +		"Use flow id for load sharing");
 +
  	sc->sc_proto = LAGG_PROTO_NONE;
  	for (i = 0; lagg_protos[i].ti_proto != LAGG_PROTO_NONE; i++) {
  		if (lagg_protos[i].ti_proto == LAGG_PROTO_DEFAULT) {
 @@ -349,6 +360,7 @@ lagg_clone_destroy(struct ifnet *ifp)
  
  	LAGG_WUNLOCK(sc);
  
 +	sysctl_ctx_free(&sc->ctx);
  	ifmedia_removeall(&sc->sc_media);
  	ether_ifdetach(ifp);
  	if_free(ifp);
 @@ -1676,7 +1688,7 @@ lagg_lb_start(struct lagg_softc *sc, str
  	struct lagg_port *lp = NULL;
  	uint32_t p = 0;
  
 -	if (m->m_flags & M_FLOWID)
 +	if (sc->use_flowid && (m->m_flags & M_FLOWID))
  		p = m->m_pkthdr.flowid;
  	else
  		p = lagg_hashmbuf(m, lb->lb_key);
 
 Modified: head/sys/net/if_lagg.h
 ==============================================================================
 --- head/sys/net/if_lagg.h	Wed Feb 22 21:47:50 2012	(r232007)
 +++ head/sys/net/if_lagg.h	Wed Feb 22 22:01:30 2012	(r232008)
 @@ -21,6 +21,8 @@
  #ifndef _NET_LAGG_H
  #define _NET_LAGG_H
  
 +#include <sys/sysctl.h>
 +
  /*
   * Global definitions
   */
 @@ -202,6 +204,8 @@ struct lagg_softc {
  	eventhandler_tag vlan_attach;
  	eventhandler_tag vlan_detach;
  #endif
 +	struct sysctl_ctx_list		ctx;		/* sysctl variables */
 +	int				use_flowid;	/* use M_FLOWID */
  };
  
  struct lagg_port {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202222210.q1MMABsY047493>