Netdev List
 help / color / mirror / Atom feed
* [PATCH] brcmsmac: Use current logging styles
From: Joe Perches @ 2011-11-13 19:41 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: John W. Linville, linux-wireless, netdev, LKML

Add and use pr_fmt and pr_<level>
Remove useless double parentheses from macros.
Remove function names from format strings, add to pr_debug use.
Coalesce formats.
Remove uncompileable undeclared variable in a DMA_NONE use.

Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   14 +-
 drivers/net/wireless/brcm80211/brcmsmac/dma.c     |  145 ++++++++++-----------
 2 files changed, 80 insertions(+), 79 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 025fa0e..39e3054 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -16,6 +16,8 @@
  * File contents: support functions for PCI/PCIe
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/delay.h>
 #include <linux/pci.h>
 
@@ -349,9 +351,9 @@
 #define PCI_FORCEHT(si)	(PCIE(si) && (si->pub.chip == BCM4716_CHIP_ID))
 
 #ifdef BCMDBG
-#define	SI_MSG(args)	printk args
+#define	SI_MSG(fmt, ...)	pr_debug(fmt, ##__VA_ARGS__)
 #else
-#define	SI_MSG(args)
+#define	SI_MSG(fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
 #endif				/* BCMDBG */
 
 #define	GOODCOREADDR(x, b) \
@@ -1073,7 +1075,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 
 	/* scan for cores */
 	if (socitype == SOCI_AI) {
-		SI_MSG(("Found chip type AI (0x%08x)\n", w));
+		SI_MSG("Found chip type AI (0x%08x)\n", w);
 		/* pass chipc address instead of original core base */
 		ai_scan(&sii->pub, cc);
 	} else {
@@ -1129,7 +1131,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		 * set chipControl register bit 15
 		 */
 		if (sih->chiprev == 0) {
-			SI_MSG(("Applying 43224A0 WARs\n"));
+			SI_MSG("Applying 43224A0 WARs\n");
 			ai_corereg(sih, SI_CC_IDX,
 				   offsetof(struct chipcregs, chipcontrol),
 				   CCTRL43224_GPIO_TOGGLE,
@@ -1138,7 +1140,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 					   CCTRL_43224A0_12MA_LED_DRIVE);
 		}
 		if (sih->chiprev >= 1) {
-			SI_MSG(("Applying 43224B0+ WARs\n"));
+			SI_MSG("Applying 43224B0+ WARs\n");
 			si_pmu_chipcontrol(sih, 0, CCTRL_43224B0_12MA_LED_DRIVE,
 					   CCTRL_43224B0_12MA_LED_DRIVE);
 		}
@@ -1149,7 +1151,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		 * enable 12 mA drive strenth for 4313 and
 		 * set chipControl register bit 1
 		 */
-		SI_MSG(("Applying 4313 WARs\n"));
+		SI_MSG("Applying 4313 WARs\n");
 		si_pmu_chipcontrol(sih, 0, CCTRL_4313_12MA_LED_DRIVE,
 				   CCTRL_4313_12MA_LED_DRIVE);
 	}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index e286fb4..0bb8c37 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -13,6 +13,9 @@
  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -168,26 +171,25 @@
 
 /* debug/trace */
 #ifdef BCMDBG
-#define	DMA_ERROR(args) \
-	do { \
-		if (!(*di->msg_level & 1)) \
-			; \
-		else \
-			printk args; \
-	} while (0)
-#define	DMA_TRACE(args) \
-	do { \
-		if (!(*di->msg_level & 2)) \
-			; \
-		else \
-			printk args; \
-	} while (0)
+#define	DMA_ERROR(fmt, ...)					\
+do {								\
+	if (*di->msg_level & 1)					\
+		pr_debug("%s: " fmt, __func__, ##__VA_ARGS__);	\
+} while (0)
+#define	DMA_TRACE(fmt, ...)					\
+do {								\
+	if (*di->msg_level & 2)					\
+		pr_debug("%s: " fmt, __func__, ##__VA_ARGS__);	\
+} while (0)
 #else
-#define	DMA_ERROR(args)
-#define	DMA_TRACE(args)
+#define	DMA_ERROR(fmt, ...)			\
+	no_printk(fmt, ##__VA_ARGS__)
+#define	DMA_TRACE(fmt, ...)			\
+	no_printk(fmt, ##__VA_ARGS__)
 #endif				/* BCMDBG */
 
-#define	DMA_NONE(args)
+#define	DMA_NONE(fmt, ...)			\
+	no_printk(fmt, ##__VA_ARGS__)
 
 #define	MAXNAMEL	8	/* 8 char names */
 
@@ -361,7 +363,7 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
 	uint dmactrlflags;
 
 	if (di == NULL) {
-		DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n"));
+		DMA_ERROR("NULL dma handle\n");
 		return 0;
 	}
 
@@ -412,13 +414,13 @@ static bool _dma_isaddrext(struct dma_info *di)
 	/* not all tx or rx channel are available */
 	if (di->d64txregs != NULL) {
 		if (!_dma64_addrext(di->d64txregs))
-			DMA_ERROR(("%s: _dma_isaddrext: DMA64 tx doesn't have "
-				   "AE set\n", di->name));
+			DMA_ERROR("%s: DMA64 tx doesn't have AE set\n",
+				  di->name);
 		return true;
 	} else if (di->d64rxregs != NULL) {
 		if (!_dma64_addrext(di->d64rxregs))
-			DMA_ERROR(("%s: _dma_isaddrext: DMA64 rx doesn't have "
-				   "AE set\n", di->name));
+			DMA_ERROR("%s: DMA64 rx doesn't have AE set\n",
+				  di->name);
 		return true;
 	}
 
@@ -519,8 +521,8 @@ static bool dma64_alloc(struct dma_info *di, uint direction)
 		va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
 			&alloced, &di->txdpaorig);
 		if (va == NULL) {
-			DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(ntxd)"
-				   " failed\n", di->name));
+			DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(ntxd) failed\n",
+				  di->name);
 			return false;
 		}
 		align = (1 << align_bits);
@@ -533,8 +535,8 @@ static bool dma64_alloc(struct dma_info *di, uint direction)
 		va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
 			&alloced, &di->rxdpaorig);
 		if (va == NULL) {
-			DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(nrxd)"
-				   " failed\n", di->name));
+			DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(nrxd) failed\n",
+				  di->name);
 			return false;
 		}
 		align = (1 << align_bits);
@@ -583,11 +585,10 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	 */
 	_dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0);
 
