Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234074
b: refs/heads/master
c: 0aeea18
h: refs/heads/master
v: v3
  • Loading branch information
Lukas Czerner authored and Jens Axboe committed Mar 11, 2011
1 parent fec9b65 commit ec6a115
Show file tree
Hide file tree
Showing 30 changed files with 146 additions and 251 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: 4f680ceafafebed72c302d829d764de72710c169
refs/heads/master: 0aeea18964173715a1037034ef6838198f319319
5 changes: 4 additions & 1 deletion trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4292,7 +4292,10 @@ S: Maintained
F: net/sched/sch_netem.c

NETERION 10GbE DRIVERS (s2io/vxge)
M: Jon Mason <jdmason@kudzu.us>
M: Ramkrishna Vepa <ramkrishna.vepa@exar.com>
M: Sivakumar Subramani <sivakumar.subramani@exar.com>
M: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
M: Jon Mason <jon.mason@exar.com>
L: netdev@vger.kernel.org
W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/Linux?Anonymous
W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/X3100Linux?Anonymous
Expand Down
19 changes: 7 additions & 12 deletions trunk/block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ struct bio_batch
atomic_t done;
unsigned long flags;
struct completion *wait;
bio_end_io_t *end_io;
};

static void bio_batch_end_io(struct bio *bio, int err)
Expand All @@ -122,12 +121,9 @@ static void bio_batch_end_io(struct bio *bio, int err)
else
clear_bit(BIO_UPTODATE, &bb->flags);
}
if (bb) {
if (bb->end_io)
bb->end_io(bio, err);
atomic_inc(&bb->done);
complete(bb->wait);
}
if (bb)
if (atomic_dec_and_test(&bb->done))
complete(bb->wait);
bio_put(bio);
}

Expand All @@ -150,13 +146,12 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
int ret;
struct bio *bio;
struct bio_batch bb;
unsigned int sz, issued = 0;
unsigned int sz;
DECLARE_COMPLETION_ONSTACK(wait);

atomic_set(&bb.done, 0);
atomic_set(&bb.done, 1);
bb.flags = 1 << BIO_UPTODATE;
bb.wait = &wait;
bb.end_io = NULL;

submit:
ret = 0;
Expand Down Expand Up @@ -185,12 +180,12 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
break;
}
ret = 0;
issued++;
atomic_inc(&bb.done);
submit_bio(WRITE, bio);
}

/* Wait for bios in-flight */
while (issued != atomic_read(&bb.done))
if (!atomic_dec_and_test(&bb.done))
wait_for_completion(&wait);

if (!test_bit(BIO_UPTODATE, &bb.flags))
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/gpio/ml_ioh_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ static DEFINE_PCI_DEVICE_TABLE(ioh_gpio_pcidev_id) = {
{ PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x802E) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, ioh_gpio_pcidev_id);

static struct pci_driver ioh_gpio_driver = {
.name = "ml_ioh_gpio",
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/gpio/pch_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id);

static struct pci_driver pch_gpio_driver = {
.name = "pch_gpio",
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/net/ariadne.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ static irqreturn_t ariadne_interrupt(int irq, void *data)
int csr0, boguscnt;
int handled = 0;

if (dev == NULL) {
printk(KERN_WARNING "ariadne_interrupt(): irq for unknown device.\n");
return IRQ_NONE;
}

lance->RAP = CSR0; /* PCnet-ISA Controller Status */

if (!(lance->RDP & INTR)) /* Check if any interrupt has been */
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/net/bnx2x/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,6 @@ struct bnx2x {
/* DCBX Negotation results */
struct dcbx_features dcbx_local_feat;
u32 dcbx_error;
u32 pending_max;
};

/**
Expand Down Expand Up @@ -1617,8 +1616,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
/* CMNG constants, as derived from system spec calculations */
/* default MIN rate in case VNIC min rate is configured to zero - 100Mbps */
#define DEF_MIN_RATE 100
/* resolution of the rate shaping timer - 400 usec */
#define RS_PERIODIC_TIMEOUT_USEC 400
/* resolution of the rate shaping timer - 100 usec */
#define RS_PERIODIC_TIMEOUT_USEC 100
/* number of bytes in single QM arbitration cycle -
* coefficient for calculating the fairness timer */
#define QM_ARB_BYTES 160000
Expand Down
22 changes: 0 additions & 22 deletions trunk/drivers/net/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,23 +996,6 @@ void bnx2x_free_skbs(struct bnx2x *bp)
bnx2x_free_rx_skbs(bp);
}

