Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278780
b: refs/heads/master
c: 5b4c4d3
h: refs/heads/master
v: v3
  • Loading branch information
Eugenia Emantayev authored and David S. Miller committed Dec 13, 2011
1 parent 8488a52 commit 8f2e778
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ffe455ad04681f3fc48eef595fe526a795f809a3
refs/heads/master: 5b4c4d36860ef1c411d0669ffc15090417a33389
15 changes: 15 additions & 0 deletions trunk/drivers/net/ethernet/mellanox/mlx4/en_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
unsigned int length;
int polled = 0;
int ip_summed;
struct ethhdr *ethh;
u64 s_mac;

if (!priv->port_up)
return 0;
Expand Down Expand Up @@ -577,6 +579,19 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
goto next;
}

/* Get pointer to first fragment since we haven't skb yet and
* cast it to ethhdr struct */
ethh = (struct ethhdr *)(page_address(skb_frags[0].page) +
skb_frags[0].offset);
s_mac = mlx4_en_mac_to_u64(ethh->h_source);

/* If source MAC is equal to our own MAC and not performing
* the selftest or flb disabled - drop the packet */
if (s_mac == priv->mac &&
(!(dev->features & NETIF_F_LOOPBACK) ||
!priv->validate_loopback))
goto next;

/*
* Packet is OK - process it.
*/
Expand Down
20 changes: 9 additions & 11 deletions trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,17 +688,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
ring->tx_csum++;
}

if (unlikely(priv->validate_loopback)) {
/* Copy dst mac address to wqe */
skb_reset_mac_header(skb);
ethh = eth_hdr(skb);
if (ethh && ethh->h_dest) {
mac = mlx4_en_mac_to_u64(ethh->h_dest);
mac_h = (u32) ((mac & 0xffff00000000ULL) >> 16);
mac_l = (u32) (mac & 0xffffffff);
tx_desc->ctrl.srcrb_flags |= cpu_to_be32(mac_h);
tx_desc->ctrl.imm = cpu_to_be32(mac_l);
}
/* Copy dst mac address to wqe */
skb_reset_mac_header(skb);
ethh = eth_hdr(skb);
if (ethh && ethh->h_dest) {
mac = mlx4_en_mac_to_u64(ethh->h_dest);
mac_h = (u32) ((mac & 0xffff00000000ULL) >> 16);
mac_l = (u32) (mac & 0xffffffff);
tx_desc->ctrl.srcrb_flags |= cpu_to_be32(mac_h);
tx_desc->ctrl.imm = cpu_to_be32(mac_l);
}

/* Handle LSO (TSO) packets */
Expand Down

0 comments on commit 8f2e778

Please sign in to comment.