Commit dc153f85 authored by Aaron Young's avatar Aaron Young Committed by David S. Miller

ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c

  Checkpatch updates for sunvnet.c and sunvnet_common.c.
Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5d01fa0c
...@@ -66,12 +66,14 @@ static void vnet_get_drvinfo(struct net_device *dev, ...@@ -66,12 +66,14 @@ static void vnet_get_drvinfo(struct net_device *dev,
static u32 vnet_get_msglevel(struct net_device *dev) static u32 vnet_get_msglevel(struct net_device *dev)
{ {
struct vnet *vp = netdev_priv(dev); struct vnet *vp = netdev_priv(dev);
return vp->msg_enable; return vp->msg_enable;
} }
static void vnet_set_msglevel(struct net_device *dev, u32 value) static void vnet_set_msglevel(struct net_device *dev, u32 value)
{ {
struct vnet *vp = netdev_priv(dev); struct vnet *vp = netdev_priv(dev);
vp->msg_enable = value; vp->msg_enable = value;
} }
...@@ -359,7 +361,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) ...@@ -359,7 +361,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
INIT_LIST_HEAD(&port->list); INIT_LIST_HEAD(&port->list);
switch_port = 0; switch_port = 0;
if (mdesc_get_property(hp, vdev->mp, "switch-port", NULL) != NULL) if (mdesc_get_property(hp, vdev->mp, "switch-port", NULL))
switch_port = 1; switch_port = 1;
port->switch_port = switch_port; port->switch_port = switch_port;
port->tso = true; port->tso = true;
...@@ -403,7 +405,6 @@ static int vnet_port_remove(struct vio_dev *vdev) ...@@ -403,7 +405,6 @@ static int vnet_port_remove(struct vio_dev *vdev)
struct vnet_port *port = dev_get_drvdata(&vdev->dev); struct vnet_port *port = dev_get_drvdata(&vdev->dev);
if (port) { if (port) {
del_timer_sync(&port->vio.timer); del_timer_sync(&port->vio.timer);
napi_disable(&port->napi); napi_disable(&port->napi);
...@@ -421,7 +422,6 @@ static int vnet_port_remove(struct vio_dev *vdev) ...@@ -421,7 +422,6 @@ static int vnet_port_remove(struct vio_dev *vdev)
dev_set_drvdata(&vdev->dev, NULL); dev_set_drvdata(&vdev->dev, NULL);
kfree(port); kfree(port);
} }
return 0; return 0;
} }
......
...@@ -119,7 +119,6 @@ int sunvnet_send_attr_common(struct vio_driver_state *vio) ...@@ -119,7 +119,6 @@ int sunvnet_send_attr_common(struct vio_driver_state *vio)
pkt.ack_freq, pkt.plnk_updt, pkt.options, pkt.ack_freq, pkt.plnk_updt, pkt.options,
(unsigned long long)pkt.mtu, pkt.cflags, pkt.ipv4_lso_maxlen); (unsigned long long)pkt.mtu, pkt.cflags, pkt.ipv4_lso_maxlen);
return vio_ldc_send(vio, &pkt, sizeof(pkt)); return vio_ldc_send(vio, &pkt, sizeof(pkt));
} }
EXPORT_SYMBOL_GPL(sunvnet_send_attr_common); EXPORT_SYMBOL_GPL(sunvnet_send_attr_common);
...@@ -197,24 +196,23 @@ static int handle_attr_info(struct vio_driver_state *vio, ...@@ -197,24 +196,23 @@ static int handle_attr_info(struct vio_driver_state *vio,
pkt->tag.stype = VIO_SUBTYPE_NACK; pkt->tag.stype = VIO_SUBTYPE_NACK;
(void) vio_ldc_send(vio, pkt, sizeof(*pkt)); (void)vio_ldc_send(vio, pkt, sizeof(*pkt));
return -ECONNRESET; return -ECONNRESET;
} else {
viodbg(HS, "SEND NET ATTR ACK xmode[0x%x] atype[0x%x] "
"addr[%llx] ackfreq[%u] plnk_updt[0x%02x] opts[0x%02x] "
"mtu[%llu] (rmtu[%llu]) cflags[0x%04x] lso_max[%u]\n",
pkt->xfer_mode, pkt->addr_type,
(unsigned long long)pkt->addr,
pkt->ack_freq, pkt->plnk_updt, pkt->options,
(unsigned long long)pkt->mtu, port->rmtu, pkt->cflags,
pkt->ipv4_lso_maxlen);
pkt->tag.stype = VIO_SUBTYPE_ACK;
return vio_ldc_send(vio, pkt, sizeof(*pkt));
} }
viodbg(HS, "SEND NET ATTR ACK xmode[0x%x] atype[0x%x] "
"addr[%llx] ackfreq[%u] plnk_updt[0x%02x] opts[0x%02x] "
"mtu[%llu] (rmtu[%llu]) cflags[0x%04x] lso_max[%u]\n",
pkt->xfer_mode, pkt->addr_type,
(unsigned long long)pkt->addr,
pkt->ack_freq, pkt->plnk_updt, pkt->options,
(unsigned long long)pkt->mtu, port->rmtu, pkt->cflags,
pkt->ipv4_lso_maxlen);
pkt->tag.stype = VIO_SUBTYPE_ACK;
return vio_ldc_send(vio, pkt, sizeof(*pkt));
} }
static int handle_attr_ack(struct vio_driver_state *vio, static int handle_attr_ack(struct vio_driver_state *vio,
...@@ -258,10 +256,12 @@ void sunvnet_handshake_complete_common(struct vio_driver_state *vio) ...@@ -258,10 +256,12 @@ void sunvnet_handshake_complete_common(struct vio_driver_state *vio)
struct vio_dring_state *dr; struct vio_dring_state *dr;
dr = &vio->drings[VIO_DRIVER_RX_RING]; dr = &vio->drings[VIO_DRIVER_RX_RING];
dr->snd_nxt = dr->rcv_nxt = 1; dr->rcv_nxt = 1;
dr->snd_nxt = 1;
dr = &vio->drings[VIO_DRIVER_TX_RING]; dr = &vio->drings[VIO_DRIVER_TX_RING];
dr->snd_nxt = dr->rcv_nxt = 1; dr->rcv_nxt = 1;
dr->snd_nxt = 1;
} }
EXPORT_SYMBOL_GPL(sunvnet_handshake_complete_common); EXPORT_SYMBOL_GPL(sunvnet_handshake_complete_common);
...@@ -283,13 +283,14 @@ EXPORT_SYMBOL_GPL(sunvnet_handshake_complete_common); ...@@ -283,13 +283,14 @@ EXPORT_SYMBOL_GPL(sunvnet_handshake_complete_common);
static struct sk_buff *alloc_and_align_skb(struct net_device *dev, static struct sk_buff *alloc_and_align_skb(struct net_device *dev,
unsigned int len) unsigned int len)
{ {
struct sk_buff *skb = netdev_alloc_skb(dev, len+VNET_PACKET_SKIP+8+8); struct sk_buff *skb;
unsigned long addr, off; unsigned long addr, off;
skb = netdev_alloc_skb(dev, len + VNET_PACKET_SKIP + 8 + 8);
if (unlikely(!skb)) if (unlikely(!skb))
return NULL; return NULL;
addr = (unsigned long) skb->data; addr = (unsigned long)skb->data;
off = ((addr + 7UL) & ~7UL) - addr; off = ((addr + 7UL) & ~7UL) - addr;
if (off) if (off)
skb_reserve(skb, off); skb_reserve(skb, off);
...@@ -505,7 +506,7 @@ static int vnet_walk_rx_one(struct vnet_port *port, ...@@ -505,7 +506,7 @@ static int vnet_walk_rx_one(struct vnet_port *port,
struct vio_driver_state *vio = &port->vio; struct vio_driver_state *vio = &port->vio;
int err; int err;
BUG_ON(desc == NULL); BUG_ON(!desc);
if (IS_ERR(desc)) if (IS_ERR(desc))
return PTR_ERR(desc); return PTR_ERR(desc);
...@@ -540,13 +541,14 @@ static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr, ...@@ -540,13 +541,14 @@ static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr,
int ack_start = -1, ack_end = -1; int ack_start = -1, ack_end = -1;
bool send_ack = true; bool send_ack = true;
end = (end == (u32) -1) ? vio_dring_prev(dr, start) end = (end == (u32)-1) ? vio_dring_prev(dr, start)
: vio_dring_next(dr, end); : vio_dring_next(dr, end);
viodbg(DATA, "vnet_walk_rx start[%08x] end[%08x]\n", start, end); viodbg(DATA, "vnet_walk_rx start[%08x] end[%08x]\n", start, end);
while (start != end) { while (start != end) {
int ack = 0, err = vnet_walk_rx_one(port, dr, start, &ack); int ack = 0, err = vnet_walk_rx_one(port, dr, start, &ack);
if (err == -ECONNRESET) if (err == -ECONNRESET)
return err; return err;
if (err != 0) if (err != 0)
...@@ -568,8 +570,10 @@ static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr, ...@@ -568,8 +570,10 @@ static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr,
break; break;
} }
} }
if (unlikely(ack_start == -1)) if (unlikely(ack_start == -1)) {
ack_start = ack_end = vio_dring_prev(dr, start); ack_end = vio_dring_prev(dr, start);
ack_start = ack_end;
}
if (send_ack) { if (send_ack) {
port->napi_resume = false; port->napi_resume = false;
trace_vnet_tx_send_stopped_ack(port->vio._local_sid, trace_vnet_tx_send_stopped_ack(port->vio._local_sid,
...@@ -749,7 +753,7 @@ static int vnet_event_napi(struct vnet_port *port, int budget) ...@@ -749,7 +753,7 @@ static int vnet_event_napi(struct vnet_port *port, int budget)
} }
/* We may have multiple LDC events in rx_event. Unroll send_events() */ /* We may have multiple LDC events in rx_event. Unroll send_events() */
event = (port->rx_event & LDC_EVENT_UP); event = (port->rx_event & LDC_EVENT_UP);
port->rx_event &= ~(LDC_EVENT_RESET|LDC_EVENT_UP); port->rx_event &= ~(LDC_EVENT_RESET | LDC_EVENT_UP);
if (event == LDC_EVENT_UP) if (event == LDC_EVENT_UP)
goto ldc_ctrl; goto ldc_ctrl;
event = port->rx_event; event = port->rx_event;
...@@ -759,7 +763,8 @@ static int vnet_event_napi(struct vnet_port *port, int budget) ...@@ -759,7 +763,8 @@ static int vnet_event_napi(struct vnet_port *port, int budget)
/* we dont expect any other bits than RESET, UP, DATA_READY */ /* we dont expect any other bits than RESET, UP, DATA_READY */
BUG_ON(event != LDC_EVENT_DATA_READY); BUG_ON(event != LDC_EVENT_DATA_READY);
tx_wakeup = err = 0; err = 0;
tx_wakeup = 0;
while (1) { while (1) {
union { union {
struct vio_msg_tag tag; struct vio_msg_tag tag;
...@@ -776,7 +781,8 @@ static int vnet_event_napi(struct vnet_port *port, int budget) ...@@ -776,7 +781,8 @@ static int vnet_event_napi(struct vnet_port *port, int budget)
pkt->tag.stype = VIO_SUBTYPE_INFO; pkt->tag.stype = VIO_SUBTYPE_INFO;
pkt->tag.stype_env = VIO_DRING_DATA; pkt->tag.stype_env = VIO_DRING_DATA;
pkt->seq = dr->rcv_nxt; pkt->seq = dr->rcv_nxt;
pkt->start_idx = vio_dring_next(dr, port->napi_stop_idx); pkt->start_idx = vio_dring_next(dr,
port->napi_stop_idx);
pkt->end_idx = -1; pkt->end_idx = -1;
goto napi_resume; goto napi_resume;
} }
...@@ -860,7 +866,6 @@ void sunvnet_event_common(void *arg, int event) ...@@ -860,7 +866,6 @@ void sunvnet_event_common(void *arg, int event)
port->rx_event |= event; port->rx_event |= event;
vio_set_intr(vio->vdev->rx_ino, HV_INTR_DISABLED); vio_set_intr(vio->vdev->rx_ino, HV_INTR_DISABLED);
napi_schedule(&port->napi); napi_schedule(&port->napi);
} }
EXPORT_SYMBOL_GPL(sunvnet_event_common); EXPORT_SYMBOL_GPL(sunvnet_event_common);
...@@ -876,7 +881,7 @@ static int __vnet_tx_trigger(struct vnet_port *port, u32 start) ...@@ -876,7 +881,7 @@ static int __vnet_tx_trigger(struct vnet_port *port, u32 start)
}, },
.dring_ident = dr->ident, .dring_ident = dr->ident,
.start_idx = start, .start_idx = start,
.end_idx = (u32) -1, .end_idx = (u32)-1,
}; };
int err, delay; int err, delay;
int retries = 0; int retries = 0;
...@@ -928,7 +933,7 @@ static struct sk_buff *vnet_clean_tx_ring(struct vnet_port *port, ...@@ -928,7 +933,7 @@ static struct sk_buff *vnet_clean_tx_ring(struct vnet_port *port,
--txi; --txi;
if (txi < 0) if (txi < 0)
txi = VNET_TX_RING_SIZE-1; txi = VNET_TX_RING_SIZE - 1;
d = vio_dring_entry(dr, txi); d = vio_dring_entry(dr, txi);
...@@ -949,8 +954,9 @@ static struct sk_buff *vnet_clean_tx_ring(struct vnet_port *port, ...@@ -949,8 +954,9 @@ static struct sk_buff *vnet_clean_tx_ring(struct vnet_port *port,
ldc_unmap(port->vio.lp, ldc_unmap(port->vio.lp,
port->tx_bufs[txi].cookies, port->tx_bufs[txi].cookies,
port->tx_bufs[txi].ncookies); port->tx_bufs[txi].ncookies);
} else if (d->hdr.state == VIO_DESC_FREE) } else if (d->hdr.state == VIO_DESC_FREE) {
break; break;
}
d->hdr.state = VIO_DESC_FREE; d->hdr.state = VIO_DESC_FREE;
} }
return skb; return skb;
...@@ -1001,7 +1007,7 @@ static inline int vnet_skb_map(struct ldc_channel *lp, struct sk_buff *skb, ...@@ -1001,7 +1007,7 @@ static inline int vnet_skb_map(struct ldc_channel *lp, struct sk_buff *skb,
blen += VNET_PACKET_SKIP; blen += VNET_PACKET_SKIP;
blen += 8 - (blen & 7); blen += 8 - (blen & 7);
err = ldc_map_single(lp, skb->data-VNET_PACKET_SKIP, blen, cookies, err = ldc_map_single(lp, skb->data - VNET_PACKET_SKIP, blen, cookies,
ncookies, map_perm); ncookies, map_perm);
if (err < 0) if (err < 0)
return err; return err;
...@@ -1061,7 +1067,7 @@ static inline struct sk_buff *vnet_skb_shape(struct sk_buff *skb, int ncookies) ...@@ -1061,7 +1067,7 @@ static inline struct sk_buff *vnet_skb_shape(struct sk_buff *skb, int ncookies)
len = skb->len > ETH_ZLEN ? skb->len : ETH_ZLEN; len = skb->len > ETH_ZLEN ? skb->len : ETH_ZLEN;
nskb = alloc_and_align_skb(skb->dev, len); nskb = alloc_and_align_skb(skb->dev, len);
if (nskb == NULL) { if (!nskb) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NULL; return NULL;
} }
...@@ -1138,11 +1144,11 @@ static int vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb, ...@@ -1138,11 +1144,11 @@ static int vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,
else if (skb->protocol == htons(ETH_P_IPV6)) else if (skb->protocol == htons(ETH_P_IPV6))
proto = ipv6_hdr(skb)->nexthdr; proto = ipv6_hdr(skb)->nexthdr;
if (proto == IPPROTO_TCP) if (proto == IPPROTO_TCP) {
hlen += tcp_hdr(skb)->doff * 4; hlen += tcp_hdr(skb)->doff * 4;
else if (proto == IPPROTO_UDP) } else if (proto == IPPROTO_UDP) {
hlen += sizeof(struct udphdr); hlen += sizeof(struct udphdr);
else { } else {
pr_err("vnet_handle_offloads GSO with unknown transport " pr_err("vnet_handle_offloads GSO with unknown transport "
"protocol %d tproto %d\n", skb->protocol, proto); "protocol %d tproto %d\n", skb->protocol, proto);
hlen = 128; /* XXX */ hlen = 128; /* XXX */
...@@ -1195,8 +1201,9 @@ static int vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb, ...@@ -1195,8 +1201,9 @@ static int vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,
skb_shinfo(curr)->gso_type = gso_type; skb_shinfo(curr)->gso_type = gso_type;
skb_shinfo(curr)->gso_segs = skb_shinfo(curr)->gso_segs =
DIV_ROUND_UP(curr->len - hlen, gso_size); DIV_ROUND_UP(curr->len - hlen, gso_size);
} else } else {
skb_shinfo(curr)->gso_size = 0; skb_shinfo(curr)->gso_size = 0;
}
skb_push(curr, maclen); skb_push(curr, maclen);
skb_reset_mac_header(curr); skb_reset_mac_header(curr);
...@@ -1521,14 +1528,14 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port) ...@@ -1521,14 +1528,14 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port)
if (++n_addrs == VNET_NUM_MCAST) { if (++n_addrs == VNET_NUM_MCAST) {
info.count = n_addrs; info.count = n_addrs;
(void) vio_ldc_send(&port->vio, &info, (void)vio_ldc_send(&port->vio, &info,
sizeof(info)); sizeof(info));
n_addrs = 0; n_addrs = 0;
} }
} }
if (n_addrs) { if (n_addrs) {
info.count = n_addrs; info.count = n_addrs;
(void) vio_ldc_send(&port->vio, &info, sizeof(info)); (void)vio_ldc_send(&port->vio, &info, sizeof(info));
} }
info.set = 0; info.set = 0;
...@@ -1546,8 +1553,8 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port) ...@@ -1546,8 +1553,8 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port)
m->addr, ETH_ALEN); m->addr, ETH_ALEN);
if (++n_addrs == VNET_NUM_MCAST) { if (++n_addrs == VNET_NUM_MCAST) {
info.count = n_addrs; info.count = n_addrs;
(void) vio_ldc_send(&port->vio, &info, (void)vio_ldc_send(&port->vio, &info,
sizeof(info)); sizeof(info));
n_addrs = 0; n_addrs = 0;
} }
...@@ -1556,7 +1563,7 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port) ...@@ -1556,7 +1563,7 @@ static void __send_mc_list(struct vnet *vp, struct vnet_port *port)
} }
if (n_addrs) { if (n_addrs) {
info.count = n_addrs; info.count = n_addrs;
(void) vio_ldc_send(&port->vio, &info, sizeof(info)); (void)vio_ldc_send(&port->vio, &info, sizeof(info));
} }
} }
...@@ -1566,7 +1573,6 @@ void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp) ...@@ -1566,7 +1573,6 @@ void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp)
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(port, &vp->port_list, list) { list_for_each_entry_rcu(port, &vp->port_list, list) {
if (port->switch_port) { if (port->switch_port) {
__update_mc_list(vp, dev); __update_mc_list(vp, dev);
__send_mc_list(vp, port); __send_mc_list(vp, port);
...@@ -1600,7 +1606,7 @@ void sunvnet_port_free_tx_bufs_common(struct vnet_port *port) ...@@ -1600,7 +1606,7 @@ void sunvnet_port_free_tx_bufs_common(struct vnet_port *port)
dr = &port->vio.drings[VIO_DRIVER_TX_RING]; dr = &port->vio.drings[VIO_DRIVER_TX_RING];
if (dr->base == NULL) if (!dr->base)
return; return;
for (i = 0; i < VNET_TX_RING_SIZE; i++) { for (i = 0; i < VNET_TX_RING_SIZE; i++) {
...@@ -1668,7 +1674,8 @@ static int vnet_port_alloc_tx_ring(struct vnet_port *port) ...@@ -1668,7 +1674,8 @@ static int vnet_port_alloc_tx_ring(struct vnet_port *port)
dr->base = dring; dr->base = dring;
dr->entry_size = elen; dr->entry_size = elen;
dr->num_entries = VNET_TX_RING_SIZE; dr->num_entries = VNET_TX_RING_SIZE;
dr->prod = dr->cons = 0; dr->prod = 0;
dr->cons = 0;
port->start_cons = true; /* need an initial trigger */ port->start_cons = true; /* need an initial trigger */
dr->pending = VNET_TX_RING_SIZE; dr->pending = VNET_TX_RING_SIZE;
dr->ncookies = ncookies; dr->ncookies = ncookies;
...@@ -1713,7 +1720,6 @@ void sunvnet_port_add_txq_common(struct vnet_port *port) ...@@ -1713,7 +1720,6 @@ void sunvnet_port_add_txq_common(struct vnet_port *port)
port->q_index = n; port->q_index = n;
netif_tx_wake_queue(netdev_get_tx_queue(VNET_PORT_TO_NET_DEVICE(port), netif_tx_wake_queue(netdev_get_tx_queue(VNET_PORT_TO_NET_DEVICE(port),
port->q_index)); port->q_index));
} }
EXPORT_SYMBOL_GPL(sunvnet_port_add_txq_common); EXPORT_SYMBOL_GPL(sunvnet_port_add_txq_common);
......
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