void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value)
{
/* load old values */
u32 mf_cfg = bp->mf_config[BP_VN(bp)];

if (value != bnx2x_extract_max_cfg(bp, mf_cfg)) {
/* leave all but MAX value */
mf_cfg &= ~FUNC_MF_CFG_MAX_BW_MASK;

/* set new MAX value */
mf_cfg |= (value << FUNC_MF_CFG_MAX_BW_SHIFT)
& FUNC_MF_CFG_MAX_BW_MASK;

bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, mf_cfg);
}
}

static void bnx2x_free_msix_irqs(struct bnx2x *bp)
{
int i, offset = 1;
Expand Down Expand Up @@ -1481,11 +1464,6 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)

bnx2x_set_eth_mac(bp, 1);

if (bp->pending_max) {
bnx2x_update_max_mf_config(bp, bp->pending_max);
bp->pending_max = 0;
}

if (bp->port.pmf)
bnx2x_initial_phy_init(bp, load_mode);

Expand Down
9 changes: 0 additions & 9 deletions trunk/drivers/net/bnx2x/bnx2x_cmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,6 @@ void bnx2x_dcbx_init(struct bnx2x *bp);
*/
int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state);

/**
* Updates MAX part of MF configuration in HW
* (if required)
*
* @param bp
* @param value
*/
void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value);

/* dev_close main block */
int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode);

Expand Down
18 changes: 10 additions & 8 deletions trunk/drivers/net/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
speed |= (cmd->speed_hi << 16);

if (IS_MF_SI(bp)) {
u32 part;
u32 param = 0, part;
u32 line_speed = bp->link_vars.line_speed;

/* use 10G if no link detected */
Expand All @@ -251,22 +251,24 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
REQ_BC_VER_4_SET_MF_BW);
return -EINVAL;
}

part = (speed * 100) / line_speed;

if (line_speed < speed || !part) {
BNX2X_DEV_INFO("Speed setting should be in a range "
"from 1%% to 100%% "
"of actual line speed\n");
return -EINVAL;
}
/* load old values */
param = bp->mf_config[BP_VN(bp)];

if (bp->state != BNX2X_STATE_OPEN)
/* store value for following "load" */
bp->pending_max = part;
else
bnx2x_update_max_mf_config(bp, part);
/* leave only MIN value */
param &= FUNC_MF_CFG_MIN_BW_MASK;

/* set new MAX value */
param |= (part << FUNC_MF_CFG_MAX_BW_SHIFT)
& FUNC_MF_CFG_MAX_BW_MASK;

bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, param);
return 0;
}

Expand Down
19 changes: 9 additions & 10 deletions trunk/drivers/net/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2092,9 +2092,8 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type)
bnx2x_calc_vn_weight_sum(bp);

/* calculate and set min-max rate for each vn */
if (bp->port.pmf)
for (vn = VN_0; vn < E1HVN_MAX; vn++)
bnx2x_init_vn_minmax(bp, vn);
for (vn = VN_0; vn < E1HVN_MAX; vn++)
bnx2x_init_vn_minmax(bp, vn);

/* always enable rate shaping and fairness */
bp->cmng.flags.cmng_enables |=
Expand Down Expand Up @@ -2163,6 +2162,13 @@ static void bnx2x_link_attn(struct bnx2x *bp)
bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
}

/* indicate link status only if link status actually changed */
if (prev_link_status != bp->link_vars.link_status)
bnx2x_link_report(bp);

if (IS_MF(bp))
bnx2x_link_sync_notify(bp);

if (bp->link_vars.link_up && bp->link_vars.line_speed) {
int cmng_fns = bnx2x_get_cmng_fns_mode(bp);

Expand All @@ -2174,13 +2180,6 @@ static void bnx2x_link_attn(struct bnx2x *bp)
DP(NETIF_MSG_IFUP,
"single function mode without fairness\n");
}

