Commit 02e6fd3e authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

mlx4: factorize page_address() calls

We need to compute the frame virtual address at different points.
Do it once.

Following patch will use the new va address for validate_loopback()
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e8c0395
...@@ -734,9 +734,10 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -734,9 +734,10 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
/* Process all completed CQEs */ /* Process all completed CQEs */
while (XNOR(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK, while (XNOR(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK,
cq->mcq.cons_index & cq->size)) { cq->mcq.cons_index & cq->size)) {
void *va;
frags = ring->rx_info + (index << priv->log_rx_info); frags = ring->rx_info + (index << priv->log_rx_info);
va = page_address(frags[0].page) + frags[0].page_offset;
/* /*
* make sure we read the CQE after we read the ownership bit * make sure we read the CQE after we read the ownership bit
*/ */
...@@ -759,7 +760,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -759,7 +760,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
* and not performing the selftest or flb disabled * and not performing the selftest or flb disabled
*/ */
if (priv->flags & MLX4_EN_FLAG_RX_FILTER_NEEDED) { if (priv->flags & MLX4_EN_FLAG_RX_FILTER_NEEDED) {
struct ethhdr *ethh; const struct ethhdr *ethh = va;
dma_addr_t dma; dma_addr_t dma;
/* Get pointer to first fragment since we haven't /* Get pointer to first fragment since we haven't
* skb yet and cast it to ethhdr struct * skb yet and cast it to ethhdr struct
...@@ -767,8 +768,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -767,8 +768,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
dma = frags[0].dma + frags[0].page_offset; dma = frags[0].dma + frags[0].page_offset;
dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh),
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
ethh = (struct ethhdr *)(page_address(frags[0].page) +
frags[0].page_offset);
if (is_multicast_ether_addr(ethh->h_dest)) { if (is_multicast_ether_addr(ethh->h_dest)) {
struct mlx4_mac_entry *entry; struct mlx4_mac_entry *entry;
...@@ -808,8 +807,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -808,8 +807,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
priv->frag_info[0].frag_size, priv->frag_info[0].frag_size,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
xdp.data_hard_start = page_address(frags[0].page); xdp.data_hard_start = va - frags[0].page_offset;
xdp.data = xdp.data_hard_start + frags[0].page_offset; xdp.data = va;
xdp.data_end = xdp.data + length; xdp.data_end = xdp.data + length;
orig_data = xdp.data; orig_data = xdp.data;
...@@ -819,6 +818,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -819,6 +818,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
length = xdp.data_end - xdp.data; length = xdp.data_end - xdp.data;
frags[0].page_offset = xdp.data - frags[0].page_offset = xdp.data -
xdp.data_hard_start; xdp.data_hard_start;
va = xdp.data;
} }
switch (act) { switch (act) {
...@@ -891,7 +891,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -891,7 +891,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
goto next; goto next;
if (ip_summed == CHECKSUM_COMPLETE) { if (ip_summed == CHECKSUM_COMPLETE) {
void *va = skb_frag_address(skb_shinfo(gro_skb)->frags);
if (check_csum(cqe, gro_skb, va, if (check_csum(cqe, gro_skb, va,
dev->features)) { dev->features)) {
ip_summed = CHECKSUM_NONE; ip_summed = CHECKSUM_NONE;
...@@ -955,7 +954,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ...@@ -955,7 +954,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
} }
if (ip_summed == CHECKSUM_COMPLETE) { if (ip_summed == CHECKSUM_COMPLETE) {
if (check_csum(cqe, skb, skb->data, dev->features)) { if (check_csum(cqe, skb, va, dev->features)) {
ip_summed = CHECKSUM_NONE; ip_summed = CHECKSUM_NONE;
ring->csum_complete--; ring->csum_complete--;
ring->csum_none++; ring->csum_none++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment