Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109466
b: refs/heads/master
c: 78fbc82
h: refs/heads/master
v: v3
  • Loading branch information
Michael Neuling authored and Paul Mackerras committed Sep 3, 2008
1 parent b48fb73 commit cde65b1
Show file tree
Hide file tree
Showing 38 changed files with 276 additions and 321 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: 316343e2cfd9a4bb4c70d0e1991e7a74840fe29e
refs/heads/master: 78fbc824ed8225edd80cdc57771d5ca4f7aae95e
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/kernel/align.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
unsigned int flags, unsigned int length)
{
char *ptr = (char *) &current->thread.TS_FPR(reg);
int ret;
int ret = 0;

flush_vsx_to_thread(current);

Expand Down
132 changes: 61 additions & 71 deletions trunk/arch/x86/kernel/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,75 +122,15 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
return ULLONG_MAX;
}

/*
* Try to calibrate the TSC against the Programmable
* Interrupt Timer and return the frequency of the TSC
* in kHz.
*
* Return ULONG_MAX on failure to calibrate.
*/
static unsigned long pit_calibrate_tsc(void)
{
u64 tsc, t1, t2, delta;
unsigned long tscmin, tscmax;
int pitcnt;

/* Set the Gate high, disable speaker */
outb((inb(0x61) & ~0x02) | 0x01, 0x61);

/*
* Setup CTC channel 2* for mode 0, (interrupt on terminal
* count mode), binary count. Set the latch register to 50ms
* (LSB then MSB) to begin countdown.
*/
outb(0xb0, 0x43);
outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);

tsc = t1 = t2 = get_cycles();

pitcnt = 0;
tscmax = 0;
tscmin = ULONG_MAX;
while ((inb(0x61) & 0x20) == 0) {
t2 = get_cycles();
delta = t2 - tsc;
tsc = t2;
if ((unsigned long) delta < tscmin)
tscmin = (unsigned int) delta;
if ((unsigned long) delta > tscmax)
tscmax = (unsigned int) delta;
pitcnt++;
}

/*
* Sanity checks:
*
* If we were not able to read the PIT more than 5000
* times, then we have been hit by a massive SMI
*
* If the maximum is 10 times larger than the minimum,
* then we got hit by an SMI as well.
*/
if (pitcnt < 5000 || tscmax > 10 * tscmin)
return ULONG_MAX;

/* Calculate the PIT value */
delta = t2 - t1;
do_div(delta, 50);
return delta;
}


/**
* native_calibrate_tsc - calibrate the tsc on boot
*/
unsigned long native_calibrate_tsc(void)
{
u64 tsc1, tsc2, delta, pm1, pm2, hpet1, hpet2;
u64 tsc1, tsc2, tr1, tr2, tsc, delta, pm1, pm2, hpet1, hpet2;
unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX;
unsigned long flags;
int hpet = is_hpet_enabled(), i;
unsigned long flags, tscmin, tscmax;
int hpet = is_hpet_enabled(), pitcnt, i;

/*
* Run 5 calibration loops to get the lowest frequency value
Expand All @@ -217,22 +157,72 @@ unsigned long native_calibrate_tsc(void)
* amount of time anyway.
*/
for (i = 0; i < 5; i++) {
unsigned long tsc_pit_khz;

tscmin = ULONG_MAX;
tscmax = 0;
pitcnt = 0;

local_irq_save(flags);

/*
* Read the start value and the reference count of
* hpet/pmtimer when available. Then do the PIT
* calibration, which will take at least 50ms, and
* read the end value.
* hpet/pmtimer when available:
*/
local_irq_save(flags);
tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
tsc_pit_khz = pit_calibrate_tsc();

/* Set the Gate high, disable speaker */
outb((inb(0x61) & ~0x02) | 0x01, 0x61);

/*
* Setup CTC channel 2* for mode 0, (interrupt on terminal
* count mode), binary count. Set the latch register to 50ms
* (LSB then MSB) to begin countdown.
*
* Some devices need a delay here.
*/
outb(0xb0, 0x43);
outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);

tsc = tr1 = tr2 = get_cycles();

while ((inb(0x61) & 0x20) == 0) {
tr2 = get_cycles();
delta = tr2 - tsc;
tsc = tr2;
if ((unsigned int) delta < tscmin)
tscmin = (unsigned int) delta;
if ((unsigned int) delta > tscmax)
tscmax = (unsigned int) delta;
pitcnt++;
}

/*
* We waited at least 50ms above. Now read
* pmtimer/hpet reference again
*/
tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL);

local_irq_restore(flags);