if (IS_MF(bp))
bnx2x_link_sync_notify(bp);

/* indicate link status only if link status actually changed */
if (prev_link_status != bp->link_vars.link_status)
bnx2x_link_report(bp);
}

void bnx2x__link_status_update(struct bnx2x *bp)
Expand Down
32 changes: 13 additions & 19 deletions trunk/drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,23 +281,23 @@ static inline int __check_agg_selection_timer(struct port *port)
}

/**
* __get_state_machine_lock - lock the port's state machines
* __get_rx_machine_lock - lock the port's RX machine
* @port: the port we're looking at
*
*/
static inline void __get_state_machine_lock(struct port *port)
static inline void __get_rx_machine_lock(struct port *port)
{
spin_lock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
spin_lock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock));
}

/**
* __release_state_machine_lock - unlock the port's state machines
* __release_rx_machine_lock - unlock the port's RX machine
* @port: the port we're looking at
*
*/
static inline void __release_state_machine_lock(struct port *port)
static inline void __release_rx_machine_lock(struct port *port)
{
spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock));
}

/**
Expand Down Expand Up @@ -388,14 +388,14 @@ static u8 __get_duplex(struct port *port)
}

/**
* __initialize_port_locks - initialize a port's STATE machine spinlock
* __initialize_port_locks - initialize a port's RX machine spinlock
* @port: the port we're looking at
*
*/
static inline void __initialize_port_locks(struct port *port)
{
// make sure it isn't called twice
spin_lock_init(&(SLAVE_AD_INFO(port->slave).state_machine_lock));
spin_lock_init(&(SLAVE_AD_INFO(port->slave).rx_machine_lock));
}

//conversions
Expand Down Expand Up @@ -1025,6 +1025,9 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
{
rx_states_t last_state;

// Lock to prevent 2 instances of this function to run simultaneously(rx interrupt and periodic machine callback)
__get_rx_machine_lock(port);

// keep current State Machine state to compare later if it was changed
last_state = port->sm_rx_state;

Expand Down Expand Up @@ -1130,6 +1133,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
pr_err("%s: An illegal loopback occurred on adapter (%s).\n"
"Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n",
port->slave->dev->master->name, port->slave->dev->name);
__release_rx_machine_lock(port);
return;
}
__update_selected(lacpdu, port);
Expand All @@ -1149,6 +1153,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
break;
}
}
__release_rx_machine_lock(port);
}

/**
Expand Down Expand Up @@ -2150,12 +2155,6 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
goto re_arm;
}

/* Lock around state machines to protect data accessed
* by all (e.g., port->sm_vars). ad_rx_machine may run
* concurrently due to incoming LACPDU.
*/
__get_state_machine_lock(port);

ad_rx_machine(NULL, port);
ad_periodic_machine(port);
ad_port_selection_logic(port);
Expand All @@ -2165,8 +2164,6 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
// turn off the BEGIN bit, since we already handled it
if (port->sm_vars & AD_PORT_BEGIN)
port->sm_vars &= ~AD_PORT_BEGIN;

__release_state_machine_lock(port);
}

re_arm:
Expand Down Expand Up @@ -2203,10 +2200,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
case AD_TYPE_LACPDU:
pr_debug("Received LACPDU on port %d\n",
port->actor_port_number);
/* Protect against concurrent state machines */
__get_state_machine_lock(port);
ad_rx_machine(lacpdu, port);
__release_state_machine_lock(port);
break;

case AD_TYPE_MARKER:
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/net/bonding/bond_3ad.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ struct ad_bond_info {
struct ad_slave_info {
struct aggregator aggregator; // 802.3ad aggregator structure
struct port port; // 802.3ad port structure
spinlock_t state_machine_lock; /* mutex state machines vs.
incoming LACPDU */
spinlock_t rx_machine_lock; // To avoid race condition between callback and receive interrupt
u16 id;
};

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
vnet_hdr_len = q->vnet_hdr_sz;

err = -EINVAL;
if (len < vnet_hdr_len)
if ((len -= vnet_hdr_len) < 0)
goto err;
len -= vnet_hdr_len;

err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0,
sizeof(vnet_hdr));
Expand Down
Loading

0 comments on commit ec6a115

Please sign in to comment.