-	DMA_TRACE(("%s: dma_attach: %s flags 0x%x ntxd %d nrxd %d "
-		   "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d "
-		   "dmaregstx %p dmaregsrx %p\n", name, "DMA64",
-		   di->dma.dmactrlflags, ntxd, nrxd, rxbufsize,
-		   rxextheadroom, nrxpost, rxoffset, dmaregstx, dmaregsrx));
+	DMA_TRACE("%s: %s flags 0x%x ntxd %d nrxd %d rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d dmaregstx %p dmaregsrx %p\n",
+		  name, "DMA64",
+		  di->dma.dmactrlflags, ntxd, nrxd, rxbufsize,
+		  rxextheadroom, nrxpost, rxoffset, dmaregstx, dmaregsrx);
 
 	/* make a private copy of our callers name */
 	strncpy(di->name, name, MAXNAMEL);
@@ -645,8 +646,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 		di->dmadesc_align = 4;	/* 16 byte alignment */
 	}
 
-	DMA_NONE(("DMA descriptor align_needed %d, align %d\n",
-		  di->aligndesc_4k, di->dmadesc_align));
+	DMA_NONE("DMA descriptor align_needed %d, align %d\n",
+		 di->aligndesc_4k, di->dmadesc_align);
 
 	/* allocate tx packet pointer vector */
 	if (ntxd) {
@@ -684,21 +685,21 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 
 	if ((di->ddoffsetlow != 0) && !di->addrext) {
 		if (di->txdpa > SI_PCI_DMA_SZ) {
-			DMA_ERROR(("%s: dma_attach: txdpa 0x%x: addrext not "
-				   "supported\n", di->name, (u32)di->txdpa));
+			DMA_ERROR("%s: txdpa 0x%x: addrext not supported\n",
+				  di->name, (u32)di->txdpa);
 			goto fail;
 		}
 		if (di->rxdpa > SI_PCI_DMA_SZ) {
-			DMA_ERROR(("%s: dma_attach: rxdpa 0x%x: addrext not "
-				   "supported\n", di->name, (u32)di->rxdpa));
+			DMA_ERROR("%s: rxdpa 0x%x: addrext not supported\n",
+				  di->name, (u32)di->rxdpa);
 			goto fail;
 		}
 	}
 
-	DMA_TRACE(("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x "
-		   "dataoffsethigh " "0x%x addrext %d\n", di->ddoffsetlow,
-		   di->ddoffsethigh, di->dataoffsetlow, di->dataoffsethigh,
-		   di->addrext));
+	DMA_TRACE("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n",
+		  di->ddoffsetlow, di->ddoffsethigh,
+		  di->dataoffsetlow, di->dataoffsethigh,
+		  di->addrext);
 
 	return (struct dma_pub *) di;
 
@@ -744,7 +745,7 @@ void dma_detach(struct dma_pub *pub)
 {
 	struct dma_info *di = (struct dma_info *)pub;
 
-	DMA_TRACE(("%s: dma_detach\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	/* free dma descriptor rings */
 	if (di->txd64)
@@ -812,7 +813,7 @@ static void _dma_rxenable(struct dma_info *di)
 	uint dmactrlflags = di->dma.dmactrlflags;
 	u32 control;
 
-	DMA_TRACE(("%s: dma_rxenable\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	control =
 	    (R_REG(&di->d64rxregs->control) & D64_RC_AE) |
@@ -832,7 +833,7 @@ void dma_rxinit(struct dma_pub *pub)
 {
 	struct dma_info *di = (struct dma_info *)pub;
 
-	DMA_TRACE(("%s: dma_rxinit\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	if (di->nrxd == 0)
 		return;
@@ -926,7 +927,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
 		return 0;
 
 	len = le16_to_cpu(*(__le16 *) (p->data));
-	DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
+	DMA_TRACE("%s: dma_rx len %d\n", di->name, len);
 	dma_spin_for_len(len, p);
 
 	/* set actual length */
@@ -953,14 +954,14 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
 				  D64_RS0_CD_MASK) -
 				 di->rcvptrbase) & D64_RS0_CD_MASK,
 				struct dma64desc);
-			DMA_ERROR(("dma_rx, rxin %d rxout %d, hw_curr %d\n",
-				   di->rxin, di->rxout, cur));
+			DMA_ERROR("rxin %d rxout %d, hw_curr %d\n",
+				  di->rxin, di->rxout, cur);
 		}
 #endif				/* BCMDBG */
 
 		if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) {
-			DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n",
-				   di->name, len));
+			DMA_ERROR("%s: bad frame length (%d)\n",
+				  di->name, len);
 			skb_queue_walk_safe(&dma_frames, p, next) {
 				skb_unlink(p, &dma_frames);
 				brcmu_pkt_buf_free_skb(p);
@@ -977,7 +978,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
 
 static bool dma64_rxidle(struct dma_info *di)
 {
-	DMA_TRACE(("%s: dma_rxidle\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	if (di->nrxd == 0)
 		return true;
@@ -1017,7 +1018,7 @@ bool dma_rxfill(struct dma_pub *pub)
 
 	n = di->nrxpost - nrxdactive(di, rxin, rxout);
 
-	DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n));
+	DMA_TRACE("%s: post %d\n", di->name, n);
 
 	if (di->rxbufsize > BCMEXTRAHDROOM)
 		extra_offset = di->rxextrahdrroom;
@@ -1030,11 +1031,9 @@ bool dma_rxfill(struct dma_pub *pub)
 		p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset);
 
 		if (p == NULL) {
-			DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n",
-				   di->name));
+			DMA_ERROR("%s: out of rxbufs\n", di->name);
 			if (i == 0 && dma64_rxidle(di)) {
-				DMA_ERROR(("%s: rxfill64: ring is empty !\n",
-					   di->name));
+				DMA_ERROR("%s: ring is empty !\n", di->name);
 				ring_empty = true;
 			}
 			di->dma.rxnobuf++;
@@ -1079,7 +1078,7 @@ void dma_rxreclaim(struct dma_pub *pub)
 	struct dma_info *di = (struct dma_info *)pub;
 	struct sk_buff *p;
 
-	DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	while ((p = _dma_getnextrxp(di, true)))
 		brcmu_pkt_buf_free_skb(p);
@@ -1110,7 +1109,7 @@ void dma_txinit(struct dma_pub *pub)
 	struct dma_info *di = (struct dma_info *)pub;
 	u32 control = D64_XC_XE;
 
-	DMA_TRACE(("%s: dma_txinit\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	if (di->ntxd == 0)
 		return;
@@ -1142,7 +1141,7 @@ void dma_txsuspend(struct dma_pub *pub)
 {
 	struct dma_info *di = (struct dma_info *)pub;
 
-	DMA_TRACE(("%s: dma_txsuspend\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	if (di->ntxd == 0)
 		return;
@@ -1154,7 +1153,7 @@ void dma_txresume(struct dma_pub *pub)
 {
 	struct dma_info *di = (struct dma_info *)pub;
 
-	DMA_TRACE(("%s: dma_txresume\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	if (di->ntxd == 0)
 		return;
@@ -1176,11 +1175,11 @@ void dma_txreclaim(struct dma_pub *pub, enum txd_range range)
 	struct dma_info *di = (struct dma_info *)pub;
 	struct sk_buff *p;
 
-	DMA_TRACE(("%s: dma_txreclaim %s\n", di->name,
-		   (range == DMA_RANGE_ALL) ? "all" :
-		   ((range ==
-		     DMA_RANGE_TRANSMITTED) ? "transmitted" :
-		    "transferred")));
+	DMA_TRACE("%s: %s\n",
+		  di->name,
+		  range == DMA_RANGE_ALL ? "all" :
+		  range == DMA_RANGE_TRANSMITTED ? "transmitted" :
+		  "transferred");
 
 	if (di->txin == di->txout)
 		return;
@@ -1250,7 +1249,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 	u32 flags = 0;
 	dma_addr_t pa;
 
-	DMA_TRACE(("%s: dma_txfast\n", di->name));
+	DMA_TRACE("%s:\n", di->name);
 
 	txout = di->txout;
 
@@ -1314,7 +1313,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
 	return 0;
 
  outoftxd:
-	DMA_ERROR(("%s: dma_txfast: out of txds !!!\n", di->name));
+	DMA_ERROR("%s: out of txds !!!\n", di->name);
 	brcmu_pkt_buf_free_skb(p0);
 	di->dma.txavail = 0;
 	di->dma.txnobuf++;
@@ -1338,11 +1337,11 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 	u16 active_desc;
 	struct sk_buff *txp;
 
-	DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name,
-		   (range == DMA_RANGE_ALL) ? "all" :
-		   ((range ==
-		     DMA_RANGE_TRANSMITTED) ? "transmitted" :
-		    "transferred")));
+	DMA_TRACE("%s: %s\n",
+		  di->name,
+		  range == DMA_RANGE_ALL ? "all" :
+		  range == DMA_RANGE_TRANSMITTED ? "transmitted" :
+		  "transferred");
 
 	if (di->ntxd == 0)
 		return NULL;
@@ -1402,8 +1401,8 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 	return txp;
 
  bogus:
-	DMA_NONE(("dma_getnexttxp: bogus curr: start %d end %d txout %d "
-		  "force %d\n", start, end, di->txout, forceall));
+	DMA_NONE("bogus curr: start %d end %d txout %d\n",
+		 start, end, di->txout);
 	return NULL;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH net-next] bnx2x: reduce skb truesize by 50%
From: Eric Dumazet @ 2011-11-13 19:42 UTC (permalink / raw)
  To: eilong
  Cc: David Miller, bhutchings@solarflare.com, pstaszewski@itcare.pl,
	netdev@vger.kernel.org
In-Reply-To: <1321210419.3101.1.camel@lb-tlvb-eilong.il.broadcom.com>

Le dimanche 13 novembre 2011 à 20:53 +0200, Eilon Greenstein a écrit :

> I’m not sure I’m following the math over here. Assuming L1 is 64 bytes,
> we need up to 63 bytes to align the start address (assuming SLOB is
> being used) and additional (up to) 63 bytes at the end. That can sum up
> to 126 bytes  am I missing something?
> 

What do you really mean by aligning the end ?

How can both start and end of a frame can be aligned ?

If hardware needs extra room after the end of frame, then we already
have it (since we store struct skb_shared_info here)



I ran following patch and everything is fine here

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index aec7212..ddc94cc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1188,8 +1188,8 @@ struct bnx2x {
 	/* Max supported alignment is 256 (8 shift) */
 #define BNX2X_RX_ALIGN_SHIFT		((L1_CACHE_SHIFT < 8) ? \
 					 L1_CACHE_SHIFT : 8)
-	/* FW use 2 Cache lines Alignment for start packet and size  */
-#define BNX2X_FW_RX_ALIGN		(2 << BNX2X_RX_ALIGN_SHIFT)
+	/* FW use Cache line Alignment for start packet and size  */
+#define BNX2X_FW_RX_ALIGN		(1 << BNX2X_RX_ALIGN_SHIFT)
 #define BNX2X_PXP_DRAM_ALIGN		(BNX2X_RX_ALIGN_SHIFT - 5)
 
 	struct host_sp_status_block *def_status_blk;

^ permalink raw reply related

* Re: [PATCH net-next] bnx2x: reduce skb truesize by 50%
From: Eilon Greenstein @ 2011-11-13 20:08 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, bhutchings@solarflare.com, pstaszewski@itcare.pl,
	netdev@vger.kernel.org
In-Reply-To: <1321213338.17837.38.camel@edumazet-laptop>

On Sun, 2011-11-13 at 11:42 -0800, Eric Dumazet wrote:
> Le dimanche 13 novembre 2011 à 20:53 +0200, Eilon Greenstein a écrit :
> 
> > I’m not sure I’m following the math over here. Assuming L1 is 64 bytes,
> > we need up to 63 bytes to align the start address (assuming SLOB is
> > being used) and additional (up to) 63 bytes at the end. That can sum up
> > to 126 bytes  am I missing something?
> > 
> 
> What do you really mean by aligning the end ?

I mean padding it to full cache line.

> How can both start and end of a frame can be aligned ?

The packet will start at aligned address and (using padding) will end at
cache line boundaries.

> If hardware needs extra room after the end of frame, then we already
> have it (since we store struct skb_shared_info here)

We have some space in there, but as far as I can tell it's not up to 63
bytes, right? We will overrun the dataref.

Thanks,
Eilon

^ permalink raw reply

* [patch 0/8 2.6.32] CVE-2010-4251: packet backlog can get too large
From: Dan Carpenter @ 2011-11-13 20:13 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, netdev, Zhu Yi, Eric Dumazet

I'm still very new to this whole -stable business so please let me
know if I do somethig wrong.

This patch series is to address CVE-2010-4251 for the 2.6.32 stable
kernel.  Here is the CVE summary:

 "The socket implementation in net/core/sock.c in the Linux kernel
  before 2.6.34 does not properly manage a backlog of received
  packets, which allows remote attackers to cause a denial of service
  (memory consumption) by sending a large amount of network traffic,
  as demonstrated by netperf UDP tests."

[patch 1/8] introduces sk_add_backlog_limited()
[patch 2-7/8] change each network protocol to use sk_add_backlog_limited()
	where appropriate.
[patch 8/8] renames sk_add_backlog() to __sk_add_backlog() and
	sk_add_backlog_limited() to sk_add_backlog().

The patches mostly apply without changes.  The exception is:
[patch 2/8] udp: use limited socket backlog
Then the rename [patch 8/8] needed to be changed as well to match.

regards,
dan carpenter

^ permalink raw reply

* [patch 2/8 2.6.32] udp: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:17 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

I had to make some changes to the first chunk in net/ipv6/udp.c to
make this to apply.

>From 55349790d7cbf0d381873a7ece1dcafcffd4aaa9 Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:42 +0000
Subject: [PATCH] udp: use limited socket backlog

Make udp adapt to the limited socket backlog change.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 0ac8833..2eaeaf1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1177,8 +1177,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		rc = __udp_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb)) {
+		bh_unlock_sock(sk);
+		goto drop;
+	}
 	bh_unlock_sock(sk);
 
 	return rc;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index ca520d4..4400eb0 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -473,16 +473,19 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 			bh_lock_sock(sk2);
 			if (!sock_owned_by_user(sk2))
 				udpv6_queue_rcv_skb(sk2, buff);
-			else
-				sk_add_backlog(sk2, buff);
+			else if (sk_add_backlog_limited(sk2, buff)) {
+				kfree_skb(buff);
+				bh_unlock_sock(sk2);
+				goto out;
+			}
 			bh_unlock_sock(sk2);
 		}
 	}
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb))
+		kfree_skb(skb);
 	bh_unlock_sock(sk);
 out:
 	spin_unlock(&hslot->lock);
@@ -601,8 +604,12 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb)) {
+		atomic_inc(&sk->sk_drops);
+		bh_unlock_sock(sk);
+		sock_put(sk);
+		goto discard;
+	}
 	bh_unlock_sock(sk);
 	sock_put(sk);
 	return 0;

^ permalink raw reply related

* [patch 3/8 2.6.32] x25: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:18 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

This applied without changes to the original patch.

>From 2499849ee8f513e795b9f2c19a42d6356e4943a4 Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:46 +0000
Subject: [PATCH] x25: use limited socket backlog

Make x25 adapt to the limited socket backlog change.

Cc: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/x25/x25_dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 3e1efe5..a9da0dc 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -53,7 +53,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
 		if (!sock_owned_by_user(sk)) {
 			queued = x25_process_rx_frame(sk, skb);
 		} else {
-			sk_add_backlog(sk, skb);
+			queued = !sk_add_backlog_limited(sk, skb);
 		}
 		bh_unlock_sock(sk);
 		sock_put(sk);
-- 
1.7.8.rc0.dirty

^ permalink raw reply related

* [patch 4/8 2.6.32] sctp: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:18 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

This applied without changes to the original patch.

>From 50b1a782f845140f4138f14a1ce8a4a6dd0cc82f Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:44 +0000
Subject: [PATCH] sctp: use limited socket backlog

Make sctp adapt to the limited socket backlog change.

Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/sctp/input.c  |   42 +++++++++++++++++++++++++++---------------
 net/sctp/socket.c |    3 +++
 2 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index c0c973e..cbc0636 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -75,7 +75,7 @@ static struct sctp_association *__sctp_lookup_association(
 					const union sctp_addr *peer,
 					struct sctp_transport **pt);
 