/* Pick the lowest PIT TSC calibration so far */
tsc_pit_min = min(tsc_pit_min, tsc_pit_khz);
/*
* Sanity checks:
*
* If we were not able to read the PIT more than 5000
* times, then we have been hit by a massive SMI
*
* If the maximum is 10 times larger than the minimum,
* then we got hit by an SMI as well.
*/
if (pitcnt > 5000 && tscmax < 10 * tscmin) {

/* Calculate the PIT value */
delta = tr2 - tr1;
do_div(delta, 50);

/* We take the smallest value into account */
tsc_pit_min = min(tsc_pit_min, (unsigned long) delta);
}

/* hpet or pmtimer available ? */
if (!hpet && !pm1 && !pm2)
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/net/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ struct sw_rx_page {
#define PAGES_PER_SGE_SHIFT 0
#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT)

#define BCM_RX_ETH_PAYLOAD_ALIGN 64

/* SGE ring related macros */
#define NUM_RX_SGE_PAGES 2
#define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge))
Expand Down Expand Up @@ -752,7 +750,8 @@ struct bnx2x {

u32 rx_csum;
u32 rx_offset;
u32 rx_buf_size;
u32 rx_buf_use_size; /* useable size */
u32 rx_buf_size; /* with alignment */
#define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */
#define ETH_MIN_PACKET_SIZE 60
#define ETH_MAX_PACKET_SIZE 1500
Expand Down
34 changes: 17 additions & 17 deletions trunk/drivers/net/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
#include "bnx2x.h"
#include "bnx2x_init.h"

#define DRV_MODULE_VERSION "1.45.21"
#define DRV_MODULE_RELDATE "2008/09/03"
#define DRV_MODULE_VERSION "1.45.20"
#define DRV_MODULE_RELDATE "2008/08/25"
#define BNX2X_BC_VER 0x040200

/* Time in jiffies before concluding the transmitter is hung */
Expand Down Expand Up @@ -1027,7 +1027,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
if (unlikely(skb == NULL))
return -ENOMEM;

mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_size,
mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE);
if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
dev_kfree_skb(skb);
Expand Down Expand Up @@ -1169,7 +1169,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue,
/* move empty skb from pool to prod and map it */
prod_rx_buf->skb = fp->tpa_pool[queue].skb;
mapping = pci_map_single(bp->pdev, fp->tpa_pool[queue].skb->data,
bp->rx_buf_size, PCI_DMA_FROMDEVICE);
bp->rx_buf_use_size, PCI_DMA_FROMDEVICE);
pci_unmap_addr_set(prod_rx_buf, mapping, mapping);

/* move partial skb from cons to pool (don't unmap yet) */
Expand Down Expand Up @@ -1276,7 +1276,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
pool entry status to BNX2X_TPA_STOP even if new skb allocation
fails. */
pci_unmap_single(bp->pdev, pci_unmap_addr(rx_buf, mapping),
bp->rx_buf_size, PCI_DMA_FROMDEVICE);
bp->rx_buf_use_size, PCI_DMA_FROMDEVICE);

