ibmveth: Coding style fixes

Fix most of the kernel coding style issues in ibmveth.

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>
This commit is contained in:
Santiago Leon
2010-09-03 18:29:30 +00:00
committed by David S. Miller
parent 517e80e678
commit f148f61d89

View File

@@ -1,31 +1,29 @@
/**************************************************************************/ /*
/* */ * IBM eServer i/pSeries Virtual Ethernet Device Driver
/* IBM eServer i/pSeries Virtual Ethernet Device Driver */ * Copyright (C) 2003 IBM Corp.
/* Copyright (C) 2003 IBM Corp. */ * Originally written by Dave Larson (larson1@us.ibm.com)
/* Originally written by Dave Larson (larson1@us.ibm.com) */ * Maintained by Santiago Leon (santil@us.ibm.com)
/* Maintained by Santiago Leon (santil@us.ibm.com) */ *
/* */ * This program is free software; you can redistribute it and/or modify
/* This program is free software; you can redistribute it and/or modify */ * it under the terms of the GNU General Public License as published by
/* it under the terms of the GNU General Public License as published by */ * the Free Software Foundation; either version 2 of the License, or
/* the Free Software Foundation; either version 2 of the License, or */ * (at your option) any later version.
/* (at your option) any later version. */ *
/* */ * This program is distributed in the hope that it will be useful,
/* This program is distributed in the hope that it will be useful, */ * but WITHOUT ANY WARRANTY; without even the implied warranty of
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ * GNU General Public License for more details.
/* GNU General Public License for more details. */ *
/* */ * You should have received a copy of the GNU General Public License
/* You should have received a copy of the GNU General Public License */ * along with this program; if not, write to the Free Software
/* along with this program; if not, write to the Free Software */ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ * USA
/* USA */ *
/* */ * This module contains the implementation of a virtual ethernet device
/* This module contains the implementation of a virtual ethernet device */ * for use with IBM i/pSeries LPAR Linux. It utilizes the logical LAN
/* for use with IBM i/pSeries LPAR Linux. It utilizes the logical LAN */ * option of the RS/6000 Platform Architechture to interface with virtual
/* option of the RS/6000 Platform Architechture to interface with virtual */ * ethernet NICs that are presented to the partition by the hypervisor.
/* ethernet NICs that are presented to the partition by the hypervisor. */ */
/* */
/**************************************************************************/
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
@@ -75,7 +73,8 @@ static struct kobj_type ktype_veth_pool;
static const char ibmveth_driver_name[] = "ibmveth"; static const char ibmveth_driver_name[] = "ibmveth";
static const char ibmveth_driver_string[] = "IBM i/pSeries Virtual Ethernet Driver"; static const char ibmveth_driver_string[] = "IBM i/pSeries Virtual Ethernet "
"Driver";
#define ibmveth_driver_version "1.03" #define ibmveth_driver_version "1.03"
MODULE_AUTHOR("Santiago Leon <santil@us.ibm.com>"); MODULE_AUTHOR("Santiago Leon <santil@us.ibm.com>");
@@ -108,8 +107,10 @@ struct ibmveth_stat {
struct ibmveth_stat ibmveth_stats[] = { struct ibmveth_stat ibmveth_stats[] = {
{ "replenish_task_cycles", IBMVETH_STAT_OFF(replenish_task_cycles) }, { "replenish_task_cycles", IBMVETH_STAT_OFF(replenish_task_cycles) },
{ "replenish_no_mem", IBMVETH_STAT_OFF(replenish_no_mem) }, { "replenish_no_mem", IBMVETH_STAT_OFF(replenish_no_mem) },
{ "replenish_add_buff_failure", IBMVETH_STAT_OFF(replenish_add_buff_failure) }, { "replenish_add_buff_failure",
{ "replenish_add_buff_success", IBMVETH_STAT_OFF(replenish_add_buff_success) }, IBMVETH_STAT_OFF(replenish_add_buff_failure) },
{ "replenish_add_buff_success",
IBMVETH_STAT_OFF(replenish_add_buff_success) },
{ "rx_invalid_buffer", IBMVETH_STAT_OFF(rx_invalid_buffer) }, { "rx_invalid_buffer", IBMVETH_STAT_OFF(rx_invalid_buffer) },
{ "rx_no_buffer", IBMVETH_STAT_OFF(rx_no_buffer) }, { "rx_no_buffer", IBMVETH_STAT_OFF(rx_no_buffer) },
{ "tx_map_failed", IBMVETH_STAT_OFF(tx_map_failed) }, { "tx_map_failed", IBMVETH_STAT_OFF(tx_map_failed) },
@@ -126,36 +127,39 @@ static inline u32 ibmveth_rxq_flags(struct ibmveth_adapter *adapter)
static inline int ibmveth_rxq_toggle(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_toggle(struct ibmveth_adapter *adapter)
{ {
return (ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_TOGGLE) >> IBMVETH_RXQ_TOGGLE_SHIFT; return (ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_TOGGLE) >>
IBMVETH_RXQ_TOGGLE_SHIFT;
} }
static inline int ibmveth_rxq_pending_buffer(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_pending_buffer(struct ibmveth_adapter *adapter)
{ {
return (ibmveth_rxq_toggle(adapter) == adapter->rx_queue.toggle); return ibmveth_rxq_toggle(adapter) == adapter->rx_queue.toggle;
} }
static inline int ibmveth_rxq_buffer_valid(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_buffer_valid(struct ibmveth_adapter *adapter)
{ {
return (ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_VALID); return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_VALID;
} }
static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter)
{ {
return (ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_OFF_MASK); return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_OFF_MASK;
} }
static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)
{ {
return (adapter->rx_queue.queue_addr[adapter->rx_queue.index].length); return adapter->rx_queue.queue_addr[adapter->rx_queue.index].length;
} }
static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter) static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter)
{ {
return (ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_CSUM_GOOD); return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_CSUM_GOOD;
} }
/* setup the initial settings for a buffer pool */ /* setup the initial settings for a buffer pool */
static void ibmveth_init_buffer_pool(struct ibmveth_buff_pool *pool, u32 pool_index, u32 pool_size, u32 buff_size, u32 pool_active) static void ibmveth_init_buffer_pool(struct ibmveth_buff_pool *pool,
u32 pool_index, u32 pool_size,
u32 buff_size, u32 pool_active)
{ {
pool->size = pool_size; pool->size = pool_size;
pool->index = pool_index; pool->index = pool_index;
@@ -171,9 +175,8 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool)
pool->free_map = kmalloc(sizeof(u16) * pool->size, GFP_KERNEL); pool->free_map = kmalloc(sizeof(u16) * pool->size, GFP_KERNEL);
if(!pool->free_map) { if (!pool->free_map)
return -1; return -1;
}
pool->dma_addr = kmalloc(sizeof(dma_addr_t) * pool->size, GFP_KERNEL); pool->dma_addr = kmalloc(sizeof(dma_addr_t) * pool->size, GFP_KERNEL);
if (!pool->dma_addr) { if (!pool->dma_addr) {
@@ -195,9 +198,8 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool)
memset(pool->dma_addr, 0, sizeof(dma_addr_t) * pool->size); memset(pool->dma_addr, 0, sizeof(dma_addr_t) * pool->size);
for(i = 0; i < pool->size; ++i) { for (i = 0; i < pool->size; ++i)
pool->free_map[i] = i; pool->free_map[i] = i;
}
atomic_set(&pool->available, 0); atomic_set(&pool->available, 0);
pool->producer_index = 0; pool->producer_index = 0;
@@ -217,7 +219,8 @@ static inline void ibmveth_flush_buffer(void *addr, unsigned long length)
/* replenish the buffers for a pool. note that we don't need to /* replenish the buffers for a pool. note that we don't need to
* skb_reserve these since they are used for incoming... * skb_reserve these since they are used for incoming...
*/ */
static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struct ibmveth_buff_pool *pool) static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter,
struct ibmveth_buff_pool *pool)
{ {
u32 i; u32 i;
u32 count = pool->size - atomic_read(&pool->available); u32 count = pool->size - atomic_read(&pool->available);
@@ -273,11 +276,12 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc
IBMVETH_BUFF_OH); IBMVETH_BUFF_OH);
ibmveth_flush_buffer(skb->data, len); ibmveth_flush_buffer(skb->data, len);
} }
lpar_rc = h_add_logical_lan_buffer(adapter->vdev->unit_address, desc.desc); lpar_rc = h_add_logical_lan_buffer(adapter->vdev->unit_address,
desc.desc);
if (lpar_rc != H_SUCCESS) if (lpar_rc != H_SUCCESS) {
goto failure; goto failure;
else { } else {
buffers_added++; buffers_added++;
adapter->replenish_add_buff_success++; adapter->replenish_add_buff_success++;
} }
@@ -320,11 +324,13 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
ibmveth_replenish_buffer_pool(adapter, pool); ibmveth_replenish_buffer_pool(adapter, pool);
} }
adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8); adapter->rx_no_buffer = *(u64 *)(((char*)adapter->buffer_list_addr) +
4096 - 8);
} }
/* empty and free ana buffer pool - also used to do cleanup in error paths */ /* empty and free ana buffer pool - also used to do cleanup in error paths */
static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter, struct ibmveth_buff_pool *pool) static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter,
struct ibmveth_buff_pool *pool)
{ {
int i; int i;
@@ -357,7 +363,8 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter, struct ibm
} }
/* remove a buffer from a pool */ /* remove a buffer from a pool */
static void ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter, u64 correlator) static void ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
u64 correlator)
{ {
unsigned int pool = correlator >> 32; unsigned int pool = correlator >> 32;
unsigned int index = correlator & 0xffffffffUL; unsigned int index = correlator & 0xffffffffUL;
@@ -510,9 +517,11 @@ static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter,
{ {
int rc, try_again = 1; int rc, try_again = 1;
/* After a kexec the adapter will still be open, so our attempt to /*
* After a kexec the adapter will still be open, so our attempt to
* open it will fail. So if we get a failure we free the adapter and * open it will fail. So if we get a failure we free the adapter and
* try again, but only once. */ * try again, but only once.
*/
retry: retry:
rc = h_register_logical_lan(adapter->vdev->unit_address, rc = h_register_logical_lan(adapter->vdev->unit_address,
adapter->buffer_list_dma, rxq_desc.desc, adapter->buffer_list_dma, rxq_desc.desc,
@@ -559,8 +568,10 @@ static int ibmveth_open(struct net_device *netdev)
return -ENOMEM; return -ENOMEM;
} }
adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) * rxq_entries; adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) *
adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len, GFP_KERNEL); rxq_entries;
adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len,
GFP_KERNEL);
if (!adapter->rx_queue.queue_addr) { if (!adapter->rx_queue.queue_addr) {
netdev_err(netdev, "unable to allocate rx queue pages\n"); netdev_err(netdev, "unable to allocate rx queue pages\n");
@@ -596,7 +607,8 @@ static int ibmveth_open(struct net_device *netdev)
memcpy(&mac_address, netdev->dev_addr, netdev->addr_len); memcpy(&mac_address, netdev->dev_addr, netdev->addr_len);
mac_address = mac_address >> 16; mac_address = mac_address >> 16;
rxq_desc.fields.flags_len = IBMVETH_BUF_VALID | adapter->rx_queue.queue_len; rxq_desc.fields.flags_len = IBMVETH_BUF_VALID |
adapter->rx_queue.queue_len;
rxq_desc.fields.address = adapter->rx_queue.queue_dma; rxq_desc.fields.address = adapter->rx_queue.queue_dma;
netdev_dbg(netdev, "buffer list @ 0x%p\n", adapter->buffer_list_addr); netdev_dbg(netdev, "buffer list @ 0x%p\n", adapter->buffer_list_addr);
@@ -634,7 +646,9 @@ static int ibmveth_open(struct net_device *netdev)
} }
netdev_dbg(netdev, "registering irq 0x%x\n", netdev->irq); netdev_dbg(netdev, "registering irq 0x%x\n", netdev->irq);
if((rc = request_irq(netdev->irq, ibmveth_interrupt, 0, netdev->name, netdev)) != 0) { rc = request_irq(netdev->irq, ibmveth_interrupt, 0, netdev->name,
netdev);
if (rc != 0) {
netdev_err(netdev, "unable to request irq 0x%x, rc %d\n", netdev_err(netdev, "unable to request irq 0x%x, rc %d\n",
netdev->irq, rc); netdev->irq, rc);
do { do {
@@ -692,15 +706,15 @@ static int ibmveth_close(struct net_device *netdev)
lpar_rc = h_free_logical_lan(adapter->vdev->unit_address); lpar_rc = h_free_logical_lan(adapter->vdev->unit_address);
} while (H_IS_LONG_BUSY(lpar_rc) || (lpar_rc == H_BUSY)); } while (H_IS_LONG_BUSY(lpar_rc) || (lpar_rc == H_BUSY));
if(lpar_rc != H_SUCCESS) if (lpar_rc != H_SUCCESS) {
{
netdev_err(netdev, "h_free_logical_lan failed with %lx, " netdev_err(netdev, "h_free_logical_lan failed with %lx, "
"continuing with close\n", lpar_rc); "continuing with close\n", lpar_rc);
} }
free_irq(netdev->irq, netdev); free_irq(netdev->irq, netdev);
adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8); adapter->rx_no_buffer = *(u64 *)(((char *)adapter->buffer_list_addr) +
4096 - 8);
ibmveth_cleanup(adapter); ibmveth_cleanup(adapter);
@@ -709,9 +723,12 @@ static int ibmveth_close(struct net_device *netdev)
return 0; return 0;
} }
static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | SUPPORTED_FIBRE); {
cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg | ADVERTISED_FIBRE); cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg |
SUPPORTED_FIBRE);
cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg |
ADVERTISED_FIBRE);
cmd->speed = SPEED_1000; cmd->speed = SPEED_1000;
cmd->duplex = DUPLEX_FULL; cmd->duplex = DUPLEX_FULL;
cmd->port = PORT_FIBRE; cmd->port = PORT_FIBRE;
@@ -723,12 +740,16 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return 0; return 0;
} }
static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) { static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1); strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1);
strncpy(info->version, ibmveth_driver_version, sizeof(info->version) - 1); strncpy(info->version, ibmveth_driver_version,
sizeof(info->version) - 1);
} }
static u32 netdev_get_link(struct net_device *dev) { static u32 netdev_get_link(struct net_device *dev)
{
return 1; return 1;
} }
@@ -736,15 +757,16 @@ static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data)
{ {
struct ibmveth_adapter *adapter = netdev_priv(dev); struct ibmveth_adapter *adapter = netdev_priv(dev);
if (data) if (data) {
adapter->rx_csum = 1; adapter->rx_csum = 1;
else { } else {
/* /*
* Since the ibmveth firmware interface does not have the concept of * Since the ibmveth firmware interface does not have the
* separate tx/rx checksum offload enable, if rx checksum is disabled * concept of separate tx/rx checksum offload enable, if rx
* we also have to disable tx checksum offload. Once we disable rx * checksum is disabled we also have to disable tx checksum
* checksum offload, we are no longer allowed to send tx buffers that * offload. Once we disable rx checksum offload, we are no
* are not properly checksummed. * longer allowed to send tx buffers that are not properly
* checksummed.
*/ */
adapter->rx_csum = 0; adapter->rx_csum = 0;
dev->features &= ~NETIF_F_IP_CSUM; dev->features &= ~NETIF_F_IP_CSUM;
@@ -811,8 +833,9 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data,
ret = h_illan_attributes(adapter->vdev->unit_address, ret = h_illan_attributes(adapter->vdev->unit_address,
set_attr, clr_attr, &ret_attr); set_attr, clr_attr, &ret_attr);
} else } else {
adapter->fw_ipv4_csum_support = data; adapter->fw_ipv4_csum_support = data;
}
ret6 = h_illan_attributes(adapter->vdev->unit_address, ret6 = h_illan_attributes(adapter->vdev->unit_address,
clr_attr6, set_attr6, &ret_attr); clr_attr6, set_attr6, &ret_attr);
@@ -866,7 +889,8 @@ static int ibmveth_set_tx_csum(struct net_device *dev, u32 data)
return 0; return 0;
if (data && !adapter->rx_csum) if (data && !adapter->rx_csum)
rc = ibmveth_set_csum_offload(dev, data, ibmveth_set_tx_csum_flags); rc = ibmveth_set_csum_offload(dev, data,
ibmveth_set_tx_csum_flags);
else else
ibmveth_set_tx_csum_flags(dev, data); ibmveth_set_tx_csum_flags(dev, data);
@@ -1091,7 +1115,8 @@ map_failed:
static int ibmveth_poll(struct napi_struct *napi, int budget) static int ibmveth_poll(struct napi_struct *napi, int budget)
{ {
struct ibmveth_adapter *adapter = container_of(napi, struct ibmveth_adapter, napi); struct ibmveth_adapter *adapter =
container_of(napi, struct ibmveth_adapter, napi);
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
int frames_processed = 0; int frames_processed = 0;
unsigned long lpar_rc; unsigned long lpar_rc;
@@ -1216,7 +1241,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
} }
/* add the addresses to the filter table */ /* add the addresses to the filter table */
netdev_for_each_mc_addr(ha, netdev) { netdev_for_each_mc_addr(ha, netdev) {
// add the multicast address to the filter table /* add the multicast address to the filter table */
unsigned long mcast_addr = 0; unsigned long mcast_addr = 0;
memcpy(((char *)&mcast_addr)+2, ha->addr, 6); memcpy(((char *)&mcast_addr)+2, ha->addr, 6);
lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
@@ -1351,21 +1376,20 @@ static const struct net_device_ops ibmveth_netdev_ops = {
#endif #endif
}; };
static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) static int __devinit ibmveth_probe(struct vio_dev *dev,
const struct vio_device_id *id)
{ {
int rc, i; int rc, i;
struct net_device *netdev; struct net_device *netdev;
struct ibmveth_adapter *adapter; struct ibmveth_adapter *adapter;
unsigned char *mac_addr_p; unsigned char *mac_addr_p;
unsigned int *mcastFilterSize_p; unsigned int *mcastFilterSize_p;
dev_dbg(&dev->dev, "entering ibmveth_probe for UA 0x%x\n", dev_dbg(&dev->dev, "entering ibmveth_probe for UA 0x%x\n",
dev->unit_address); dev->unit_address);
mac_addr_p = (unsigned char *) vio_get_attribute(dev, mac_addr_p = (unsigned char *)vio_get_attribute(dev, VETH_MAC_ADDR,
VETH_MAC_ADDR, NULL); NULL);
if (!mac_addr_p) { if (!mac_addr_p) {
dev_err(&dev->dev, "Can't find VETH_MAC_ADDR attribute\n"); dev_err(&dev->dev, "Can't find VETH_MAC_ADDR attribute\n");
return 0; return 0;
@@ -1394,14 +1418,14 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16); netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
/* Some older boxes running PHYP non-natively have an OF that /*
returns a 8-byte local-mac-address field (and the first * Some older boxes running PHYP non-natively have an OF that returns
2 bytes have to be ignored) while newer boxes' OF return * a 8-byte local-mac-address field (and the first 2 bytes have to be
a 6-byte field. Note that IEEE 1275 specifies that * ignored) while newer boxes' OF return a 6-byte field. Note that
local-mac-address must be a 6-byte field. * IEEE 1275 specifies that local-mac-address must be a 6-byte field.
The RPA doc specifies that the first byte must be 10b, so * The RPA doc specifies that the first byte must be 10b, so we'll
we'll just look for it to solve this 8 vs. 6 byte field issue */ * just look for it to solve this 8 vs. 6 byte field issue
*/
if ((*mac_addr_p & 0x3) != 0x02) if ((*mac_addr_p & 0x3) != 0x02)
mac_addr_p += 2; mac_addr_p += 2;
@@ -1515,8 +1539,9 @@ const char * buf, size_t count)
adapter->pool_config = 0; adapter->pool_config = 0;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; return rc;
} else } else {
pool->active = 1; pool->active = 1;
}
} else if (!value && pool->active) { } else if (!value && pool->active) {
int mtu = netdev->mtu + IBMVETH_BUFF_OH; int mtu = netdev->mtu + IBMVETH_BUFF_OH;
int i; int i;
@@ -1547,9 +1572,9 @@ const char * buf, size_t count)
pool->active = 0; pool->active = 0;
} }
} else if (attr == &veth_num_attr) { } else if (attr == &veth_num_attr) {
if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) {
return -EINVAL; return -EINVAL;
else { } else {
if (netif_running(netdev)) { if (netif_running(netdev)) {
adapter->pool_config = 1; adapter->pool_config = 1;
ibmveth_close(netdev); ibmveth_close(netdev);
@@ -1557,13 +1582,14 @@ const char * buf, size_t count)
pool->size = value; pool->size = value;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; return rc;
} else } else {
pool->size = value; pool->size = value;
} }
}
} else if (attr == &veth_size_attr) { } else if (attr == &veth_size_attr) {
if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) {
return -EINVAL; return -EINVAL;
else { } else {
if (netif_running(netdev)) { if (netif_running(netdev)) {
adapter->pool_config = 1; adapter->pool_config = 1;
ibmveth_close(netdev); ibmveth_close(netdev);
@@ -1571,10 +1597,11 @@ const char * buf, size_t count)
pool->buff_size = value; pool->buff_size = value;
if ((rc = ibmveth_open(netdev))) if ((rc = ibmveth_open(netdev)))
return rc; return rc;
} else } else {
pool->buff_size = value; pool->buff_size = value;
} }
} }
}
/* kick the interrupt handler to allocate/deallocate pools */ /* kick the interrupt handler to allocate/deallocate pools */
ibmveth_interrupt(netdev->irq, netdev); ibmveth_interrupt(netdev->irq, netdev);