-static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
+static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
 
 
 /* Calculate the SCTP checksum of an SCTP packet.  */
@@ -265,8 +265,13 @@ int sctp_rcv(struct sk_buff *skb)
 	}
 
 	if (sock_owned_by_user(sk)) {
+		if (sctp_add_backlog(sk, skb)) {
+			sctp_bh_unlock_sock(sk);
+			sctp_chunk_free(chunk);
+			skb = NULL; /* sctp_chunk_free already freed the skb */
+			goto discard_release;
+		}
 		SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG);
-		sctp_add_backlog(sk, skb);
 	} else {
 		SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_SOFTIRQ);
 		sctp_inq_push(&chunk->rcvr->inqueue, chunk);
@@ -336,8 +341,10 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 		sctp_bh_lock_sock(sk);
 
 		if (sock_owned_by_user(sk)) {
-			sk_add_backlog(sk, skb);
-			backloged = 1;
+			if (sk_add_backlog_limited(sk, skb))
+				sctp_chunk_free(chunk);
+			else
+				backloged = 1;
 		} else
 			sctp_inq_push(inqueue, chunk);
 
@@ -362,22 +369,27 @@ done:
 	return 0;
 }
 
-static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
+static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
 {
 	struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
 	struct sctp_ep_common *rcvr = chunk->rcvr;
+	int ret;
 
-	/* Hold the assoc/ep while hanging on the backlog queue.
-	 * This way, we know structures we need will not disappear from us
-	 */
-	if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
-		sctp_association_hold(sctp_assoc(rcvr));
-	else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
-		sctp_endpoint_hold(sctp_ep(rcvr));
-	else
-		BUG();
+	ret = sk_add_backlog_limited(sk, skb);
+	if (!ret) {
+		/* Hold the assoc/ep while hanging on the backlog queue.
+		 * This way, we know structures we need will not disappear
+		 * from us
+		 */
+		if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
+			sctp_association_hold(sctp_assoc(rcvr));
+		else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
+			sctp_endpoint_hold(sctp_ep(rcvr));
+		else
+			BUG();
+	}
+	return ret;
 
-	sk_add_backlog(sk, skb);
 }
 
 /* Handle icmp frag needed error. */
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index f6d1e59..dfc5c12 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3720,6 +3720,9 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
 	SCTP_DBG_OBJCNT_INC(sock);
 	percpu_counter_inc(&sctp_sockets_allocated);
 
+	/* Set socket backlog limit. */
+	sk->sk_backlog.limit = sysctl_sctp_rmem[1];
+
 	local_bh_disable();
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
 	local_bh_enable();
-- 
1.7.8.rc0.dirty

^ permalink raw reply related

* [patch 5/8 2.6.32] tipc: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:18 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

This applied without changes to the original patch.

>From 53eecb1be5ae499d399d2923933937a9ea1a284f Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:45 +0000
Subject: [PATCH] tipc: use limited socket backlog

Make tipc adapt to the limited socket backlog change.

Cc: Jon Maloy <jon.maloy@ericsson.com>
Cc: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/tipc/socket.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 1ea64f0..22bfbc3 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1322,8 +1322,10 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 	if (!sock_owned_by_user(sk)) {
 		res = filter_rcv(sk, buf);
 	} else {
-		sk_add_backlog(sk, buf);
-		res = TIPC_OK;
+		if (sk_add_backlog_limited(sk, buf))
+			res = TIPC_ERR_OVERLOAD;
+		else
+			res = TIPC_OK;
 	}
 	bh_unlock_sock(sk);
 
-- 
1.7.8.rc0.dirty

^ permalink raw reply related

* [patch 6/8 2.6.32] tcp: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:19 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

This applied without changes to the original patch.

>From 6b03a53a5ab7ccf2d5d69f96cf1c739c4d2a8fb9 Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:41 +0000
Subject: [PATCH] tcp: use limited socket backlog

Make tcp adapt to the limited socket backlog change.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/ipv4/tcp_ipv4.c |    6 ++++--
 net/ipv6/tcp_ipv6.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c3588b4..4baf194 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1682,8 +1682,10 @@ process:
 			if (!tcp_prequeue(sk, skb))
 				ret = tcp_v4_do_rcv(sk, skb);
 		}
