Skip to content

Commit c08cc3c

Browse files
santildavem330
authored andcommitted
ibmveth: Add tx_copybreak
Use the existing bounce buffer if we send a buffer under a certain size. This saves the overhead of a TCE map/unmap. I can't see any reason for the wmb() in the bounce buffer case, if we need a barrier it will be before we call h_send_logical_lan but we have nothing in the common case. Remove it. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e8cb7eb commit c08cc3c

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

drivers/net/ibmveth.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtual Ethernet Driver");
117117
MODULE_LICENSE("GPL");
118118
MODULE_VERSION(ibmveth_driver_version);
119119

120+
static unsigned int tx_copybreak __read_mostly = 128;
121+
module_param(tx_copybreak, uint, 0644);
122+
MODULE_PARM_DESC(tx_copybreak,
123+
"Maximum size of packet that is copied to a new buffer on transmit");
124+
120125
struct ibmveth_stat {
121126
char name[ETH_GSTRING_LEN];
122127
int offset;
@@ -931,17 +936,24 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
931936
buf[1] = 0;
932937
}
933938

934-
data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
935-
skb->len, DMA_TO_DEVICE);
936-
if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
937-
if (!firmware_has_feature(FW_FEATURE_CMO))
938-
ibmveth_error_printk("tx: unable to map xmit buffer\n");
939+
if (skb->len < tx_copybreak) {
940+
used_bounce = 1;
941+
} else {
942+
data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
943+
skb->len, DMA_TO_DEVICE);
944+
if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
945+
if (!firmware_has_feature(FW_FEATURE_CMO))
946+
ibmveth_error_printk("tx: unable to map "
947+
"xmit buffer\n");
948+
tx_map_failed++;
949+
used_bounce = 1;
950+
}
951+
}
952+
953+
if (used_bounce) {
939954
skb_copy_from_linear_data(skb, adapter->bounce_buffer,
940955
skb->len);
941956
desc.fields.address = adapter->bounce_buffer_dma;
942-
tx_map_failed++;
943-
used_bounce = 1;
944-
wmb();
945957
} else
946958
desc.fields.address = data_dma_addr;
947959

0 commit comments

Comments
 (0)