if (likely(new_skb)) {
/* fix ip xsum and give it to the stack */
Expand Down Expand Up @@ -1520,7 +1520,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
} else if (bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0) {
pci_unmap_single(bp->pdev,
pci_unmap_addr(rx_buf, mapping),
bp->rx_buf_size,
bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE);
skb_reserve(skb, pad);
skb_put(skb, len);
Expand Down Expand Up @@ -4229,7 +4229,7 @@ static inline void bnx2x_free_tpa_pool(struct bnx2x *bp,
if (fp->tpa_state[i] == BNX2X_TPA_START)
pci_unmap_single(bp->pdev,
pci_unmap_addr(rx_buf, mapping),
bp->rx_buf_size,
bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE);

dev_kfree_skb(skb);
Expand All @@ -4245,14 +4245,15 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp)
u16 ring_prod, cqe_ring_prod;
int i, j;

bp->rx_buf_size = bp->dev->mtu;
bp->rx_buf_size += bp->rx_offset + ETH_OVREHEAD +
BCM_RX_ETH_PAYLOAD_ALIGN;
bp->rx_buf_use_size = bp->dev->mtu;
bp->rx_buf_use_size += bp->rx_offset + ETH_OVREHEAD;
bp->rx_buf_size = bp->rx_buf_use_size + 64;

if (bp->flags & TPA_ENABLE_FLAG) {
DP(NETIF_MSG_IFUP,
"rx_buf_size %d effective_mtu %d\n",
bp->rx_buf_size, bp->dev->mtu + ETH_OVREHEAD);
"rx_buf_use_size %d rx_buf_size %d effective_mtu %d\n",
bp->rx_buf_use_size, bp->rx_buf_size,
bp->dev->mtu + ETH_OVREHEAD);

for_each_queue(bp, j) {
struct bnx2x_fastpath *fp = &bp->fp[j];
Expand Down Expand Up @@ -4461,10 +4462,9 @@ static void bnx2x_init_context(struct bnx2x *bp)
context->ustorm_st_context.common.status_block_id = sb_id;
context->ustorm_st_context.common.flags =
USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT;
context->ustorm_st_context.common.mc_alignment_size =
BCM_RX_ETH_PAYLOAD_ALIGN;
context->ustorm_st_context.common.mc_alignment_size = 64;
context->ustorm_st_context.common.bd_buff_size =
bp->rx_buf_size;
bp->rx_buf_use_size;
context->ustorm_st_context.common.bd_page_base_hi =
U64_HI(fp->rx_desc_mapping);
context->ustorm_st_context.common.bd_page_base_lo =
Expand Down Expand Up @@ -4717,7 +4717,7 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
}

/* Init CQ ring mapping and aggregation size */
max_agg_size = min((u32)(bp->rx_buf_size +
max_agg_size = min((u32)(bp->rx_buf_use_size +
8*BCM_PAGE_SIZE*PAGES_PER_SGE),
(u32)0xffff);
for_each_queue(bp, i) {
Expand Down Expand Up @@ -5940,7 +5940,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp)

pci_unmap_single(bp->pdev,
pci_unmap_addr(rx_buf, mapping),
bp->rx_buf_size,
bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE);

rx_buf->skb = NULL;
Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/net/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2303,12 +2303,6 @@ static int __devinit ixgbe_set_interrupt_capability(struct ixgbe_adapter
int err = 0;
int vector, v_budget;

/*
* Set the default interrupt throttle rate.
*/
adapter->rx_eitr = (1000000 / IXGBE_DEFAULT_ITR_RX_USECS);
adapter->tx_eitr = (1000000 / IXGBE_DEFAULT_ITR_TX_USECS);

/*
* It's easy to be greedy for MSI-X vectors, but it really
* doesn't do us much good if we have a lot more vectors
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/net/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ static void netxen_pcie_strap_init(struct netxen_adapter *adapter)
int i, pos;
struct pci_dev *pdev;

pdev = pci_get_device(0x1166, 0x0140, NULL);
if (pdev) {
pci_dev_put(pdev);
adapter->hw_read_wx(adapter,
NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4);
chicken |= 0x4000;
adapter->hw_write_wx(adapter,
NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4);
}

pdev = adapter->pdev;

adapter->hw_read_wx(adapter,
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/pcmcia/axnet_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,6 @@ static struct pcmcia_device_id axnet_ids[] = {
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5),
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e),
PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90),
PCMCIA_DEVICE_PROD_ID12("IO DATA", "ETXPCM", 0x547e66dc, 0x233adac2),
PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8),
PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609),
PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04),
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/pcmcia/pcnet_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d),
PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa),
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-TD", 0x5261440f, 0x47d5ca83),
PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9),
PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2),
PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2),
Expand Down Expand Up @@ -1738,6 +1737,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360),
PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de),
PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f),
PCMCIA_DEVICE_PROD_ID1("IC-CARD", 0x60cb09a6),
PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a),
PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078),
/* too generic! */
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/net/usb/pegasus.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static void ctrl_callback(struct urb *urb)
case -ENOENT:
break;
default:
if (netif_msg_drv(pegasus) && printk_ratelimit())
if (netif_msg_drv(pegasus))
dev_dbg(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, urb->status);
}
Expand Down Expand Up @@ -166,7 +166,7 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
set_current_state(TASK_RUNNING);
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus) && printk_ratelimit())
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
goto out;
Expand Down Expand Up @@ -275,7 +275,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus) && printk_ratelimit())
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
goto out;
Expand Down Expand Up @@ -1209,7 +1209,8 @@ static void pegasus_set_multicast(struct net_device *net)
pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
if (netif_msg_link(pegasus))
pr_info("%s: Promiscuous mode enabled.\n", net->name);
} else if (net->mc_count || (net->flags & IFF_ALLMULTI)) {
} else if (net->mc_count ||
(net->flags & IFF_ALLMULTI)) {
pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
if (netif_msg_link(pegasus))
Expand All @@ -1219,8 +1220,6 @@ static void pegasus_set_multicast(struct net_device *net)
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
}

pegasus->ctrl_urb->status = 0;

pegasus->flags |= ETH_REGS_CHANGE;
ctrl_callback(pegasus->ctrl_urb);
}
Expand Down
Loading

0 comments on commit cde65b1

Please sign in to comment.