-	} else
-		sk_add_backlog(sk, skb);
+	} else if (sk_add_backlog_limited(sk, skb)) {
+		bh_unlock_sock(sk);
+		goto discard_and_relse;
+	}
 	bh_unlock_sock(sk);
 
 	sock_put(sk);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 6963a6b..c4ea9d5 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1740,8 +1740,10 @@ process:
 			if (!tcp_prequeue(sk, skb))
 				ret = tcp_v6_do_rcv(sk, skb);
 		}
-	} else
-		sk_add_backlog(sk, skb);
+	} else if (sk_add_backlog_limited(sk, skb)) {
+		bh_unlock_sock(sk);
+		goto discard_and_relse;
+	}
 	bh_unlock_sock(sk);
 
 	sock_put(sk);
-- 
1.7.8.rc0.dirty

^ permalink raw reply related

* [patch 7/8 2.6.32] llc: use limited socket backlog
From: Dan Carpenter @ 2011-11-13 20:19 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

This applied without changes to the original patch.

>From 79545b681961d7001c1f4c3eb9ffb87bed4485db Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:43 +0000
Subject: [PATCH] llc: use limited socket backlog

Make llc adapt to the limited socket backlog change.

Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/llc/llc_conn.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index a8dde9b..c0539ff 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -827,7 +827,8 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb)
 	else {
 		dprintk("%s: adding to backlog...\n", __func__);
 		llc_set_backlog_type(skb, LLC_PACKET);
-		sk_add_backlog(sk, skb);
+		if (sk_add_backlog_limited(sk, skb))
+			goto drop_unlock;
 	}
 out:
 	bh_unlock_sock(sk);
-- 
1.7.8.rc0.dirty

^ permalink raw reply related

* [patch 8/8 2.6.32] net: backlog functions rename
From: Dan Carpenter @ 2011-11-13 20:19 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Zhu Yi, netdev, Eric Dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

I had to make some trivial changes here as a result of the changes I
made in [patch 2/8 2.6.32] udp: use limited socket backlog.

>From a3a858ff18a72a8d388e31ab0d98f7e944841a62 Mon Sep 17 00:00:00 2001
From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:47 +0000
Subject: [PATCH] net: backlog functions rename

sk_add_backlog -> __sk_add_backlog
sk_add_backlog_limited -> sk_add_backlog

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---

diff --git a/include/net/sock.h b/include/net/sock.h
index 5a4844a..12fdc27 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -564,7 +564,7 @@ static inline int sk_stream_memory_free(struct sock *sk)
 }
 
 /* OOB backlog add */
-static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
+static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
 {
 	if (!sk->sk_backlog.tail) {
 		sk->sk_backlog.head = sk->sk_backlog.tail = skb;
@@ -576,12 +576,12 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
 }
 
 /* The per-socket spinlock must be held here. */
-static inline int sk_add_backlog_limited(struct sock *sk, struct sk_buff *skb)
+static inline int sk_add_backlog(struct sock *sk, struct sk_buff *skb)
 {
 	if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1))
 		return -ENOBUFS;
 
-	sk_add_backlog(sk, skb);
+	__sk_add_backlog(sk, skb);
 	sk->sk_backlog.len += skb->truesize;
 	return 0;
 }
diff --git a/net/core/sock.c b/net/core/sock.c
index 5797dab..eb191dd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -336,7 +336,7 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested)
 		rc = sk_backlog_rcv(sk, skb);
 
 		mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_);
-	} else if (sk_add_backlog_limited(sk, skb)) {
+	} else if (sk_add_backlog(sk, skb)) {
 		bh_unlock_sock(sk);
 		atomic_inc(&sk->sk_drops);
 		goto discard_and_relse;
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 5ca49ce..1d5abd2 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -254,7 +254,7 @@ int dccp_child_process(struct sock *parent, struct sock *child,
 		 * in main socket hash table and lock on listening
 		 * socket does not protect us more.
 		 */
-		sk_add_backlog(child, skb);
+		__sk_add_backlog(child, skb);
 	}
 
 	bh_unlock_sock(child);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6e824ac1..c64db81 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1635,7 +1635,7 @@ process:
 			if (!tcp_prequeue(sk, skb))
 				ret = tcp_v4_do_rcv(sk, skb);
 		}
-	} else if (sk_add_backlog_limited(sk, skb)) {
+	} else if (sk_add_backlog(sk, skb)) {
 		bh_unlock_sock(sk);
 		goto discard_and_relse;
 	}
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 4c03598..ab7ac46 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -702,7 +702,7 @@ int tcp_child_process(struct sock *parent, struct sock *child,
 		 * in main socket hash table and lock on listening
 		 * socket does not protect us more.
 		 */
-		sk_add_backlog(child, skb);
+		__sk_add_backlog(child, skb);
 	}
 
 	bh_unlock_sock(child);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2eaeaf1..be49cd4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1177,7 +1177,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		rc = __udp_queue_rcv_skb(sk, skb);
-	else if (sk_add_backlog_limited(sk, skb)) {
+	else if (sk_add_backlog(sk, skb)) {
 		bh_unlock_sock(sk);
 		goto drop;
 	}
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index dc06299..a1114ae 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1686,7 +1686,7 @@ process:
 			if (!tcp_prequeue(sk, skb))
 				ret = tcp_v6_do_rcv(sk, skb);
 		}
-	} else if (sk_add_backlog_limited(sk, skb)) {
+	} else if (sk_add_backlog(sk, skb)) {
 		bh_unlock_sock(sk);
 		goto discard_and_relse;
 	}
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4400eb0..e0cf8f3 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -473,7 +473,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 			bh_lock_sock(sk2);
 			if (!sock_owned_by_user(sk2))
 				udpv6_queue_rcv_skb(sk2, buff);
