* [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 12:27 ` Ian Campbell
` (2 more replies)
2011-10-10 11:11 ` [PATCH 2/9] mlx4: convert to SKB paged frag API Ian Campbell
` (8 subsequent siblings)
9 siblings, 3 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell, linux-mm
A few network drivers currently use skb_frag_struct for this purpose but I have
patches which add additional fields and semantics there which these other uses
do not want.
A structure for reference sub-page regions seems like a generally useful thing
so do so instead of adding a network subsystem specific structure.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: linux-mm@kvack.org
---
include/linux/mm_types.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 774b895..dc1d103 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -135,6 +135,17 @@ struct page {
#endif
;
+struct subpage {
+ struct page *page;
+#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
+ __u32 page_offset;
+ __u32 size;
+#else
+ __u16 page_offset;
+ __u16 size;
+#endif
+};
+
typedef unsigned long __nocast vm_flags_t;
/*
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 11:11 ` [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length Ian Campbell
@ 2011-10-10 12:27 ` Ian Campbell
2011-10-10 15:55 ` Christoph Hellwig
2011-10-10 16:27 ` Ian Campbell
2 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 12:27 UTC (permalink / raw)
To: linux-mm@kvack.org; +Cc: netdev@vger.kernel.org
On Mon, 2011-10-10 at 12:11 +0100, Ian Campbell wrote:
> Cc: linux-mm@kvack.org
> ---
> include/linux/mm_types.h | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
get_maintainers.pl didn't pick up on this CC. Since mm_types.h was split
out of mm.h does the following make sense? Not sure if mm_*.h (or just
mm_inline.hm?) also makes sense.
8<--------------------------
Subject: MAINTAINER: mm subsystem includes mm_types.h
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index ae8820e..f10a7ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4212,6 +4212,7 @@ L: linux-mm@kvack.org
W: http://www.linux-mm.org
S: Maintained
F: include/linux/mm.h
+F: include/linux/mm_types.h
F: mm/
MEMORY RESOURCE CONTROLLER
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 774b895..dc1d103 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -135,6 +135,17 @@ struct page {
> #endif
> ;
>
> +struct subpage {
> + struct page *page;
> +#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
> + __u32 page_offset;
> + __u32 size;
> +#else
> + __u16 page_offset;
> + __u16 size;
> +#endif
> +};
> +
> typedef unsigned long __nocast vm_flags_t;
>
> /*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 11:11 ` [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length Ian Campbell
2011-10-10 12:27 ` Ian Campbell
@ 2011-10-10 15:55 ` Christoph Hellwig
2011-10-10 16:10 ` Ian Campbell
2011-10-10 16:27 ` Ian Campbell
2 siblings, 1 reply; 23+ messages in thread
From: Christoph Hellwig @ 2011-10-10 15:55 UTC (permalink / raw)
To: Ian Campbell; +Cc: netdev, linux-mm
On Mon, Oct 10, 2011 at 12:11:33PM +0100, Ian Campbell wrote:
> A few network drivers currently use skb_frag_struct for this purpose but I have
> patches which add additional fields and semantics there which these other uses
> do not want.
>
> A structure for reference sub-page regions seems like a generally useful thing
> so do so instead of adding a network subsystem specific structure.
Subpage seems like a fairly bad name. page_frag would fit into the
scheme used in a few other places.
The brings back the discussion of unifying the various incarnations we
have of this (biovec, skb frag and there were a few more at times),
but IIRC one of the sticking points back then was that one offset
insistet in 32-bit offset/len and the other on 16-bit.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 15:55 ` Christoph Hellwig
@ 2011-10-10 16:10 ` Ian Campbell
2011-10-10 16:19 ` Christoph Hellwig
0 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 16:10 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: netdev@vger.kernel.org, linux-mm@kvack.org
On Mon, 2011-10-10 at 16:55 +0100, Christoph Hellwig wrote:
> On Mon, Oct 10, 2011 at 12:11:33PM +0100, Ian Campbell wrote:
> > A few network drivers currently use skb_frag_struct for this purpose but I have
> > patches which add additional fields and semantics there which these other uses
> > do not want.
> >
> > A structure for reference sub-page regions seems like a generally useful thing
> > so do so instead of adding a network subsystem specific structure.
>
> Subpage seems like a fairly bad name. page_frag would fit into the
> scheme used in a few other places.
ok.
> The brings back the discussion of unifying the various incarnations we
> have of this (biovec, skb frag and there were a few more at times),
> but IIRC one of the sticking points back then was that one offset
> insistet in 32-bit offset/len and the other on 16-bit.
This version sizes the fields according to page size, was there
somewhere which wanted to use an offset > PAGE_SIZE (or size > PAGE_SIZE
for that matter). That would be pretty odd and/or not really a candidate
for using this datastructure?
Ian.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 16:10 ` Ian Campbell
@ 2011-10-10 16:19 ` Christoph Hellwig
0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2011-10-10 16:19 UTC (permalink / raw)
To: Ian Campbell
Cc: Christoph Hellwig, netdev@vger.kernel.org, linux-mm@kvack.org
On Mon, Oct 10, 2011 at 05:10:59PM +0100, Ian Campbell wrote:
> This version sizes the fields according to page size, was there
> somewhere which wanted to use an offset > PAGE_SIZE (or size > PAGE_SIZE
> for that matter). That would be pretty odd and/or not really a candidate
> for using this datastructure?
I wasn't ever part of the fight myself and only vaguely remember it.
Try to get linux-kernel and Jens onto the Cc list to at least have the
major stakeholders informed.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
2011-10-10 11:11 ` [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length Ian Campbell
2011-10-10 12:27 ` Ian Campbell
2011-10-10 15:55 ` Christoph Hellwig
@ 2011-10-10 16:27 ` Ian Campbell
2 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 16:27 UTC (permalink / raw)
To: netdev@vger.kernel.org
Cc: linux-mm@kvack.org, linux-kernel, Jens Axboe, Christoph Hellwig
(reposting including LKML to catch other potential users)
Is this structure of any use to unify other instances of a similar
tuple, e.g. biovec, pagefrag etc?
Ian.
On Mon, 2011-10-10 at 12:11 +0100, Ian Campbell wrote:
> A few network drivers currently use skb_frag_struct for this purpose but I have
> patches which add additional fields and semantics there which these other uses
> do not want.
>
> A structure for reference sub-page regions seems like a generally useful thing
> so do so instead of adding a network subsystem specific structure.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: linux-mm@kvack.org
> ---
> include/linux/mm_types.h | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 774b895..dc1d103 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -135,6 +135,17 @@ struct page {
> #endif
> ;
>
> +struct subpage {
> + struct page *page;
> +#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
> + __u32 page_offset;
> + __u32 size;
> +#else
> + __u16 page_offset;
> + __u16 size;
> +#endif
> +};
> +
> typedef unsigned long __nocast vm_flags_t;
>
> /*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/9] mlx4: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
2011-10-10 11:11 ` [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 3/9] cxgb4: " Ian Campbell
` (7 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 34 ++++++++++++++--------------
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 20 +++-------------
2 files changed, 21 insertions(+), 33 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 37cc9e5..12e0bee 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -44,7 +44,7 @@
static int mlx4_en_alloc_frag(struct mlx4_en_priv *priv,
struct mlx4_en_rx_desc *rx_desc,
- struct skb_frag_struct *skb_frags,
+ struct subpage *skb_frags,
struct mlx4_en_rx_alloc *ring_alloc,
int i)
{
@@ -157,8 +157,8 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
struct mlx4_en_rx_ring *ring, int index)
{
struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride);
- struct skb_frag_struct *skb_frags = ring->rx_info +
- (index << priv->log_rx_info);
+ struct subpage *skb_frags = ring->rx_info +
+ (index << priv->log_rx_info);
int i;
for (i = 0; i < priv->num_frags; i++)
@@ -183,7 +183,7 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
int index)
{
struct mlx4_en_dev *mdev = priv->mdev;
- struct skb_frag_struct *skb_frags;
+ struct subpage *skb_frags;
struct mlx4_en_rx_desc *rx_desc = ring->buf + (index << ring->log_stride);
dma_addr_t dma;
int nr;
@@ -403,8 +403,8 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
/* Unmap a completed descriptor and free unused pages */
static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
struct mlx4_en_rx_desc *rx_desc,
- struct skb_frag_struct *skb_frags,
- struct skb_frag_struct *skb_frags_rx,
+ struct subpage *skb_frags,
+ struct sk_buff *skb,
struct mlx4_en_rx_alloc *page_alloc,
int length)
{
@@ -420,9 +420,10 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
break;
/* Save page reference in skb */
- skb_frags_rx[nr].page = skb_frags[nr].page;
- skb_frags_rx[nr].size = skb_frags[nr].size;
- skb_frags_rx[nr].page_offset = skb_frags[nr].page_offset;
+ __skb_fill_page_desc(skb, nr,
+ skb_frags[nr].page,
+ skb_frags[nr].size,
+ skb_frags[nr].page_offset);
dma = be64_to_cpu(rx_desc->data[nr].addr);
/* Allocate a replacement page */
@@ -430,12 +431,12 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
goto fail;
/* Unmap buffer */
- pci_unmap_single(mdev->pdev, dma, skb_frags_rx[nr].size,
+ pci_unmap_single(mdev->pdev, dma, skb_shinfo(skb)->frags[nr].size,
PCI_DMA_FROMDEVICE);
}
/* Adjust size of last fragment to match actual length */
if (nr > 0)
- skb_frags_rx[nr - 1].size = length -
+ skb_shinfo(skb)->frags[nr - 1].size = length -
priv->frag_info[nr - 1].frag_prefix_size;
return nr;
@@ -444,7 +445,7 @@ fail:
* the descriptor) of this packet; remaining fragments are reused... */
while (nr > 0) {
nr--;
- put_page(skb_frags_rx[nr].page);
+ skb_frag_unref(skb, nr);
}
return 0;
}
@@ -452,7 +453,7 @@ fail:
static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
struct mlx4_en_rx_desc *rx_desc,
- struct skb_frag_struct *skb_frags,
+ struct subpage *skb_frags,
struct mlx4_en_rx_alloc *page_alloc,
unsigned int length)
{
@@ -490,8 +491,7 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
/* Move relevant fragments to skb */
used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags,
- skb_shinfo(skb)->frags,
- page_alloc, length);
+ skb, page_alloc, length);
if (unlikely(!used_frags)) {
kfree_skb(skb);
return NULL;
@@ -533,7 +533,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_cqe *cqe;
struct mlx4_en_rx_ring *ring = &priv->rx_ring[cq->ring];
- struct skb_frag_struct *skb_frags;
+ struct subpage *skb_frags;
struct mlx4_en_rx_desc *rx_desc;
struct sk_buff *skb;
int index;
@@ -600,7 +600,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
nr = mlx4_en_complete_rx_desc(
priv, rx_desc,
- skb_frags, skb_shinfo(gro_skb)->frags,
+ skb_frags, gro_skb,
ring->page_alloc, length);
if (!nr)
goto next;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 6e03de0..e8cc987 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -460,26 +460,13 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
}
}
-static void *get_frag_ptr(struct sk_buff *skb)
-{
- struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
- struct page *page = frag->page;
- void *ptr;
-
- ptr = page_address(page);
- if (unlikely(!ptr))
- return NULL;
-
- return ptr + frag->page_offset;
-}
-
static int is_inline(struct sk_buff *skb, void **pfrag)
{
void *ptr;
if (inline_thold && !skb_is_gso(skb) && skb->len <= inline_thold) {
if (skb_shinfo(skb)->nr_frags == 1) {
- ptr = get_frag_ptr(skb);
+ ptr = skb_frag_address_safe(&skb_shinfo(skb)->frags[0]);
if (unlikely(!ptr))
return 0;
@@ -756,8 +743,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
/* Map fragments */
for (i = skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) {
frag = &skb_shinfo(skb)->frags[i];
- dma = pci_map_page(mdev->dev->pdev, frag->page, frag->page_offset,
- frag->size, PCI_DMA_TODEVICE);
+ dma = skb_frag_dma_map(&mdev->dev->pdev->dev, frag,
+ 0, frag->size,
+ DMA_TO_DEVICE);
data->addr = cpu_to_be64(dma);
data->lkey = cpu_to_be32(mdev->mr.key);
wmb();
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 3/9] cxgb4: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
2011-10-10 11:11 ` [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length Ian Campbell
2011-10-10 11:11 ` [PATCH 2/9] mlx4: convert to SKB paged frag API Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 4/9] cxgb4vf: " Ian Campbell
` (6 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell, Dimitris Michailidis
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Dimitris Michailidis <dm@chelsio.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 +-
drivers/net/ethernet/chelsio/cxgb4/sge.c | 33 ++++++++++++++-------------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 223a7f7..209cd69 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -326,7 +326,7 @@ struct sge_fl { /* SGE free-buffer queue state */
/* A packet gather list */
struct pkt_gl {
- skb_frag_t frags[MAX_SKB_FRAGS];
+ struct subpage frags[MAX_SKB_FRAGS];
void *va; /* virtual address of first byte */
unsigned int nfrags; /* # of fragments */
unsigned int tot_len; /* total length of fragments */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 56adf44..0100c4c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -215,8 +215,8 @@ static int map_skb(struct device *dev, const struct sk_buff *skb,
end = &si->frags[si->nr_frags];
for (fp = si->frags; fp < end; fp++) {
- *++addr = dma_map_page(dev, fp->page, fp->page_offset, fp->size,
- DMA_TO_DEVICE);
+ *++addr = skb_frag_dma_map(dev, fp, 0, fp->size,
+ DMA_TO_DEVICE);
if (dma_mapping_error(dev, *addr))
goto unwind;
}
@@ -1409,22 +1409,23 @@ int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb)
}
EXPORT_SYMBOL(cxgb4_ofld_send);
-static inline void copy_frags(struct skb_shared_info *ssi,
+static inline void copy_frags(struct sk_buff *skb,
const struct pkt_gl *gl, unsigned int offset)
{
- unsigned int n;
+ int i;
/* usually there's just one frag */
- ssi->frags[0].page = gl->frags[0].page;
- ssi->frags[0].page_offset = gl->frags[0].page_offset + offset;
- ssi->frags[0].size = gl->frags[0].size - offset;
- ssi->nr_frags = gl->nfrags;
- n = gl->nfrags - 1;
- if (n)
- memcpy(&ssi->frags[1], &gl->frags[1], n * sizeof(skb_frag_t));
+ __skb_fill_page_desc(skb, 0, gl->frags[0].page,
+ gl->frags[0].page_offset + offset,
+ gl->frags[0].size - offset);
+ skb_shinfo(skb)->nr_frags = gl->nfrags;
+ for (i = 1; i < gl->nfrags; i++)
+ __skb_fill_page_desc(skb, i, gl->frags[i].page,
+ gl->frags[i].page_offset,
+ gl->frags[i].size);
/* get a reference to the last page, we don't own it */
- get_page(gl->frags[n].page);
+ get_page(gl->frags[gl->nfrags - 1].page);
}
/**
@@ -1459,7 +1460,7 @@ struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl,
__skb_put(skb, pull_len);
skb_copy_to_linear_data(skb, gl->va, pull_len);
- copy_frags(skb_shinfo(skb), gl, pull_len);
+ copy_frags(skb, gl, pull_len);
skb->len = gl->tot_len;
skb->data_len = skb->len - pull_len;
skb->truesize += skb->data_len;
@@ -1478,7 +1479,7 @@ EXPORT_SYMBOL(cxgb4_pktgl_to_skb);
static void t4_pktgl_free(const struct pkt_gl *gl)
{
int n;
- const skb_frag_t *p;
+ const struct subpage *p;
for (p = gl->frags, n = gl->nfrags - 1; n--; p++)
put_page(p->page);
@@ -1522,7 +1523,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
return;
}
- copy_frags(skb_shinfo(skb), gl, RX_PKT_PAD);
+ copy_frags(skb, gl, RX_PKT_PAD);
skb->len = gl->tot_len - RX_PKT_PAD;
skb->data_len = skb->len;
skb->truesize += skb->data_len;
@@ -1698,7 +1699,7 @@ static int process_responses(struct sge_rspq *q, int budget)
rmb();
rsp_type = RSPD_TYPE(rc->type_gen);
if (likely(rsp_type == RSP_TYPE_FLBUF)) {
- skb_frag_t *fp;
+ struct subpage *fp;
struct pkt_gl si;
const struct rx_sw_desc *rsd;
u32 len = ntohl(rc->pldbuflen_qid), bufsz, frags;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 4/9] cxgb4vf: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (2 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 3/9] cxgb4: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 5/9] cxgbi: " Ian Campbell
` (5 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell, Casey Leedom
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Casey Leedom <leedom@chelsio.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | 2 +-
drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 80 ++++++++++--------------
2 files changed, 35 insertions(+), 47 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
index 594334d..a9f2e34 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
@@ -144,7 +144,7 @@ struct sge_fl {
* An ingress packet gather list.
*/
struct pkt_gl {
- skb_frag_t frags[MAX_SKB_FRAGS];
+ struct subpage frags[MAX_SKB_FRAGS];
void *va; /* virtual address of first byte */
unsigned int nfrags; /* # of fragments */
unsigned int tot_len; /* total length of fragments */
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index cffb328..27f3134 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -296,8 +296,8 @@ static int map_skb(struct device *dev, const struct sk_buff *skb,
si = skb_shinfo(skb);
end = &si->frags[si->nr_frags];
for (fp = si->frags; fp < end; fp++) {
- *++addr = dma_map_page(dev, fp->page, fp->page_offset, fp->size,
- DMA_TO_DEVICE);
+ *++addr = skb_frag_dma_map(dev, fp, 0, fp->size,
+ DMA_TO_DEVICE);
if (dma_mapping_error(dev, *addr))
goto unwind;
}
@@ -1357,6 +1357,35 @@ out_free:
}
/**
+ * copy_frags - copy fragments from gather list into skb_shared_info
+ * @si: destination skb shared info structure
+ * @gl: source internal packet gather list
+ * @offset: packet start offset in first page
+ *
+ * Copy an internal packet gather list into a Linux skb_shared_info
+ * structure.
+ */
+static inline void copy_frags(struct sk_buff *skb,
+ const struct pkt_gl *gl,
+ unsigned int offset)
+{
+ int i;
+
+ /* usually there's just one frag */
+ __skb_fill_page_desc(skb, 0, gl->frags[0].page,
+ gl->frags[0].page_offset + offset,
+ gl->frags[0].size - offset);
+ skb_shinfo(skb)->nr_frags = gl->nfrags;
+ for (i = 1; i < gl->nfrags; i++)
+ __skb_fill_page_desc(skb, i, gl->frags[i].page,
+ gl->frags[i].page_offset,
+ gl->frags[i].size);
+
+ /* get a reference to the last page, we don't own it */
+ get_page(gl->frags[gl->nfrags - 1].page);
+}
+
+/**
* t4vf_pktgl_to_skb - build an sk_buff from a packet gather list
* @gl: the gather list
* @skb_len: size of sk_buff main body if it carries fragments
@@ -1369,7 +1398,6 @@ struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl,
unsigned int skb_len, unsigned int pull_len)
{
struct sk_buff *skb;
- struct skb_shared_info *ssi;
/*
* If the ingress packet is small enough, allocate an skb large enough
@@ -1396,21 +1424,10 @@ struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl,
__skb_put(skb, pull_len);
skb_copy_to_linear_data(skb, gl->va, pull_len);
- ssi = skb_shinfo(skb);
- ssi->frags[0].page = gl->frags[0].page;
- ssi->frags[0].page_offset = gl->frags[0].page_offset + pull_len;
- ssi->frags[0].size = gl->frags[0].size - pull_len;
- if (gl->nfrags > 1)
- memcpy(&ssi->frags[1], &gl->frags[1],
- (gl->nfrags-1) * sizeof(skb_frag_t));
- ssi->nr_frags = gl->nfrags;
-
+ copy_frags(skb, gl, pull_len);
skb->len = gl->tot_len;
skb->data_len = skb->len - pull_len;
skb->truesize += skb->data_len;
-
- /* Get a reference for the last page, we don't own it */
- get_page(gl->frags[gl->nfrags - 1].page);
}
out:
@@ -1434,35 +1451,6 @@ void t4vf_pktgl_free(const struct pkt_gl *gl)
}
/**
- * copy_frags - copy fragments from gather list into skb_shared_info
- * @si: destination skb shared info structure
- * @gl: source internal packet gather list
- * @offset: packet start offset in first page
- *
- * Copy an internal packet gather list into a Linux skb_shared_info
- * structure.
- */
-static inline void copy_frags(struct skb_shared_info *si,
- const struct pkt_gl *gl,
- unsigned int offset)
-{
- unsigned int n;
-
- /* usually there's just one frag */
- si->frags[0].page = gl->frags[0].page;
- si->frags[0].page_offset = gl->frags[0].page_offset + offset;
- si->frags[0].size = gl->frags[0].size - offset;
- si->nr_frags = gl->nfrags;
-
- n = gl->nfrags - 1;
- if (n)
- memcpy(&si->frags[1], &gl->frags[1], n * sizeof(skb_frag_t));
-
- /* get a reference to the last page, we don't own it */
- get_page(gl->frags[n].page);
-}
-
-/**
* do_gro - perform Generic Receive Offload ingress packet processing
* @rxq: ingress RX Ethernet Queue
* @gl: gather list for ingress packet
@@ -1484,7 +1472,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
return;
}
- copy_frags(skb_shinfo(skb), gl, PKTSHIFT);
+ copy_frags(skb, gl, PKTSHIFT);
skb->len = gl->tot_len - PKTSHIFT;
skb->data_len = skb->len;
skb->truesize += skb->data_len;
@@ -1667,7 +1655,7 @@ int process_responses(struct sge_rspq *rspq, int budget)
rmb();
rsp_type = RSPD_TYPE(rc->type_gen);
if (likely(rsp_type == RSP_TYPE_FLBUF)) {
- skb_frag_t *fp;
+ struct subpage *fp;
struct pkt_gl gl;
const struct rx_sw_desc *sdesc;
u32 bufsz, frag;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 5/9] cxgbi: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (3 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 4/9] cxgb4vf: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 6/9] ehea: " Ian Campbell
` (4 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev
Cc: Ian Campbell, James E.J. Bottomley, David S. Miller,
Mike Christie, James Bottomley, Karen Xie, linux-scsi
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: James Bottomley <James.Bottomley@suse.de>
Cc: Karen Xie <kxie@chelsio.com>
Cc: linux-scsi@vger.kernel.org
Cc: netdev@vger.kernel.org
---
drivers/scsi/cxgbi/libcxgbi.c | 16 +++++++++-------
drivers/scsi/cxgbi/libcxgbi.h | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 77ac217..628b23d 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1787,7 +1787,7 @@ static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt,
}
static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
- unsigned int dlen, skb_frag_t *frags,
+ unsigned int dlen, struct subpage *frags,
int frag_max)
{
unsigned int datalen = dlen;
@@ -1944,7 +1944,7 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
if (tdata->nr_frags > MAX_SKB_FRAGS ||
(padlen && tdata->nr_frags == MAX_SKB_FRAGS)) {
char *dst = skb->data + task->hdr_len;
- skb_frag_t *frag = tdata->frags;
+ struct subpage *frag = tdata->frags;
/* data fits in the skb's headroom */
for (i = 0; i < tdata->nr_frags; i++, frag++) {
@@ -1962,11 +1962,13 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
skb_put(skb, count + padlen);
} else {
/* data fit into frag_list */
- for (i = 0; i < tdata->nr_frags; i++)
- get_page(tdata->frags[i].page);
-
- memcpy(skb_shinfo(skb)->frags, tdata->frags,
- sizeof(skb_frag_t) * tdata->nr_frags);
+ for (i = 0; i < tdata->nr_frags; i++) {
+ __skb_fill_page_desc(skb, i,
+ tdata->frags[i].page,
+ tdata->frags[i].page_offset,
+ tdata->frags[i].size);
+ skb_frag_ref(skb, i);
+ }
skb_shinfo(skb)->nr_frags = tdata->nr_frags;
skb->len += count;
skb->data_len += count;
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 9267844..9406759 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -574,7 +574,7 @@ struct cxgbi_endpoint {
#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
struct cxgbi_task_data {
unsigned short nr_frags;
- skb_frag_t frags[MAX_PDU_FRAGS];
+ struct subpage frags[MAX_PDU_FRAGS];
struct sk_buff *skb;
unsigned int offset;
unsigned int count;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 6/9] ehea: convert to SKB paged frag API
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (4 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 5/9] cxgbi: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 7/9] emac: " Ian Campbell
` (3 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell, Breno Leitao
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/ibm/ehea/ehea_main.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index c821cb6..dfefe80 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -1817,8 +1817,7 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
sg1entry->l_key = lkey;
sg1entry->len = frag->size;
sg1entry->vaddr =
- ehea_map_vaddr(page_address(frag->page)
- + frag->page_offset);
+ ehea_map_vaddr(skb_frag_address(frag));
swqe->descriptors++;
sg1entry_contains_frag_data = 1;
}
@@ -1830,9 +1829,7 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
sgentry->l_key = lkey;
sgentry->len = frag->size;
- sgentry->vaddr =
- ehea_map_vaddr(page_address(frag->page)
- + frag->page_offset);
+ sgentry->vaddr = ehea_map_vaddr(skb_frag_address(frag));
swqe->descriptors++;
}
}
@@ -2222,9 +2219,7 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
/* ... then copy data from the fragments */
for (i = 0; i < nfrags; i++) {
frag = &skb_shinfo(skb)->frags[i];
- memcpy(imm_data,
- page_address(frag->page) + frag->page_offset,
- frag->size);
+ memcpy(imm_data, skb_frag_address(frag), frag->size);
imm_data += frag->size;
}
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 7/9] emac: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (5 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 6/9] ehea: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 8/9] ll_temac: " Ian Campbell
` (2 subsequent siblings)
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/ibm/emac/core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index a573df1..6b3a033 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -1458,8 +1458,8 @@ static int emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev)
if (unlikely(dev->tx_cnt + mal_tx_chunks(len) >= NUM_TX_BUFF))
goto undo_frame;
- pd = dma_map_page(&dev->ofdev->dev, frag->page, frag->page_offset, len,
- DMA_TO_DEVICE);
+ pd = skb_frag_dma_map(&dev->ofdev->dev, frag, 0, len,
+ DMA_TO_DEVICE);
slot = emac_xmit_split(dev, slot, pd, len, i == nr_frags - 1,
ctrl);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 8/9] ll_temac: convert to SKB paged frag API.
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (6 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 7/9] emac: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 11:11 ` [PATCH 9/9] net: add opaque struct around skb frag page Ian Campbell
2011-10-10 18:20 ` [PATCH 0/9] skb fragment API: convert network drivers (part V) David Miller
9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: netdev@vger.kernel.org
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 570776e..66e3c36 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -715,8 +715,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
cur_p->phys = dma_map_single(ndev->dev.parent,
- (void *)page_address(frag->page) +
- frag->page_offset,
+ skb_frag_address(frag),
frag->size, DMA_TO_DEVICE);
cur_p->len = frag->size;
cur_p->app0 = 0;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 9/9] net: add opaque struct around skb frag page
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (7 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 8/9] ll_temac: " Ian Campbell
@ 2011-10-10 11:11 ` Ian Campbell
2011-10-10 15:09 ` Eric Dumazet
2011-10-10 18:20 ` [PATCH 0/9] skb fragment API: convert network drivers (part V) David Miller
9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
To: netdev; +Cc: Ian Campbell
I've split this bit out of the skb frag destructor patch since it helps enforce
the use of the fragment API.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
include/linux/skbuff.h | 10 ++++++----
net/core/skbuff.c | 6 +++---
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ac6b05a..f881d75 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -135,7 +135,9 @@ struct sk_buff;
typedef struct skb_frag_struct skb_frag_t;
struct skb_frag_struct {
- struct page *page;
+ struct {
+ struct page *p;
+ } page;
#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
__u32 page_offset;
__u32 size;
@@ -1149,7 +1151,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
{
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
- frag->page = page;
+ frag->page.p = page;
frag->page_offset = off;
frag->size = size;
}
@@ -1673,7 +1675,7 @@ static inline void netdev_free_page(struct net_device *dev, struct page *page)
*/
static inline struct page *skb_frag_page(const skb_frag_t *frag)
{
- return frag->page;
+ return frag->page.p;
}
/**
@@ -1759,7 +1761,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag)
*/
static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
{
- frag->page = page;
+ frag->page.p = page;
__skb_frag_ref(frag);
}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5b2c5f1..6305076 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -657,14 +657,14 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)
/* skb frags release userspace buffers */
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
- put_page(skb_shinfo(skb)->frags[i].page);
+ skb_frag_unref(skb, i);
uarg->callback(uarg);
/* skb frags point to kernel buffers */
for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) {
- skb_shinfo(skb)->frags[i - 1].page_offset = 0;
- skb_shinfo(skb)->frags[i - 1].page = head;
+ __skb_fill_page_desc(skb, i-1, head, 0,
+ skb_shinfo(skb)->frags[i - 1].size);
head = (struct page *)head->private;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH 9/9] net: add opaque struct around skb frag page
2011-10-10 11:11 ` [PATCH 9/9] net: add opaque struct around skb frag page Ian Campbell
@ 2011-10-10 15:09 ` Eric Dumazet
2011-10-10 15:13 ` Ian Campbell
0 siblings, 1 reply; 23+ messages in thread
From: Eric Dumazet @ 2011-10-10 15:09 UTC (permalink / raw)
To: Ian Campbell; +Cc: netdev
Le lundi 10 octobre 2011 à 12:11 +0100, Ian Campbell a écrit :
> I've split this bit out of the skb frag destructor patch since it helps enforce
> the use of the fragment API.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> include/linux/skbuff.h | 10 ++++++----
> net/core/skbuff.c | 6 +++---
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index ac6b05a..f881d75 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -135,7 +135,9 @@ struct sk_buff;
> typedef struct skb_frag_struct skb_frag_t;
>
> struct skb_frag_struct {
> - struct page *page;
> + struct {
> + struct page *p;
> + } page;
Oh well, why dont you rename page to something else, say frag_page ?
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 9/9] net: add opaque struct around skb frag page
2011-10-10 15:09 ` Eric Dumazet
@ 2011-10-10 15:13 ` Ian Campbell
0 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 15:13 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev@vger.kernel.org
On Mon, 2011-10-10 at 16:09 +0100, Eric Dumazet wrote:
> Le lundi 10 octobre 2011 à 12:11 +0100, Ian Campbell a écrit :
> > I've split this bit out of the skb frag destructor patch since it helps enforce
> > the use of the fragment API.
> >
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> > include/linux/skbuff.h | 10 ++++++----
> > net/core/skbuff.c | 6 +++---
> > 2 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index ac6b05a..f881d75 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -135,7 +135,9 @@ struct sk_buff;
> > typedef struct skb_frag_struct skb_frag_t;
> >
> > struct skb_frag_struct {
> > - struct page *page;
> > + struct {
> > + struct page *p;
> > + } page;
>
> Oh well, why dont you rename page to something else, say frag_page ?
I looked at renaming this field and the impact was far larger than this
(already huge) set of series.
Keeping the name for the outer struct also has the nice property that
when the struct becomes something like:
struct {
struct page *p;
struct skb_frag_destructor *destr;
} page;
existing code which does
fraga->page = fragb->page
will carry the destructor along magically without needing modification.
Ian.
>
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 11:11 [PATCH 0/9] skb fragment API: convert network drivers (part V) Ian Campbell
` (8 preceding siblings ...)
2011-10-10 11:11 ` [PATCH 9/9] net: add opaque struct around skb frag page Ian Campbell
@ 2011-10-10 18:20 ` David Miller
2011-10-10 18:52 ` Eric Dumazet
9 siblings, 1 reply; 23+ messages in thread
From: David Miller @ 2011-10-10 18:20 UTC (permalink / raw)
To: Ian.Campbell; +Cc: netdev, linux-scsi, linux-mm
From: Ian Campbell <Ian.Campbell@citrix.com>
Date: Mon, 10 Oct 2011 12:11:16 +0100
> I think "struct subpage" is a generally useful tuple I added to a
> central location (mm_types.h) rather than somewhere networking or driver
> specific but I can trivially move if preferred.
I'm fine with the patch series, but this generic datastructure
addition needs some feedback first.
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 18:20 ` [PATCH 0/9] skb fragment API: convert network drivers (part V) David Miller
@ 2011-10-10 18:52 ` Eric Dumazet
2011-10-10 19:16 ` David Miller
2011-10-10 19:17 ` Ian Campbell
0 siblings, 2 replies; 23+ messages in thread
From: Eric Dumazet @ 2011-10-10 18:52 UTC (permalink / raw)
To: David Miller; +Cc: Ian.Campbell, netdev, linux-scsi, linux-mm
Le lundi 10 octobre 2011 à 14:20 -0400, David Miller a écrit :
> From: Ian Campbell <Ian.Campbell@citrix.com>
> Date: Mon, 10 Oct 2011 12:11:16 +0100
>
> > I think "struct subpage" is a generally useful tuple I added to a
> > central location (mm_types.h) rather than somewhere networking or driver
> > specific but I can trivially move if preferred.
>
> I'm fine with the patch series, but this generic datastructure
> addition needs some feedback first.
I was planning to send a patch to abstract frag->size manipulation and
ease upcoming truesize certification work.
static inline int skb_frag_size(const skb_frag_t *frag)
{
return frag->size;
}
static inline void skb_frag_size_set(skb_frag_t *frag, int size)
{
frag->size = size;
}
static inline void skb_frag_size_add(skb_frag_t *frag, int size)
{
frag->size += size;
}
static inline void skb_frag_size_sub(skb_frag_t *frag, int size)
{
frag->size -= size;
}
Is it OK if I send a single patch right now ?
I am asking because it might clash a bit with Ian work.
drivers/atm/eni.c | 2
drivers/infiniband/hw/amso1100/c2.c | 4
drivers/infiniband/hw/nes/nes_nic.c | 10 -
drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2
drivers/infiniband/ulp/ipoib/ipoib_ib.c | 18 +-
drivers/net/ethernet/3com/3c59x.c | 6
drivers/net/ethernet/3com/typhoon.c | 6
drivers/net/ethernet/adaptec/starfire.c | 8 -
drivers/net/ethernet/aeroflex/greth.c | 8 -
drivers/net/ethernet/alteon/acenic.c | 10 -
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 6
drivers/net/ethernet/atheros/atlx/atl1.c | 12 -
drivers/net/ethernet/broadcom/bnx2.c | 12 -
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 14 -
drivers/net/ethernet/broadcom/tg3.c | 8 -
drivers/net/ethernet/brocade/bna/bnad.c | 6
drivers/net/ethernet/chelsio/cxgb/sge.c | 10 -
drivers/net/ethernet/chelsio/cxgb3/sge.c | 12 -
drivers/net/ethernet/chelsio/cxgb4/sge.c | 26 +--
drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 26 +--
drivers/net/ethernet/cisco/enic/enic_main.c | 12 -
drivers/net/ethernet/emulex/benet/be_main.c | 18 +-
drivers/net/ethernet/ibm/ehea/ehea_main.c | 8 -
drivers/net/ethernet/ibm/emac/core.c | 2
drivers/net/ethernet/ibm/ibmveth.c | 6
drivers/net/ethernet/intel/e1000/e1000_main.c | 6
drivers/net/ethernet/intel/e1000e/netdev.c | 6
drivers/net/ethernet/intel/igb/igb_main.c | 2
drivers/net/ethernet/intel/igbvf/netdev.c | 4
drivers/net/ethernet/intel/ixgb/ixgb_main.c | 4
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 6
drivers/net/ethernet/jme.c | 4
drivers/net/ethernet/marvell/mv643xx_eth.c | 9 -
drivers/net/ethernet/marvell/skge.c | 8 -
drivers/net/ethernet/marvell/sky2.c | 16 +-
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 14 -
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 12 -
drivers/net/ethernet/micrel/ksz884x.c | 2
drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 14 -
drivers/net/ethernet/natsemi/ns83820.c | 4
drivers/net/ethernet/neterion/s2io.c | 12 -
drivers/net/ethernet/neterion/vxge/vxge-main.c | 12 -
drivers/net/ethernet/nvidia/forcedeth.c | 18 +-
drivers/net/ethernet/pasemi/pasemi_mac.c | 8 -
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 6
drivers/net/ethernet/qlogic/qla3xxx.c | 6
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 6
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 6
drivers/net/ethernet/realtek/8139cp.c | 4
drivers/net/ethernet/realtek/r8169.c | 4
drivers/net/ethernet/sfc/rx.c | 2
drivers/net/ethernet/sfc/tx.c | 8 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4
drivers/net/ethernet/sun/cassini.c | 8 -
drivers/net/ethernet/sun/niu.c | 6
drivers/net/ethernet/sun/sungem.c | 4
drivers/net/ethernet/sun/sunhme.c | 4
drivers/net/ethernet/tehuti/tehuti.c | 6
drivers/net/ethernet/tile/tilepro.c | 2
drivers/net/ethernet/tundra/tsi108_eth.c | 6
drivers/net/ethernet/via/via-velocity.c | 6
drivers/net/ethernet/xilinx/ll_temac_main.c | 4
drivers/net/virtio_net.c | 8 -
drivers/net/vmxnet3/vmxnet3_drv.c | 12 -
drivers/net/xen-netback/netback.c | 4
drivers/net/xen-netfront.c | 4
drivers/scsi/cxgbi/libcxgbi.c | 10 -
drivers/scsi/fcoe/fcoe_transport.c | 2
drivers/staging/hv/netvsc_drv.c | 4
include/linux/skbuff.h | 28 +++
net/appletalk/ddp.c | 5
net/core/datagram.c | 16 +-
net/core/dev.c | 6
net/core/pktgen.c | 12 -
net/core/skbuff.c | 72 +++++-----
net/core/user_dma.c | 4
net/ipv4/inet_lro.c | 8 -
net/ipv4/ip_fragment.c | 4
net/ipv4/ip_output.c | 6
net/ipv4/tcp.c | 9 -
net/ipv4/tcp_output.c | 8 -
net/ipv6/ip6_output.c | 5
net/ipv6/netfilter/nf_conntrack_reasm.c | 4
net/ipv6/reassembly.c | 4
net/xfrm/xfrm_ipcomp.c | 2
87 files changed, 389 insertions(+), 359 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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 [flat|nested] 23+ messages in thread* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 18:52 ` Eric Dumazet
@ 2011-10-10 19:16 ` David Miller
2011-10-10 19:17 ` Ian Campbell
1 sibling, 0 replies; 23+ messages in thread
From: David Miller @ 2011-10-10 19:16 UTC (permalink / raw)
To: eric.dumazet; +Cc: Ian.Campbell, netdev, linux-scsi, linux-mm
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 10 Oct 2011 20:52:11 +0200
> Is it OK if I send a single patch right now ?
>
> I am asking because it might clash a bit with Ian work.
Feel free to do so, we'll sort it out somehow.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 18:52 ` Eric Dumazet
2011-10-10 19:16 ` David Miller
@ 2011-10-10 19:17 ` Ian Campbell
2011-10-10 19:18 ` David Miller
1 sibling, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2011-10-10 19:17 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, netdev@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-mm@kvack.org
On Mon, 2011-10-10 at 19:52 +0100, Eric Dumazet wrote:
> Le lundi 10 octobre 2011 à 14:20 -0400, David Miller a écrit :
> > From: Ian Campbell <Ian.Campbell@citrix.com>
> > Date: Mon, 10 Oct 2011 12:11:16 +0100
> >
> > > I think "struct subpage" is a generally useful tuple I added to a
> > > central location (mm_types.h) rather than somewhere networking or driver
> > > specific but I can trivially move if preferred.
> >
> > I'm fine with the patch series, but this generic datastructure
> > addition needs some feedback first.
Sure. Would you take patches 6, 7 & 8 now? They don't rely on the new
struct.
> I was planning to send a patch to abstract frag->size manipulation and
> ease upcoming truesize certification work.
[...]
> Is it OK if I send a single patch right now ?
>
> I am asking because it might clash a bit with Ian work.
FWIW it's fine with me, there is only the half dozen or so drivers in
this series left to convert and I can rebase pretty easily.
Ian.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 19:17 ` Ian Campbell
@ 2011-10-10 19:18 ` David Miller
2011-10-10 19:42 ` Eric Dumazet
0 siblings, 1 reply; 23+ messages in thread
From: David Miller @ 2011-10-10 19:18 UTC (permalink / raw)
To: Ian.Campbell; +Cc: eric.dumazet, netdev, linux-scsi, linux-mm
From: Ian Campbell <Ian.Campbell@citrix.com>
Date: Mon, 10 Oct 2011 20:17:04 +0100
> On Mon, 2011-10-10 at 19:52 +0100, Eric Dumazet wrote:
>> Le lundi 10 octobre 2011 à 14:20 -0400, David Miller a écrit :
>> > From: Ian Campbell <Ian.Campbell@citrix.com>
>> > Date: Mon, 10 Oct 2011 12:11:16 +0100
>> >
>> > > I think "struct subpage" is a generally useful tuple I added to a
>> > > central location (mm_types.h) rather than somewhere networking or driver
>> > > specific but I can trivially move if preferred.
>> >
>> > I'm fine with the patch series, but this generic datastructure
>> > addition needs some feedback first.
>
> Sure. Would you take patches 6, 7 & 8 now? They don't rely on the new
> struct.
I'll do that right now, thanks Ian.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 0/9] skb fragment API: convert network drivers (part V)
2011-10-10 19:18 ` David Miller
@ 2011-10-10 19:42 ` Eric Dumazet
0 siblings, 0 replies; 23+ messages in thread
From: Eric Dumazet @ 2011-10-10 19:42 UTC (permalink / raw)
To: David Miller; +Cc: Ian.Campbell, netdev, linux-scsi, linux-mm
Le lundi 10 octobre 2011 à 15:18 -0400, David Miller a écrit :
> From: Ian Campbell <Ian.Campbell@citrix.com>
> Date: Mon, 10 Oct 2011 20:17:04 +0100
>
> > On Mon, 2011-10-10 at 19:52 +0100, Eric Dumazet wrote:
> >> Le lundi 10 octobre 2011 à 14:20 -0400, David Miller a écrit :
> >> > From: Ian Campbell <Ian.Campbell@citrix.com>
> >> > Date: Mon, 10 Oct 2011 12:11:16 +0100
> >> >
> >> > > I think "struct subpage" is a generally useful tuple I added to a
> >> > > central location (mm_types.h) rather than somewhere networking or driver
> >> > > specific but I can trivially move if preferred.
> >> >
> >> > I'm fine with the patch series, but this generic datastructure
> >> > addition needs some feedback first.
> >
> > Sure. Would you take patches 6, 7 & 8 now? They don't rely on the new
> > struct.
>
> I'll do that right now, thanks Ian.
I'll respin my patch once your tree is pushed.
Thanks
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 23+ messages in thread