Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214309
b: refs/heads/master
c: 0c26b67
h: refs/heads/master
i:
  214307: d8ee67a
v: v3
  • Loading branch information
Santiago Leon authored and David S. Miller committed Sep 7, 2010
1 parent 72c19a4 commit ded2387
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e8ab30ec677925e8999a9f5bdb028736d22d48c
refs/heads/master: 0c26b6775f36ce447722e8752bc3a006ec832df3
21 changes: 21 additions & 0 deletions trunk/drivers/net/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ module_param(rx_copybreak, uint, 0644);
MODULE_PARM_DESC(rx_copybreak,
"Maximum size of packet that is copied to a new buffer on receive");

static unsigned int rx_flush __read_mostly = 0;
module_param(rx_flush, uint, 0644);
MODULE_PARM_DESC(rx_flush, "Flush receive buffers before use");

struct ibmveth_stat {
char name[ETH_GSTRING_LEN];
int offset;
Expand Down Expand Up @@ -234,6 +238,14 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool)
return 0;
}

static inline void ibmveth_flush_buffer(void *addr, unsigned long length)
{
unsigned long offset;

for (offset = 0; offset < length; offset += SMP_CACHE_BYTES)
asm("dcbfl %0,%1" :: "b" (addr), "r" (offset));
}

/* replenish the buffers for a pool. note that we don't need to
* skb_reserve these since they are used for incoming...
*/
Expand Down Expand Up @@ -286,6 +298,12 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc
desc.fields.flags_len = IBMVETH_BUF_VALID | pool->buff_size;
desc.fields.address = dma_addr;

if (rx_flush) {
unsigned int len = min(pool->buff_size,
adapter->netdev->mtu +
IBMVETH_BUFF_OH);
ibmveth_flush_buffer(skb->data, len);
}
lpar_rc = h_add_logical_lan_buffer(adapter->vdev->unit_address, desc.desc);

if (lpar_rc != H_SUCCESS)
Expand Down Expand Up @@ -1095,6 +1113,9 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
skb_copy_to_linear_data(new_skb,
skb->data + offset,
length);
if (rx_flush)
ibmveth_flush_buffer(skb->data,
length + offset);
skb = new_skb;
ibmveth_rxq_recycle_buffer(adapter);
} else {
Expand Down

0 comments on commit ded2387

Please sign in to comment.