-			else if (sk_add_backlog_limited(sk2, buff)) {
+			else if (sk_add_backlog(sk2, buff)) {
 				kfree_skb(buff);
 				bh_unlock_sock(sk2);
 				goto out;
@@ -484,7 +484,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else if (sk_add_backlog_limited(sk, skb))
+	else if (sk_add_backlog(sk, skb))
 		kfree_skb(skb);
 	bh_unlock_sock(sk);
 out:
@@ -604,7 +604,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else if (sk_add_backlog_limited(sk, skb)) {
+	else if (sk_add_backlog(sk, skb)) {
 		atomic_inc(&sk->sk_drops);
 		bh_unlock_sock(sk);
 		sock_put(sk);
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index 019c780..86d6985 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -1437,7 +1437,7 @@ static void llc_process_tmr_ev(struct sock *sk, struct sk_buff *skb)
 			llc_conn_state_process(sk, skb);
 		else {
 			llc_set_backlog_type(skb, LLC_EVENT);
-			sk_add_backlog(sk, skb);
+			__sk_add_backlog(sk, skb);
 		}
 	}
 }
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 8f97546..c61ca88 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -756,7 +756,7 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb)
 	else {
 		dprintk("%s: adding to backlog...\n", __func__);
 		llc_set_backlog_type(skb, LLC_PACKET);
-		if (sk_add_backlog_limited(sk, skb))
+		if (sk_add_backlog(sk, skb))
 			goto drop_unlock;
 	}
 out:
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 3271c7b..eaacf76 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -341,7 +341,7 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 		sctp_bh_lock_sock(sk);
 
 		if (sock_owned_by_user(sk)) {
-			if (sk_add_backlog_limited(sk, skb))
+			if (sk_add_backlog(sk, skb))
 				sctp_chunk_free(chunk);
 			else
 				backloged = 1;
@@ -375,7 +375,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
 	struct sctp_ep_common *rcvr = chunk->rcvr;
 	int ret;
 
-	ret = sk_add_backlog_limited(sk, skb);
+	ret = sk_add_backlog(sk, skb);
 	if (!ret) {
 		/* Hold the assoc/ep while hanging on the backlog queue.
 		 * This way, we know structures we need will not disappear
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index bf4b320..f1e6629 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1323,7 +1323,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 	if (!sock_owned_by_user(sk)) {
 		res = filter_rcv(sk, buf);
 	} else {
-		if (sk_add_backlog_limited(sk, buf))
+		if (sk_add_backlog(sk, buf))
 			res = TIPC_ERR_OVERLOAD;
 		else
 			res = TIPC_OK;
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index a9da0dc..52e3042 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -53,7 +53,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
 		if (!sock_owned_by_user(sk)) {
 			queued = x25_process_rx_frame(sk, skb);
 		} else {
-			queued = !sk_add_backlog_limited(sk, skb);
+			queued = !sk_add_backlog(sk, skb);
 		}
 		bh_unlock_sock(sk);
 		sock_put(sk);

^ permalink raw reply related

* Re: bonding xmit_policy
From: Nicolas de Pesloüan @ 2011-11-13 20:26 UTC (permalink / raw)
  To: Simon Chen; +Cc: netdev
In-Reply-To: <CANj2Ebfj+7R+wCK7jJennBN7_6THJGqs8FWSAPOv7BYYsR=u9w@mail.gmail.com>

Le 13/11/2011 03:55, Simon Chen a écrit :
> Hi folks,
>
> It looks like that there are three entries in xmit_policy (hashing for
> deciding egress phy int) for bonded interfaces:
>
> const struct bond_parm_tbl xmit_hashtype_tbl[] = {
> {       "layer2",               BOND_XMIT_POLICY_LAYER2},
> {       "layer3+4",             BOND_XMIT_POLICY_LAYER34},
> {       "layer2+3",             BOND_XMIT_POLICY_LAYER23},
> {       NULL,                   -1},
> };
>
>
> We can set the xmit_policy either at module initiation, or later via
> /sys. However, this xmit_policy isn't really read anywhere. Are
> different policies really implemented?

The table is used in two different locations:

In drivers/net/bonding/bond_main.c:

	xmit_hashtype = bond_parse_parm(xmit_hash_policy, xmit_hashtype_tbl);
	[...]
	params->xmit_policy = xmit_hashtype;

In drivers/net/bonding/bond_sysfs.c:

	new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
	[...]
	bonds->params.xmit_policy = new_value;

Then, in drivers/net/bonding/bond_main.c, the value in bonds->params.xmit_policy is used to setup a 
callback into bond->xmit_hash_policy.

	static void bond_set_xmit_hash_policy(struct bonding *bond)
	{
	        switch (bond->params.xmit_policy) {
	        case BOND_XMIT_POLICY_LAYER23:
	                bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
	                break;
	        case BOND_XMIT_POLICY_LAYER34:
	                bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
	                break;
	        case BOND_XMIT_POLICY_LAYER2:
         	default:
	                bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
	                break;
	        }
	}

Then, in drivers/net/bonding/bond_3ad.c and in drivers/net/bonding/bond_main.c, the callback is used 
to select a slave for xmit, for the two modes where xmit_hash_policy have a meaning:

         slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg);

         slave_no = bond->xmit_hash_policy(skb, bond->slave_cnt);


So, yes, those policies are really implemented.

	Nicolas.

^ permalink raw reply

* Re: [patch 0/8 2.6.32] CVE-2010-4251: packet backlog can get too large
From: David Miller @ 2011-11-13 20:58 UTC (permalink / raw)
  To: dan.carpenter; +Cc: stable, greg, netdev, yi.zhu, eric.dumazet
In-Reply-To: <20111113201336.GA1362@elgon.mountain>

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sun, 13 Nov 2011 23:13:36 +0300

> This patch series is to address CVE-2010-4251 for the 2.6.32 stable
> kernel.  Here is the CVE summary:
> 
>  "The socket implementation in net/core/sock.c in the Linux kernel
>   before 2.6.34 does not properly manage a backlog of received
>   packets, which allows remote attackers to cause a denial of service
>   (memory consumption) by sending a large amount of network traffic,
>   as demonstrated by netperf UDP tests."
> 
> [patch 1/8] introduces sk_add_backlog_limited()
> [patch 2-7/8] change each network protocol to use sk_add_backlog_limited()
> 	where appropriate.
> [patch 8/8] renames sk_add_backlog() to __sk_add_backlog() and
> 	sk_add_backlog_limited() to sk_add_backlog().
> 
> The patches mostly apply without changes.  The exception is:
> [patch 2/8] udp: use limited socket backlog
> Then the rename [patch 8/8] needed to be changed as well to match.

These changes are way too intrusive and potentially regression
inducing for -stable inclusion, especially a kernel that is in such
deep maintainence mode as 2.6.32 is.

Also, I tend to personally submit networking -stable patches, so please
do not bypass me in this manner and instead recommend such submissions
on the netdev list so I can evaluate the request.

Thanks.

^ permalink raw reply

* Re: [PATCH v3 net-next 00/12] bnx2x series
From: David Miller @ 2011-11-13 21:06 UTC (permalink / raw)
  To: dmitry; +Cc: netdev
In-Reply-To: <1321194872-8276-1-git-send-email-dmitry@broadcom.com>

From: "Dmitry Kravkov" <dmitry@broadcom.com>
Date: Sun, 13 Nov 2011 16:34:20 +0200

> Changes from v2:
>     - Patch: "bnx2x: simplify definition of RX_SGE_MASK_LEN and use it"
>       fixed according to Joe Perches <joe@perches.com> comment.
>   
> Changes from v1:
>     - Removed patch with pri_map module parameter.  
> 
> 
> Hello Dave,
> 
> The series includes re-enabling FCoE and DCB for 578xx devices,
> some improvements in licensing for cnic,   
> DCBX propagation in MF modes, handling of fan failures,
> removing napi struct from the stack and performs some code clean-ups. 
> 
> Please consider applying the series to net-next.

Applied, thanks.

^ permalink raw reply

* Re: [PATCH v3 net-next 09/12] bnx2x: add fan failure event handling
From: Joe Perches @ 2011-11-13 21:11 UTC (permalink / raw)
  To: Dmitry Kravkov; +Cc: davem, netdev, Ariel Elior, Eilon Greenstein
In-Reply-To: <1321194872-8276-10-git-send-email-dmitry@broadcom.com>

On Sun, 2011-11-13 at 16:34 +0200, Dmitry Kravkov wrote:
> From: Ariel Elior <ariele@broadcom.com>
> Shut down the device in case of fan failure to prevent HW damage.
trivia.
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
[]
> @@ -8503,6 +8514,17 @@ sp_rtnl_not_reset:
[]
> +	if (test_and_clear_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state)) {
> +		DP(BNX2X_MSG_SP, "fan failure detected. Unloading driver");

Missing a trailing "\n".

^ permalink raw reply

* Re: [patch net-next V8] net: introduce ethernet teaming device
From: David Miller @ 2011-11-13 21:09 UTC (permalink / raw)
  To: jpirko
  Cc: netdev, eric.dumazet, bhutchings, shemminger, fubar, andy, tgraf,
	ebiederm, mirqus, kaber, greearb, jesse, fbl, benjamin.poirier,
	jzupka, ivecera
In-Reply-To: <1321085808-6871-1-git-send-email-jpirko@redhat.com>

From: Jiri Pirko <jpirko@redhat.com>
Date: Sat, 12 Nov 2011 09:16:48 +0100

> This patch introduces new network device called team. It supposes to be
> very fast, simple, userspace-driven alternative to existing bonding
> driver.
> 
> Userspace library called libteam with couple of demo apps is available
> here:
> https://github.com/jpirko/libteam
> Note it's still in its dipers atm.
> 
> team<->libteam use generic netlink for communication. That and rtnl
> suppose to be the only way to configure team device, no sysfs etc.
> 
> Python binding of libteam was recently introduced.
> Daemon providing arpmon/miimon active-backup functionality will be
> introduced shortly. All what's necessary is already implemented in
> kernel team driver.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Applied, thanks for all of your hard work.

^ permalink raw reply

* [PATCH] Net, libertas: Resolve memory leak in if_spi_host_to_card()
From: Jesper Juhl @ 2011-11-13 21:14 UTC (permalink / raw)
  To: libertas-dev, linux-wireless, netdev, linux-kernel
  Cc: Andrey Yurovsky, Colin McCabe, Dan Williams, John W. Linville,
	David S. Miller

If we hit the default case in the switch in if_spi_host_to_card() we'll leak
the memory we allocated for 'packet'. This patch resolves the leak by freeing
the allocated memory in that case.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/libertas/if_spi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

 Compile tested only due to lack of hardware.

diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 11b69b3..728baa4 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
 		spin_unlock_irqrestore(&card->buffer_lock, flags);
 		break;
 	default:
+		kfree(packet);
 		netdev_err(priv->dev, "can't transfer buffer of type %d\n",
 			   type);
 		err = -EINVAL;
-- 
1.7.7.3


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply related

* Confirm  Mail Receipt!!!
From: ''Susan Wright'' @ 2011-11-12 12:48 UTC (permalink / raw)
  To: Recipients

Good Day

I have been directed to contact you by my boss, Mr. Tia  Almeida, the Principal Assurance Manager of BANCO EFISA. He has an urgent business proposal for your consideration and acceptance valued £10,000,000.00 GBP he wishes to discuss with you. Kindly indicate your interest and get back to enable him furnish you with more information/details and modalities on this proposal via his private email address: ttialmed@mail2uk.com

Sincerely,

Secretary

^ permalink raw reply

* tc: deleting single entry from filter hashtable
From: Miroslav Kratochvil @ 2011-11-13 21:19 UTC (permalink / raw)
  To: netdev

Hello,

I have following problem: For performance reasons I've been using a
setup known from LARTC as 'hashing filters', just like here:

http://lartc.org/howto/lartc.adv-filter.hashing.html

For the same performance reasons, I'd like to be able to delete or
change a _single_ entry from the hash table, so I don't need to refill
the whole table on every change I need to do (which can get pretty
slow for amount of entries over 10k, even when using a C program that
pushes the commands right into 'tc -batch')

Question: Is the single deletion/modification possible? If not --
judging from the lack of the documentation on given subject I kindof
expect that it's not possible -- is there any other possibility to
delete at least some reasonably small subset of the hash table that
could be modified and recreated quickly?

Also, here's my (failed) approach: I tried to assign different prio's
to all hashtable entries so they could be deleted by reference to that
prio, but after passing through TC they got created with the same prio
anyway..

Thanks for any help with this problem,

-mk

^ permalink raw reply

* Re: [LARTC] LARTC mailing list
From: Andrew Beverley @ 2011-11-13 21:39 UTC (permalink / raw)
  To: Benjamin Poirier
  Cc: Linux Advanced Routing & Traffic Control project,
	linux-new-lists, netfilter, netdev
In-Reply-To: <20111102175414.GA10307@synalogic.ca>

On Wed, 2011-11-02 at 13:54 -0400, Benjamin Poirier wrote:
> On 11/10/22 15:10, Andrew Beverley wrote:
> > On Sat, 2011-10-22 at 15:03 +0200, Niccolò Belli wrote:
> > > Is someone still interested to bring LARTC to a new life?
> > > I'm sorry for the subscription but the list didn't work anymore and it 
> > > was unfeasible to CC 30+ addresses. Let me know if you want to 
> > > unsubscribe and you don't know how to.
> > 
> > Thanks for doing this Niccolo. However, I'd rather see it hosted at
> > vger.kernel.org for all the reasons previously outlined.
> > 
> > I was actually going to suggest a new list called net-users instead.
> > There is netdev, netfilter-devel and netfilter, but not a general
> > networking users list.
> 
> Isn't that what linux-net@vger.kernel.org is/was supposed to be about?

Hmmm, hadn't even come across that before.

> Not sure what's its status, it's no longer listed on
> http://vger.kernel.org/vger-lists.html, the last message I've received
> on it was a month ago and it was mostly spam before that.

Maybe not much interest for a users' list then...


--
To unsubscribe from this list: send the line "unsubscribe linux-new-lists" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [LARTC] LARTC mailing list
From: Andrew Beverley @ 2011-11-13 21:42 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Linux Advanced Routing & Traffic Control project,
	linux-new-lists, netfilter, netdev
In-Reply-To: <alpine.LNX.2.01.1111021641440.17999@frira.zrqbmnf.qr>

On Wed, 2011-11-02 at 16:43 +0100, Jan Engelhardt wrote:
> On Saturday 2011-10-22 16:10, Andrew Beverley wrote:
> 
> >On Sat, 2011-10-22 at 15:03 +0200, Niccolò Belli wrote:
> >> Is someone still interested to bring LARTC to a new life?
> >> I'm sorry for the subscription but the list didn't work anymore and it 
> >> was unfeasible to CC 30+ addresses. Let me know if you want to 
> >> unsubscribe and you don't know how to.
> >
> >Thanks for doing this Niccolo. However, I'd rather see it hosted at
> >vger.kernel.org for all the reasons previously outlined.
> >
> >I was actually going to suggest a new list called net-users instead.
> >There is netdev, netfilter-devel and netfilter, but not a general
> >networking users list.
> >
> >User questions do get asked on netdev, and some non-netfilter questions
> >get asked on the netfilter list, but it would seem sensible to have a
> >general networking users list that would include LARTC questions.
> >
> >Comments anyone?
> 
> Might as well just go to netfilter for now, it's not like as if the 
> traffic was as much as linux-kernel.

Yep, may as well, they seem to be posted there anyway. I was just
conscious that there doesn't appear to be many "tc" experts, because
those sort of questions don't get much of a response.

I'd love to spend some time on some tc documentation one day...

Andy


--
To unsubscribe from this list: send the line "unsubscribe linux-new-lists" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] net/packet: remove dead code and unneeded variable from prb_setup_retire_blk_timer()
From: Jesper Juhl @ 2011-11-13 21:55 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: David S. Miller, Eric Dumazet, Changli Gao, Ben Greear,
	Chetan Loke, waltje, gw4pts, waltje, ross.biro, alan

We test for 'tx_ring' being != zero and BUG() if that's the case. So after
that check there is no way that 'tx_ring' could be anything _but_ zero, so
testing it again is just dead code. Once that dead code is removed, the
'pkc' local variable becomes entirely redundant, so remove that as well.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 net/packet/af_packet.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

 only compile tested.

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 82a6f34..ab10e84 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -516,13 +516,11 @@ static void prb_init_blk_timer(struct packet_sock *po,
 
 static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
 {
-	struct tpacket_kbdq_core *pkc;
-
 	if (tx_ring)
 		BUG();
 
-	pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
-	prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
+	prb_init_blk_timer(po, &po->rx_ring.prb_bdqc,
+			   prb_retire_rx_blk_timer_expired);
 }
 
 static int prb_calc_retire_blk_tmo(struct packet_sock *po,
-- 
1.7.7.3


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply related

* Re: [LARTC] LARTC mailing list
From: Dave Taht @ 2011-11-13 21:56 UTC (permalink / raw)
  To: Andrew Beverley
  Cc: Jan Engelhardt,
	Linux Advanced Routing & Traffic Control project,
	linux-new-lists, netfilter, netdev
In-Reply-To: <1321220521.1965.13.camel@andybev-desktop>

On Sun, Nov 13, 2011 at 10:42 PM, Andrew Beverley <andy@andybev.com> wrote:
> On Wed, 2011-11-02 at 16:43 +0100, Jan Engelhardt wrote:
>> On Saturday 2011-10-22 16:10, Andrew Beverley wrote:
>>
>> >On Sat, 2011-10-22 at 15:03 +0200, Niccolò Belli wrote:
>> >> Is someone still interested to bring LARTC to a new life?
>> >> I'm sorry for the subscription but the list didn't work anymore and it
>> >> was unfeasible to CC 30+ addresses. Let me know if you want to
>> >> unsubscribe and you don't know how to.
>> >
>> >Thanks for doing this Niccolo. However, I'd rather see it hosted at
>> >vger.kernel.org for all the reasons previously outlined.
>> >
>> >I was actually going to suggest a new list called net-users instead.
>> >There is netdev, netfilter-devel and netfilter, but not a general
>> >networking users list.
>> >
>> >User questions do get asked on netdev, and some non-netfilter questions
>> >get asked on the netfilter list, but it would seem sensible to have a
>> >general networking users list that would include LARTC questions.
>> >
>> >Comments anyone?
>>
>> Might as well just go to netfilter for now, it's not like as if the
>> traffic was as much as linux-kernel.
>
> Yep, may as well, they seem to be posted there anyway. I was just
> conscious that there doesn't appear to be many "tc" experts, because
> those sort of questions don't get much of a response.

I would be interested in seeing a resurrected 'tc' list aimed more at
users/sysadmins than developers.

There has been a lot of mostly theoretical discussion about aqms and
the like on the bloat and bloat-devel lists, but when it comes down to
something that will actually work, not so much...

>
> I'd love to spend some time on some tc documentation one day...

The tc documentation is littered with less than useful examples, when
they do exist, which is not often enough, and much of the public
documentation is old or hard to understand.

and I'd be glad to help get all that sorted out.

>
> Andy
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
FR Tel: 0638645374
http://www.bufferbloat.net

^ permalink raw reply

* Re: [PATCH net-next] bnx2x: reduce skb truesize by 50%
From: Eric Dumazet @ 2011-11-13 22:00 UTC (permalink / raw)
  To: eilong
  Cc: David Miller, bhutchings@solarflare.com, pstaszewski@itcare.pl,
	netdev@vger.kernel.org
In-Reply-To: <1321214895.3101.3.camel@lb-tlvb-eilong.il.broadcom.com>

Le dimanche 13 novembre 2011 à 22:08 +0200, Eilon Greenstein a écrit :
> On Sun, 2011-11-13 at 11:42 -0800, Eric Dumazet wrote:
> > Le dimanche 13 novembre 2011 à 20:53 +0200, Eilon Greenstein a écrit :
> > 
> > > I’m not sure I’m following the math over here. Assuming L1 is 64 bytes,
> > > we need up to 63 bytes to align the start address (assuming SLOB is
> > > being used) and additional (up to) 63 bytes at the end. That can sum up
> > > to 126 bytes  am I missing something?
> > > 
> > 
> > What do you really mean by aligning the end ?
> 
> I mean padding it to full cache line.
> 
> > How can both start and end of a frame can be aligned ?
> 
> The packet will start at aligned address and (using padding) will end at
> cache line boundaries.
> 

OK, so hardware adds up to 63 bytes of padding at the end of the packet.

> > If hardware needs extra room after the end of frame, then we already
> > have it (since we store struct skb_shared_info here)
> 
> We have some space in there, but as far as I can tell it's not up to 63
> bytes, right? We will overrun the dataref.
> 

OK then we need using build_skb() for this driver :)

http://lists.openwall.net/netdev/2011/07/11/19

This way, we build the skb_shared_info content _after_ frame is
delivered by device.

^ permalink raw reply

* Re: [LARTC] LARTC mailing list
From: Niccolò Belli @ 2011-11-13 22:02 UTC (permalink / raw)
  To: Linux Advanced Routing & Traffic Control project
  Cc: Dave Taht, Andrew Beverley, linux-new-lists, netdev, netfilter,
	Jan Engelhardt
In-Reply-To: <CAA93jw49j--DFrj-040ii6Tp4S3v=QVKzUS8ShtBf_dG9zAoRw@mail.gmail.com>

I think we should just create a new list called "LARTC", on 
vger.kernel.org, hosted on my own servers or wherever you want.
The most important thing is trying to keep alive the community around it.

Niccolò

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox