Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6692
b: refs/heads/master
c: db5e871
h: refs/heads/master
v: v3
  • Loading branch information
Michael Ellerman authored and Jeff Garzik committed Sep 1, 2005
1 parent 12a0a7e commit fe714db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 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: e0808494ff44d5cedcaf286bb8a93d08e8d9af49
refs/heads/master: db5e8718eac0b8166d6fd05b1ed7f8114c243988
47 changes: 19 additions & 28 deletions trunk/drivers/net/iseries_veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,41 +938,32 @@ static int veth_transmit_to_one(struct sk_buff *skb, HvLpIndex rlp,
struct veth_port *port = (struct veth_port *) dev->priv;
HvLpEvent_Rc rc;
struct veth_msg *msg = NULL;
int err = 0;
unsigned long flags;

if (! cnx) {
port->stats.tx_errors++;
dev_kfree_skb(skb);
if (! cnx)
return 0;
}

spin_lock_irqsave(&cnx->lock, flags);

if (! (cnx->state & VETH_STATE_READY))
goto drop;
goto no_error;

if ((skb->len - 14) > VETH_MAX_MTU)
if ((skb->len - ETH_HLEN) > VETH_MAX_MTU)
goto drop;

msg = veth_stack_pop(cnx);

if (! msg) {
err = 1;
if (! msg)
goto drop;
}

msg->in_use = 1;
msg->skb = skb_get(skb);

msg->data.addr[0] = dma_map_single(port->dev, skb->data,
skb->len, DMA_TO_DEVICE);

if (dma_mapping_error(msg->data.addr[0]))
goto recycle_and_drop;

/* Is it really necessary to check the length and address
* fields of the first entry here? */
msg->skb = skb;
msg->dev = port->dev;
msg->data.len[0] = skb->len;
msg->data.eofmask = 1 << VETH_EOF_SHIFT;
Expand All @@ -992,43 +983,43 @@ static int veth_transmit_to_one(struct sk_buff *skb, HvLpIndex rlp,
if (veth_stack_is_empty(cnx))
veth_stop_queues(cnx);

no_error:
spin_unlock_irqrestore(&cnx->lock, flags);
return 0;

recycle_and_drop:
/* we free the skb below, so tell veth_recycle_msg() not to. */
msg->skb = NULL;
veth_recycle_msg(cnx, msg);
drop:
port->stats.tx_errors++;
dev_kfree_skb(skb);
spin_unlock_irqrestore(&cnx->lock, flags);
return err;
return 1;
}

static HvLpIndexMap veth_transmit_to_many(struct sk_buff *skb,
static void veth_transmit_to_many(struct sk_buff *skb,
HvLpIndexMap lpmask,
struct net_device *dev)
{
struct veth_port *port = (struct veth_port *) dev->priv;
int i;
int rc;
int i, success, error;

success = error = 0;

for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
if ((lpmask & (1 << i)) == 0)
continue;

rc = veth_transmit_to_one(skb_get(skb), i, dev);
if (! rc)
lpmask &= ~(1<<i);
if (veth_transmit_to_one(skb, i, dev))
error = 1;
else
success = 1;
}

if (! lpmask) {
if (error)
port->stats.tx_errors++;

if (success) {
port->stats.tx_packets++;
port->stats.tx_bytes += skb->len;
}

return lpmask;
}

static int veth_start_xmit(struct sk_buff *skb, struct net_device *dev)
Expand Down

0 comments on commit fe714db

Please sign in to comment.