* [PATCH resend 2/8] irda: w83977af_ir: More whitespace neatening
From: Joe Perches @ 2016-12-05 19:00 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Arnd Bergmann, Sergei Shtylyov, netdev, linux-kernel
In-Reply-To: <cover.1480963809.git.joe@perches.com>
Add spaces around operators.
git diff -w shows no differences.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/irda/w83977af_ir.c | 232 ++++++++++++++++++++---------------------
1 file changed, 116 insertions(+), 116 deletions(-)
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 98333aba7404..4ad91f4f867f 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -110,7 +110,7 @@ static int __init w83977af_init(void)
{
int i;
- for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) {
+ for (i = 0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) {
if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
return 0;
}
@@ -127,7 +127,7 @@ static void __exit w83977af_cleanup(void)
{
int i;
- for (i=0; i < ARRAY_SIZE(dev_self); i++) {
+ for (i = 0; i < ARRAY_SIZE(dev_self); i++) {
if (dev_self[i])
w83977af_close(dev_self[i]);
}
@@ -156,7 +156,7 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
/* Lock the port that we need */
if (!request_region(iobase, CHIP_IO_EXTENT, driver_name)) {
pr_debug("%s(), can't get iobase of 0x%03x\n",
- __func__ , iobase);
+ __func__, iobase);
return -ENODEV;
}
@@ -169,7 +169,7 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
*/
dev = alloc_irdadev(sizeof(struct w83977af_ir));
if (dev == NULL) {
- printk( KERN_ERR "IrDA: Can't allocate memory for "
+ printk(KERN_ERR "IrDA: Can't allocate memory for "
"IrDA control block!\n");
err = -ENOMEM;
goto err_out;
@@ -192,8 +192,8 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
/* The only value we must override it the baudrate */
/* FIXME: The HP HDLS-1100 does not support 1152000! */
- self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600|
- IR_115200|IR_576000|IR_1152000|(IR_4000000 << 8);
+ self->qos.baud_rate.bits = IR_9600 | IR_19200 | IR_38400 | IR_57600 |
+ IR_115200 | IR_576000 | IR_1152000 | (IR_4000000 << 8);
/* The HP HDLS-1100 needs 1 ms according to the specs */
self->qos.min_turn_time.bits = qos_mtt_bits;
@@ -282,7 +282,7 @@ static int w83977af_close(struct w83977af_ir *self)
/* Release the PORT that this driver is using */
pr_debug("%s(), Releasing Region %03x\n",
- __func__ , self->io.fir_base);
+ __func__, self->io.fir_base);
release_region(self->io.fir_base, self->io.fir_ext);
if (self->tx_buff.head)
@@ -303,7 +303,7 @@ static int w83977af_probe(int iobase, int irq, int dma)
int version;
int i;
- for (i=0; i < 2; i++) {
+ for (i = 0; i < 2; i++) {
#ifdef CONFIG_USE_W977_PNP
/* Enter PnP configuration mode */
w977_efm_enter(efbase[i]);
@@ -317,14 +317,14 @@ static int w83977af_probe(int iobase, int irq, int dma)
w977_write_reg(0x70, irq, efbase[i]);
#ifdef CONFIG_ARCH_NETWINDER
/* Netwinder uses 1 higher than Linux */
- w977_write_reg(0x74, dma+1, efbase[i]);
+ w977_write_reg(0x74, dma + 1, efbase[i]);
#else
w977_write_reg(0x74, dma, efbase[i]);
#endif /* CONFIG_ARCH_NETWINDER */
w977_write_reg(0x75, 0x04, efbase[i]); /* Disable Tx DMA */
/* Set append hardware CRC, enable IR bank selection */
- w977_write_reg(0xf0, APEDCRC|ENBNKSEL, efbase[i]);
+ w977_write_reg(0xf0, APEDCRC | ENBNKSEL, efbase[i]);
/* Activate device */
w977_write_reg(0x30, 0x01, efbase[i]);
@@ -333,23 +333,23 @@ static int w83977af_probe(int iobase, int irq, int dma)
#endif /* CONFIG_USE_W977_PNP */
/* Disable Advanced mode */
switch_bank(iobase, SET2);
- outb(iobase+2, 0x00);
+ outb(iobase + 2, 0x00);
/* Turn on UART (global) interrupts */
switch_bank(iobase, SET0);
- outb(HCR_EN_IRQ, iobase+HCR);
+ outb(HCR_EN_IRQ, iobase + HCR);
/* Switch to advanced mode */
switch_bank(iobase, SET2);
- outb(inb(iobase+ADCR1) | ADCR1_ADV_SL, iobase+ADCR1);
+ outb(inb(iobase + ADCR1) | ADCR1_ADV_SL, iobase + ADCR1);
/* Set default IR-mode */
switch_bank(iobase, SET0);
- outb(HCR_SIR, iobase+HCR);
+ outb(HCR_SIR, iobase + HCR);
/* Read the Advanced IR ID */
switch_bank(iobase, SET3);
- version = inb(iobase+AUID);
+ version = inb(iobase + AUID);
/* Should be 0x1? */
if (0x10 == (version & 0xf0)) {
@@ -357,17 +357,17 @@ static int w83977af_probe(int iobase, int irq, int dma)
/* Set FIFO size to 32 */
switch_bank(iobase, SET2);
- outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
+ outb(ADCR2_RXFS32 | ADCR2_TXFS32, iobase + ADCR2);
/* Set FIFO threshold to TX17, RX16 */
switch_bank(iobase, SET0);
- outb(UFR_RXTL|UFR_TXTL|UFR_TXF_RST|UFR_RXF_RST|
- UFR_EN_FIFO,iobase+UFR);
+ outb(UFR_RXTL | UFR_TXTL | UFR_TXF_RST | UFR_RXF_RST |
+ UFR_EN_FIFO, iobase + UFR);
/* Receiver frame length */
switch_bank(iobase, SET4);
- outb(2048 & 0xff, iobase+6);
- outb((2048 >> 8) & 0x1f, iobase+7);
+ outb(2048 & 0xff, iobase + 6);
+ outb((2048 >> 8) & 0x1f, iobase + 7);
/*
* Init HP HSDL-1100 transceiver.
@@ -382,7 +382,7 @@ static int w83977af_probe(int iobase, int irq, int dma)
* CIRRX pin 40 connected to pin 37
*/
switch_bank(iobase, SET7);
- outb(0x40, iobase+7);
+ outb(0x40, iobase + 7);
net_info_ratelimited("W83977AF (IR) driver loaded. Version: 0x%02x\n",
version);
@@ -408,22 +408,22 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
self->io.speed = speed;
/* Save current bank */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Disable interrupts */
switch_bank(iobase, SET0);
- outb(0, iobase+ICR);
+ outb(0, iobase + ICR);
/* Select Set 2 */
switch_bank(iobase, SET2);
- outb(0x00, iobase+ABHL);
+ outb(0x00, iobase + ABHL);
switch (speed) {
- case 9600: outb(0x0c, iobase+ABLL); break;
- case 19200: outb(0x06, iobase+ABLL); break;
- case 38400: outb(0x03, iobase+ABLL); break;
- case 57600: outb(0x02, iobase+ABLL); break;
- case 115200: outb(0x01, iobase+ABLL); break;
+ case 9600: outb(0x0c, iobase + ABLL); break;
+ case 19200: outb(0x06, iobase + ABLL); break;
+ case 38400: outb(0x03, iobase + ABLL); break;
+ case 57600: outb(0x02, iobase + ABLL); break;
+ case 115200: outb(0x01, iobase + ABLL); break;
case 576000:
ir_mode = HCR_MIR_576;
pr_debug("%s(), handling baud of 576000\n", __func__);
@@ -438,36 +438,36 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
break;
default:
ir_mode = HCR_FIR;
- pr_debug("%s(), unknown baud rate of %d\n", __func__ , speed);
+ pr_debug("%s(), unknown baud rate of %d\n", __func__, speed);
break;
}
/* Set speed mode */
switch_bank(iobase, SET0);
- outb(ir_mode, iobase+HCR);
+ outb(ir_mode, iobase + HCR);
/* set FIFO size to 32 */
switch_bank(iobase, SET2);
- outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
+ outb(ADCR2_RXFS32 | ADCR2_TXFS32, iobase + ADCR2);
/* set FIFO threshold to TX17, RX16 */
switch_bank(iobase, SET0);
- outb(0x00, iobase+UFR); /* Reset */
- outb(UFR_EN_FIFO, iobase+UFR); /* First we must enable FIFO */
- outb(0xa7, iobase+UFR);
+ outb(0x00, iobase + UFR); /* Reset */
+ outb(UFR_EN_FIFO, iobase + UFR); /* First we must enable FIFO */
+ outb(0xa7, iobase + UFR);
netif_wake_queue(self->netdev);
/* Enable some interrupts so we can receive frames */
switch_bank(iobase, SET0);
if (speed > PIO_MAX_SPEED) {
- outb(ICR_EFSFI, iobase+ICR);
+ outb(ICR_EFSFI, iobase + ICR);
w83977af_dma_receive(self);
} else
- outb(ICR_ERBRI, iobase+ICR);
+ outb(ICR_ERBRI, iobase + ICR);
/* Restore SSR */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
}
/*
@@ -489,7 +489,7 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
iobase = self->io.fir_base;
- pr_debug("%s(%ld), skb->len=%d\n", __func__ , jiffies,
+ pr_debug("%s(%ld), skb->len=%d\n", __func__, jiffies,
(int)skb->len);
/* Lock transmit buffer */
@@ -508,7 +508,7 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
}
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Decide if we should use PIO or DMA transfer */
if (self->io.speed > PIO_MAX_SPEED) {
@@ -517,15 +517,15 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
self->tx_buff.len = skb->len;
mtt = irda_get_mtt(skb);
- pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
+ pr_debug("%s(%ld), mtt=%d\n", __func__, jiffies, mtt);
if (mtt > 1000)
- mdelay(mtt/1000);
+ mdelay(mtt / 1000);
else if (mtt)
udelay(mtt);
/* Enable DMA interrupt */
switch_bank(iobase, SET0);
- outb(ICR_EDMAI, iobase+ICR);
+ outb(ICR_EDMAI, iobase + ICR);
w83977af_dma_write(self, iobase);
} else {
self->tx_buff.data = self->tx_buff.head;
@@ -534,12 +534,12 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
/* Add interrupt on tx low level (will fire immediately) */
switch_bank(iobase, SET0);
- outb(ICR_ETXTHI, iobase+ICR);
+ outb(ICR_ETXTHI, iobase + ICR);
}
dev_kfree_skb(skb);
/* Restore set register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return NETDEV_TX_OK;
}
@@ -553,28 +553,28 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
{
__u8 set;
- pr_debug("%s(), len=%d\n", __func__ , self->tx_buff.len);
+ pr_debug("%s(), len=%d\n", __func__, self->tx_buff.len);
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Disable DMA */
switch_bank(iobase, SET0);
- outb(inb(iobase+HCR) & ~HCR_EN_DMA, iobase+HCR);
+ outb(inb(iobase + HCR) & ~HCR_EN_DMA, iobase + HCR);
/* Choose transmit DMA channel */
switch_bank(iobase, SET2);
- outb(ADCR1_D_CHSW|/*ADCR1_DMA_F|*/ADCR1_ADV_SL, iobase+ADCR1);
+ outb(ADCR1_D_CHSW | /*ADCR1_DMA_F|*/ADCR1_ADV_SL, iobase + ADCR1);
irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len,
DMA_MODE_WRITE);
self->io.direction = IO_XMIT;
/* Enable DMA */
switch_bank(iobase, SET0);
- outb(inb(iobase+HCR) | HCR_EN_DMA | HCR_TX_WT, iobase+HCR);
+ outb(inb(iobase + HCR) | HCR_EN_DMA | HCR_TX_WT, iobase + HCR);
/* Restore set register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
}
/*
@@ -589,28 +589,28 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
__u8 set;
/* Save current bank */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
switch_bank(iobase, SET0);
- if (!(inb_p(iobase+USR) & USR_TSRE)) {
+ if (!(inb_p(iobase + USR) & USR_TSRE)) {
pr_debug("%s(), warning, FIFO not empty yet!\n", __func__);
fifo_size -= 17;
pr_debug("%s(), %d bytes left in tx fifo\n",
- __func__ , fifo_size);
+ __func__, fifo_size);
}
/* Fill FIFO with current frame */
while ((fifo_size-- > 0) && (actual < len)) {
/* Transmit next byte */
- outb(buf[actual++], iobase+TBR);
+ outb(buf[actual++], iobase + TBR);
}
pr_debug("%s(), fifo_size %d ; %d sent of %d\n",
- __func__ , fifo_size, actual, len);
+ __func__, fifo_size, actual, len);
/* Restore bank */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return actual;
}
@@ -627,28 +627,28 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
int iobase;
__u8 set;
- pr_debug("%s(%ld)\n", __func__ , jiffies);
+ pr_debug("%s(%ld)\n", __func__, jiffies);
IRDA_ASSERT(self != NULL, return;);
iobase = self->io.fir_base;
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Disable DMA */
switch_bank(iobase, SET0);
- outb(inb(iobase+HCR) & ~HCR_EN_DMA, iobase+HCR);
+ outb(inb(iobase + HCR) & ~HCR_EN_DMA, iobase + HCR);
/* Check for underrun! */
- if (inb(iobase+AUDR) & AUDR_UNDR) {
+ if (inb(iobase + AUDR) & AUDR_UNDR) {
pr_debug("%s(), Transmit underrun!\n", __func__);
self->netdev->stats.tx_errors++;
self->netdev->stats.tx_fifo_errors++;
/* Clear bit, by writing 1 to it */
- outb(AUDR_UNDR, iobase+AUDR);
+ outb(AUDR_UNDR, iobase + AUDR);
} else
self->netdev->stats.tx_packets++;
@@ -663,7 +663,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
netif_wake_queue(self->netdev);
/* Restore set */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
}
/*
@@ -685,19 +685,19 @@ static int w83977af_dma_receive(struct w83977af_ir *self)
pr_debug("%s\n", __func__);
- iobase= self->io.fir_base;
+ iobase = self->io.fir_base;
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Disable DMA */
switch_bank(iobase, SET0);
- outb(inb(iobase+HCR) & ~HCR_EN_DMA, iobase+HCR);
+ outb(inb(iobase + HCR) & ~HCR_EN_DMA, iobase + HCR);
/* Choose DMA Rx, DMA Fairness, and Advanced mode */
switch_bank(iobase, SET2);
- outb((inb(iobase+ADCR1) & ~ADCR1_D_CHSW)/*|ADCR1_DMA_F*/|ADCR1_ADV_SL,
- iobase+ADCR1);
+ outb((inb(iobase + ADCR1) & ~ADCR1_D_CHSW)/*|ADCR1_DMA_F*/ | ADCR1_ADV_SL,
+ iobase + ADCR1);
self->io.direction = IO_RECV;
self->rx_buff.data = self->rx_buff.head;
@@ -720,21 +720,21 @@ static int w83977af_dma_receive(struct w83977af_ir *self)
* be finished transmitting yet
*/
switch_bank(iobase, SET0);
- outb(UFR_RXTL|UFR_TXTL|UFR_RXF_RST|UFR_EN_FIFO, iobase+UFR);
+ outb(UFR_RXTL | UFR_TXTL | UFR_RXF_RST | UFR_EN_FIFO, iobase + UFR);
self->st_fifo.len = self->st_fifo.tail = self->st_fifo.head = 0;
/* Enable DMA */
switch_bank(iobase, SET0);
#ifdef CONFIG_ARCH_NETWINDER
- hcr = inb(iobase+HCR);
- outb(hcr | HCR_EN_DMA, iobase+HCR);
+ hcr = inb(iobase + HCR);
+ outb(hcr | HCR_EN_DMA, iobase + HCR);
enable_dma(self->io.dma);
spin_unlock_irqrestore(&self->lock, flags);
#else
- outb(inb(iobase+HCR) | HCR_EN_DMA, iobase+HCR);
+ outb(inb(iobase + HCR) | HCR_EN_DMA, iobase + HCR);
#endif
/* Restore set */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return 0;
}
@@ -761,17 +761,17 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
iobase = self->io.fir_base;
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
iobase = self->io.fir_base;
/* Read status FIFO */
switch_bank(iobase, SET5);
- while ((status = inb(iobase+FS_FO)) & FS_FO_FSFDR) {
+ while ((status = inb(iobase + FS_FO)) & FS_FO_FSFDR) {
st_fifo->entries[st_fifo->tail].status = status;
- st_fifo->entries[st_fifo->tail].len = inb(iobase+RFLFL);
- st_fifo->entries[st_fifo->tail].len |= inb(iobase+RFLFH) << 8;
+ st_fifo->entries[st_fifo->tail].len = inb(iobase + RFLFL);
+ st_fifo->entries[st_fifo->tail].len |= inb(iobase + RFLFH) << 8;
st_fifo->tail++;
st_fifo->len++;
@@ -814,16 +814,16 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
} else {
/* Check if we have transferred all data to memory */
switch_bank(iobase, SET0);
- if (inb(iobase+USR) & USR_RDR) {
+ if (inb(iobase + USR) & USR_RDR) {
udelay(80); /* Should be enough!? */
}
- skb = dev_alloc_skb(len+1);
+ skb = dev_alloc_skb(len + 1);
if (skb == NULL) {
printk(KERN_INFO
"%s(), memory squeeze, dropping frame.\n", __func__);
/* Restore set register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return FALSE;
}
@@ -833,12 +833,12 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
/* Copy frame without CRC */
if (self->io.speed < 4000000) {
- skb_put(skb, len-2);
+ skb_put(skb, len - 2);
skb_copy_to_linear_data(skb,
self->rx_buff.data,
len - 2);
} else {
- skb_put(skb, len-4);
+ skb_put(skb, len - 4);
skb_copy_to_linear_data(skb,
self->rx_buff.data,
len - 4);
@@ -855,7 +855,7 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
}
}
/* Restore set register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return TRUE;
}
@@ -877,10 +877,10 @@ static void w83977af_pio_receive(struct w83977af_ir *self)
/* Receive all characters in Rx FIFO */
do {
- byte = inb(iobase+RBR);
+ byte = inb(iobase + RBR);
async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
byte);
- } while (inb(iobase+USR) & USR_RDR); /* Data available */
+ } while (inb(iobase + USR) & USR_RDR); /* Data available */
}
/*
@@ -896,7 +896,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
__u8 set;
int iobase;
- pr_debug("%s(), isr=%#x\n", __func__ , isr);
+ pr_debug("%s(), isr=%#x\n", __func__, isr);
iobase = self->io.fir_base;
/* Transmit FIFO low on data */
@@ -916,10 +916,10 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
if (self->tx_buff.len > 0) {
new_icr |= ICR_ETXTHI;
} else {
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
switch_bank(iobase, SET0);
- outb(AUDR_SFEND, iobase+AUDR);
- outb(set, iobase+SSR);
+ outb(AUDR_SFEND, iobase + AUDR);
+ outb(set, iobase + SSR);
self->netdev->stats.tx_packets++;
@@ -965,10 +965,10 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
int iobase;
iobase = self->io.fir_base;
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* End of frame detected in FIFO */
- if (isr & (ISR_FEND_I|ISR_FSF_I)) {
+ if (isr & (ISR_FEND_I | ISR_FSF_I)) {
if (w83977af_dma_receive_complete(self)) {
/* Wait for next status FIFO interrupt */
@@ -978,11 +978,11 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
/* Set timer value, resolution 1 ms */
switch_bank(iobase, SET4);
- outb(0x01, iobase+TMRL); /* 1 ms */
- outb(0x00, iobase+TMRH);
+ outb(0x01, iobase + TMRL); /* 1 ms */
+ outb(0x00, iobase + TMRH);
/* Start timer */
- outb(IR_MSL_EN_TMR, iobase+IR_MSL);
+ outb(IR_MSL_EN_TMR, iobase + IR_MSL);
new_icr |= ICR_ETMRI;
}
@@ -991,7 +991,7 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
if (isr & ISR_TMR_I) {
/* Disable timer */
switch_bank(iobase, SET4);
- outb(0, iobase+IR_MSL);
+ outb(0, iobase + IR_MSL);
/* Clear timer event */
/* switch_bank(iobase, SET0); */
@@ -1026,7 +1026,7 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
}
/* Restore set */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return new_icr;
}
@@ -1049,24 +1049,24 @@ static irqreturn_t w83977af_interrupt(int irq, void *dev_id)
iobase = self->io.fir_base;
/* Save current bank */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
switch_bank(iobase, SET0);
- icr = inb(iobase+ICR);
- isr = inb(iobase+ISR) & icr; /* Mask out the interesting ones */
+ icr = inb(iobase + ICR);
+ isr = inb(iobase + ISR) & icr; /* Mask out the interesting ones */
- outb(0, iobase+ICR); /* Disable interrupts */
+ outb(0, iobase + ICR); /* Disable interrupts */
if (isr) {
/* Dispatch interrupt handler for the current speed */
- if (self->io.speed > PIO_MAX_SPEED )
+ if (self->io.speed > PIO_MAX_SPEED)
icr = w83977af_fir_interrupt(self, isr);
else
icr = w83977af_sir_interrupt(self, isr);
}
- outb(icr, iobase+ICR); /* Restore (new) interrupts */
- outb(set, iobase+SSR); /* Restore bank register */
+ outb(icr, iobase + ICR); /* Restore (new) interrupts */
+ outb(set, iobase + SSR); /* Restore bank register */
return IRQ_RETVAL(isr);
}
@@ -1088,13 +1088,13 @@ static int w83977af_is_receiving(struct w83977af_ir *self)
iobase = self->io.fir_base;
/* Check if rx FIFO is not empty */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
switch_bank(iobase, SET2);
- if ((inb(iobase+RXFDTH) & 0x3f) != 0) {
+ if ((inb(iobase + RXFDTH) & 0x3f) != 0) {
/* We are receiving something */
status = TRUE;
}
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
} else
status = (self->rx_buff.state != OUTSIDE_FRAME);
@@ -1123,7 +1123,7 @@ static int w83977af_net_open(struct net_device *dev)
iobase = self->io.fir_base;
if (request_irq(self->io.irq, w83977af_interrupt, 0, dev->name,
- (void *) dev)) {
+ (void *)dev)) {
return -EAGAIN;
}
/*
@@ -1136,18 +1136,18 @@ static int w83977af_net_open(struct net_device *dev)
}
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Enable some interrupts so we can receive frames again */
switch_bank(iobase, SET0);
if (self->io.speed > 115200) {
- outb(ICR_EFSFI, iobase+ICR);
+ outb(ICR_EFSFI, iobase + ICR);
w83977af_dma_receive(self);
} else
- outb(ICR_ERBRI, iobase+ICR);
+ outb(ICR_ERBRI, iobase + ICR);
/* Restore bank register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
/* Ready to play! */
netif_start_queue(dev);
@@ -1195,17 +1195,17 @@ static int w83977af_net_close(struct net_device *dev)
disable_dma(self->io.dma);
/* Save current set */
- set = inb(iobase+SSR);
+ set = inb(iobase + SSR);
/* Disable interrupts */
switch_bank(iobase, SET0);
- outb(0, iobase+ICR);
+ outb(0, iobase + ICR);
free_irq(self->io.irq, dev);
free_dma(self->io.dma);
/* Restore bank register */
- outb(set, iobase+SSR);
+ outb(set, iobase + SSR);
return 0;
}
@@ -1218,7 +1218,7 @@ static int w83977af_net_close(struct net_device *dev)
*/
static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct if_irda_req *irq = (struct if_irda_req *) rq;
+ struct if_irda_req *irq = (struct if_irda_req *)rq;
struct w83977af_ir *self;
unsigned long flags;
int ret = 0;
@@ -1229,7 +1229,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
IRDA_ASSERT(self != NULL, return -1;);
- pr_debug("%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
+ pr_debug("%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
spin_lock_irqsave(&self->lock, flags);
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related
* [PATCH resend 1/8] irda: w83977af_ir: whitespace neatening
From: Joe Perches @ 2016-12-05 19:00 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Arnd Bergmann, Sergei Shtylyov, netdev, linux-kernel
In-Reply-To: <cover.1480963809.git.joe@perches.com>
Remove leading and trailing whitespace.
git diff -w shows no differences.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/irda/w83977af_ir.c | 392 ++++++++++++++++++++---------------------
1 file changed, 196 insertions(+), 196 deletions(-)
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index e8c3a8c32534..98333aba7404 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: w83977af_ir.c
* Version: 1.0
* Description: FIR driver for the Winbond W83977AF Super I/O chip
@@ -8,31 +8,31 @@
* Created at: Wed Nov 4 11:46:16 1998
* Modified at: Fri Jan 28 12:10:59 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
- *
+ *
* Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>
* Copyright (c) 1998-1999 Rebel.com
- *
- * 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 the Free Software Foundation; either version 2 of
+ *
+ * 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 the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* Neither Paul VanderSpek nor Rebel.com admit liability nor provide
* warranty for any of this software. This material is provided "AS-IS"
* and at no charge.
- *
+ *
* If you find bugs in this file, its very likely that the same bug
* will also be in pc87108.c since the implementations are quite
* similar.
*
* Notice that all functions that needs to access the chip in _any_
- * way, must save BSR register on entry, and restore it on exit.
+ * way, must save BSR register on entry, and restore it on exit.
* It is _very_ important to follow this policy!
*
* __u8 bank;
- *
+ *
* bank = inb( iobase+BSR);
- *
+ *
* do_your_stuff_here();
*
* outb( bank, iobase+BSR);
@@ -63,7 +63,7 @@
#include "w83977af_ir.h"
#define CONFIG_USE_W977_PNP /* Currently needed */
-#define PIO_MAX_SPEED 115200
+#define PIO_MAX_SPEED 115200
static char *driver_name = "w83977af_ir";
static int qos_mtt_bits = 0x07; /* 1 ms or more */
@@ -83,11 +83,11 @@ static unsigned int efio = W977_EFIO_BASE;
static struct w83977af_ir *dev_self[] = { NULL, NULL, NULL, NULL};
/* Some prototypes */
-static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
- unsigned int dma);
+static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
+ unsigned int dma);
static int w83977af_close(struct w83977af_ir *self);
static int w83977af_probe(int iobase, int irq, int dma);
-static int w83977af_dma_receive(struct w83977af_ir *self);
+static int w83977af_dma_receive(struct w83977af_ir *self);
static int w83977af_dma_receive_complete(struct w83977af_ir *self);
static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
struct net_device *dev);
@@ -108,7 +108,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
*/
static int __init w83977af_init(void)
{
- int i;
+ int i;
for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) {
if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
@@ -150,7 +150,7 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
unsigned int dma)
{
struct net_device *dev;
- struct w83977af_ir *self;
+ struct w83977af_ir *self;
int err;
/* Lock the port that we need */
@@ -177,18 +177,18 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
self = netdev_priv(dev);
spin_lock_init(&self->lock);
-
+
/* Initialize IO */
self->io.fir_base = iobase;
- self->io.irq = irq;
- self->io.fir_ext = CHIP_IO_EXTENT;
- self->io.dma = dma;
- self->io.fifo_size = 32;
+ self->io.irq = irq;
+ self->io.fir_ext = CHIP_IO_EXTENT;
+ self->io.dma = dma;
+ self->io.fifo_size = 32;
/* Initialize QoS for this device */
irda_init_max_qos_capabilies(&self->qos);
-
+
/* The only value we must override it the baudrate */
/* FIXME: The HP HDLS-1100 does not support 1152000! */
@@ -198,11 +198,11 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
/* The HP HDLS-1100 needs 1 ms according to the specs */
self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos);
-
+
/* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
- self->rx_buff.truesize = 14384;
+ self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 4000;
-
+
/* Allocate memory if needed */
self->rx_buff.head =
dma_zalloc_coherent(NULL, self->rx_buff.truesize,
@@ -238,12 +238,12 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
/* Need to store self somewhere */
dev_self[i] = self;
-
+
return 0;
err_out3:
dma_free_coherent(NULL, self->tx_buff.truesize,
self->tx_buff.head, self->tx_buff_dma);
-err_out2:
+err_out2:
dma_free_coherent(NULL, self->rx_buff.truesize,
self->rx_buff.head, self->rx_buff_dma);
err_out1:
@@ -263,7 +263,7 @@ static int w83977af_close(struct w83977af_ir *self)
{
int iobase;
- iobase = self->io.fir_base;
+ iobase = self->io.fir_base;
#ifdef CONFIG_USE_W977_PNP
/* enter PnP configuration mode */
@@ -288,7 +288,7 @@ static int w83977af_close(struct w83977af_ir *self)
if (self->tx_buff.head)
dma_free_coherent(NULL, self->tx_buff.truesize,
self->tx_buff.head, self->tx_buff_dma);
-
+
if (self->rx_buff.head)
dma_free_coherent(NULL, self->rx_buff.truesize,
self->rx_buff.head, self->rx_buff_dma);
@@ -300,106 +300,106 @@ static int w83977af_close(struct w83977af_ir *self)
static int w83977af_probe(int iobase, int irq, int dma)
{
- int version;
+ int version;
int i;
-
- for (i=0; i < 2; i++) {
+
+ for (i=0; i < 2; i++) {
#ifdef CONFIG_USE_W977_PNP
- /* Enter PnP configuration mode */
+ /* Enter PnP configuration mode */
w977_efm_enter(efbase[i]);
-
- w977_select_device(W977_DEVICE_IR, efbase[i]);
-
- /* Configure PnP port, IRQ, and DMA channel */
- w977_write_reg(0x60, (iobase >> 8) & 0xff, efbase[i]);
- w977_write_reg(0x61, (iobase) & 0xff, efbase[i]);
-
- w977_write_reg(0x70, irq, efbase[i]);
+
+ w977_select_device(W977_DEVICE_IR, efbase[i]);
+
+ /* Configure PnP port, IRQ, and DMA channel */
+ w977_write_reg(0x60, (iobase >> 8) & 0xff, efbase[i]);
+ w977_write_reg(0x61, (iobase) & 0xff, efbase[i]);
+
+ w977_write_reg(0x70, irq, efbase[i]);
#ifdef CONFIG_ARCH_NETWINDER
/* Netwinder uses 1 higher than Linux */
- w977_write_reg(0x74, dma+1, efbase[i]);
+ w977_write_reg(0x74, dma+1, efbase[i]);
#else
- w977_write_reg(0x74, dma, efbase[i]);
+ w977_write_reg(0x74, dma, efbase[i]);
#endif /* CONFIG_ARCH_NETWINDER */
- w977_write_reg(0x75, 0x04, efbase[i]); /* Disable Tx DMA */
-
- /* Set append hardware CRC, enable IR bank selection */
- w977_write_reg(0xf0, APEDCRC|ENBNKSEL, efbase[i]);
-
- /* Activate device */
- w977_write_reg(0x30, 0x01, efbase[i]);
-
- w977_efm_exit(efbase[i]);
+ w977_write_reg(0x75, 0x04, efbase[i]); /* Disable Tx DMA */
+
+ /* Set append hardware CRC, enable IR bank selection */
+ w977_write_reg(0xf0, APEDCRC|ENBNKSEL, efbase[i]);
+
+ /* Activate device */
+ w977_write_reg(0x30, 0x01, efbase[i]);
+
+ w977_efm_exit(efbase[i]);
#endif /* CONFIG_USE_W977_PNP */
- /* Disable Advanced mode */
- switch_bank(iobase, SET2);
- outb(iobase+2, 0x00);
-
- /* Turn on UART (global) interrupts */
- switch_bank(iobase, SET0);
- outb(HCR_EN_IRQ, iobase+HCR);
-
- /* Switch to advanced mode */
- switch_bank(iobase, SET2);
- outb(inb(iobase+ADCR1) | ADCR1_ADV_SL, iobase+ADCR1);
-
- /* Set default IR-mode */
- switch_bank(iobase, SET0);
- outb(HCR_SIR, iobase+HCR);
-
- /* Read the Advanced IR ID */
- switch_bank(iobase, SET3);
- version = inb(iobase+AUID);
-
- /* Should be 0x1? */
- if (0x10 == (version & 0xf0)) {
- efio = efbase[i];
-
- /* Set FIFO size to 32 */
- switch_bank(iobase, SET2);
- outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
-
- /* Set FIFO threshold to TX17, RX16 */
- switch_bank(iobase, SET0);
- outb(UFR_RXTL|UFR_TXTL|UFR_TXF_RST|UFR_RXF_RST|
+ /* Disable Advanced mode */
+ switch_bank(iobase, SET2);
+ outb(iobase+2, 0x00);
+
+ /* Turn on UART (global) interrupts */
+ switch_bank(iobase, SET0);
+ outb(HCR_EN_IRQ, iobase+HCR);
+
+ /* Switch to advanced mode */
+ switch_bank(iobase, SET2);
+ outb(inb(iobase+ADCR1) | ADCR1_ADV_SL, iobase+ADCR1);
+
+ /* Set default IR-mode */
+ switch_bank(iobase, SET0);
+ outb(HCR_SIR, iobase+HCR);
+
+ /* Read the Advanced IR ID */
+ switch_bank(iobase, SET3);
+ version = inb(iobase+AUID);
+
+ /* Should be 0x1? */
+ if (0x10 == (version & 0xf0)) {
+ efio = efbase[i];
+
+ /* Set FIFO size to 32 */
+ switch_bank(iobase, SET2);
+ outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
+
+ /* Set FIFO threshold to TX17, RX16 */
+ switch_bank(iobase, SET0);
+ outb(UFR_RXTL|UFR_TXTL|UFR_TXF_RST|UFR_RXF_RST|
UFR_EN_FIFO,iobase+UFR);
-
- /* Receiver frame length */
- switch_bank(iobase, SET4);
+
+ /* Receiver frame length */
+ switch_bank(iobase, SET4);
outb(2048 & 0xff, iobase+6);
outb((2048 >> 8) & 0x1f, iobase+7);
- /*
- * Init HP HSDL-1100 transceiver.
- *
- * Set IRX_MSL since we have 2 * receive paths IRRX,
- * and IRRXH. Clear IRSL0D since we want IRSL0 * to
- * be a input pin used for IRRXH
+ /*
+ * Init HP HSDL-1100 transceiver.
+ *
+ * Set IRX_MSL since we have 2 * receive paths IRRX,
+ * and IRRXH. Clear IRSL0D since we want IRSL0 * to
+ * be a input pin used for IRRXH
*
- * IRRX pin 37 connected to receiver
+ * IRRX pin 37 connected to receiver
* IRTX pin 38 connected to transmitter
- * FIRRX pin 39 connected to receiver (IRSL0)
+ * FIRRX pin 39 connected to receiver (IRSL0)
* CIRRX pin 40 connected to pin 37
*/
switch_bank(iobase, SET7);
outb(0x40, iobase+7);
-
+
net_info_ratelimited("W83977AF (IR) driver loaded. Version: 0x%02x\n",
version);
-
+
return 0;
} else {
/* Try next extented function register address */
pr_debug("%s(), Wrong chip version", __func__);
}
- }
+ }
return -1;
}
static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
{
int ir_mode = HCR_SIR;
- int iobase;
+ int iobase;
__u8 set;
iobase = self->io.fir_base;
@@ -448,8 +448,8 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
/* set FIFO size to 32 */
switch_bank(iobase, SET2);
- outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
-
+ outb(ADCR2_RXFS32|ADCR2_TXFS32, iobase+ADCR2);
+
/* set FIFO threshold to TX17, RX16 */
switch_bank(iobase, SET0);
outb(0x00, iobase+UFR); /* Reset */
@@ -457,7 +457,7 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
outb(0xa7, iobase+UFR);
netif_wake_queue(self->netdev);
-
+
/* Enable some interrupts so we can receive frames */
switch_bank(iobase, SET0);
if (speed > PIO_MAX_SPEED) {
@@ -465,7 +465,7 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
w83977af_dma_receive(self);
} else
outb(ICR_ERBRI, iobase+ICR);
-
+
/* Restore SSR */
outb(set, iobase+SSR);
}
@@ -484,23 +484,23 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
int iobase;
__u8 set;
int mtt;
-
+
self = netdev_priv(dev);
iobase = self->io.fir_base;
pr_debug("%s(%ld), skb->len=%d\n", __func__ , jiffies,
(int)skb->len);
-
+
/* Lock transmit buffer */
netif_stop_queue(dev);
-
+
/* Check if we need to change the speed */
speed = irda_get_next_speed(skb);
if ((speed != self->io.speed) && (speed != -1)) {
/* Check for empty frame */
if (!skb->len) {
- w83977af_change_speed(self, speed);
+ w83977af_change_speed(self, speed);
dev_kfree_skb(skb);
return NETDEV_TX_OK;
} else
@@ -509,13 +509,13 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
/* Save current set */
set = inb(iobase+SSR);
-
+
/* Decide if we should use PIO or DMA transfer */
if (self->io.speed > PIO_MAX_SPEED) {
self->tx_buff.data = self->tx_buff.head;
skb_copy_from_linear_data(skb, self->tx_buff.data, skb->len);
self->tx_buff.len = skb->len;
-
+
mtt = irda_get_mtt(skb);
pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
if (mtt > 1000)
@@ -525,13 +525,13 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
/* Enable DMA interrupt */
switch_bank(iobase, SET0);
- outb(ICR_EDMAI, iobase+ICR);
- w83977af_dma_write(self, iobase);
+ outb(ICR_EDMAI, iobase+ICR);
+ w83977af_dma_write(self, iobase);
} else {
self->tx_buff.data = self->tx_buff.head;
- self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
+ self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
self->tx_buff.truesize);
-
+
/* Add interrupt on tx low level (will fire immediately) */
switch_bank(iobase, SET0);
outb(ICR_ETXTHI, iobase+ICR);
@@ -562,15 +562,15 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
switch_bank(iobase, SET0);
outb(inb(iobase+HCR) & ~HCR_EN_DMA, iobase+HCR);
- /* Choose transmit DMA channel */
+ /* Choose transmit DMA channel */
switch_bank(iobase, SET2);
outb(ADCR1_D_CHSW|/*ADCR1_DMA_F|*/ADCR1_ADV_SL, iobase+ADCR1);
irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len,
- DMA_MODE_WRITE);
+ DMA_MODE_WRITE);
self->io.direction = IO_XMIT;
-
+
/* Enable DMA */
- switch_bank(iobase, SET0);
+ switch_bank(iobase, SET0);
outb(inb(iobase+HCR) | HCR_EN_DMA | HCR_TX_WT, iobase+HCR);
/* Restore set register */
@@ -580,14 +580,14 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
/*
* Function w83977af_pio_write (iobase, buf, len, fifo_size)
*
- *
+ *
*
*/
static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
{
int actual = 0;
__u8 set;
-
+
/* Save current bank */
set = inb(iobase+SSR);
@@ -605,7 +605,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
/* Transmit next byte */
outb(buf[actual++], iobase+TBR);
}
-
+
pr_debug("%s(), fifo_size %d ; %d sent of %d\n",
__func__ , fifo_size, actual, len);
@@ -620,7 +620,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
*
* The transfer of a frame in finished. So do the necessary things
*
- *
+ *
*/
static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
{
@@ -639,11 +639,11 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
/* Disable DMA */
switch_bank(iobase, SET0);
outb(inb(iobase+HCR) & ~HCR_EN_DMA, iobase+HCR);
-
+
/* Check for underrun! */
if (inb(iobase+AUDR) & AUDR_UNDR) {
pr_debug("%s(), Transmit underrun!\n", __func__);
-
+
self->netdev->stats.tx_errors++;
self->netdev->stats.tx_fifo_errors++;
@@ -652,7 +652,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
} else
self->netdev->stats.tx_packets++;
-
+
if (self->new_speed) {
w83977af_change_speed(self, self->new_speed);
self->new_speed = 0;
@@ -661,7 +661,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
/* Unlock tx_buff and request another frame */
/* Tell the network layer, that we want more frames */
netif_wake_queue(self->netdev);
-
+
/* Restore set */
outb(set, iobase+SSR);
}
@@ -714,15 +714,15 @@ static int w83977af_dma_receive(struct w83977af_ir *self)
irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize,
DMA_MODE_READ);
#endif
- /*
- * Reset Rx FIFO. This will also flush the ST_FIFO, it's very
+ /*
+ * Reset Rx FIFO. This will also flush the ST_FIFO, it's very
* important that we don't reset the Tx FIFO since it might not
* be finished transmitting yet
*/
switch_bank(iobase, SET0);
outb(UFR_RXTL|UFR_TXTL|UFR_RXF_RST|UFR_EN_FIFO, iobase+UFR);
self->st_fifo.len = self->st_fifo.tail = self->st_fifo.head = 0;
-
+
/* Enable DMA */
switch_bank(iobase, SET0);
#ifdef CONFIG_ARCH_NETWINDER
@@ -730,7 +730,7 @@ static int w83977af_dma_receive(struct w83977af_ir *self)
outb(hcr | HCR_EN_DMA, iobase+HCR);
enable_dma(self->io.dma);
spin_unlock_irqrestore(&self->lock, flags);
-#else
+#else
outb(inb(iobase+HCR) | HCR_EN_DMA, iobase+HCR);
#endif
/* Restore set */
@@ -762,21 +762,21 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
/* Save current set */
set = inb(iobase+SSR);
-
+
iobase = self->io.fir_base;
/* Read status FIFO */
switch_bank(iobase, SET5);
while ((status = inb(iobase+FS_FO)) & FS_FO_FSFDR) {
st_fifo->entries[st_fifo->tail].status = status;
-
+
st_fifo->entries[st_fifo->tail].len = inb(iobase+RFLFL);
st_fifo->entries[st_fifo->tail].len |= inb(iobase+RFLFH) << 8;
-
+
st_fifo->tail++;
st_fifo->len++;
}
-
+
while (st_fifo->len) {
/* Get first entry */
status = st_fifo->entries[st_fifo->head].status;
@@ -792,32 +792,32 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
} else {
/* Skip frame */
self->netdev->stats.rx_errors++;
-
+
self->rx_buff.data += len;
-
+
if (status & FS_FO_MX_LEX)
self->netdev->stats.rx_length_errors++;
-
- if (status & FS_FO_PHY_ERR)
+
+ if (status & FS_FO_PHY_ERR)
self->netdev->stats.rx_frame_errors++;
-
- if (status & FS_FO_CRC_ERR)
+
+ if (status & FS_FO_CRC_ERR)
self->netdev->stats.rx_crc_errors++;
}
/* The errors below can be reported in both cases */
if (status & FS_FO_RX_OV)
self->netdev->stats.rx_fifo_errors++;
-
+
if (status & FS_FO_FSF_OV)
self->netdev->stats.rx_fifo_errors++;
-
+
} else {
/* Check if we have transferred all data to memory */
switch_bank(iobase, SET0);
if (inb(iobase+USR) & USR_RDR) {
udelay(80); /* Should be enough!? */
}
-
+
skb = dev_alloc_skb(len+1);
if (skb == NULL) {
printk(KERN_INFO
@@ -827,10 +827,10 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
return FALSE;
}
-
+
/* Align to 20 bytes */
- skb_reserve(skb, 1);
-
+ skb_reserve(skb, 1);
+
/* Copy frame without CRC */
if (self->io.speed < 4000000) {
skb_put(skb, len-2);
@@ -847,7 +847,7 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
/* Move to next frame */
self->rx_buff.data += len;
self->netdev->stats.rx_packets++;
-
+
skb->dev = self->netdev;
skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA);
@@ -866,21 +866,21 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
* Receive all data in receiver FIFO
*
*/
-static void w83977af_pio_receive(struct w83977af_ir *self)
+static void w83977af_pio_receive(struct w83977af_ir *self)
{
__u8 byte = 0x00;
int iobase;
IRDA_ASSERT(self != NULL, return;);
-
+
iobase = self->io.fir_base;
-
+
/* Receive all characters in Rx FIFO */
do {
byte = inb(iobase+RBR);
async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
byte);
- } while (inb(iobase+USR) & USR_RDR); /* Data available */
+ } while (inb(iobase+USR) & USR_RDR); /* Data available */
}
/*
@@ -897,19 +897,19 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
int iobase;
pr_debug("%s(), isr=%#x\n", __func__ , isr);
-
+
iobase = self->io.fir_base;
/* Transmit FIFO low on data */
if (isr & ISR_TXTH_I) {
/* Write data left in transmit buffer */
- actual = w83977af_pio_write(self->io.fir_base,
- self->tx_buff.data,
- self->tx_buff.len,
+ actual = w83977af_pio_write(self->io.fir_base,
+ self->tx_buff.data,
+ self->tx_buff.len,
self->io.fifo_size);
self->tx_buff.data += actual;
self->tx_buff.len -= actual;
-
+
self->io.direction = IO_XMIT;
/* Check if finished */
@@ -919,7 +919,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
set = inb(iobase+SSR);
switch_bank(iobase, SET0);
outb(AUDR_SFEND, iobase+AUDR);
- outb(set, iobase+SSR);
+ outb(set, iobase+SSR);
self->netdev->stats.tx_packets++;
@@ -929,7 +929,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
}
}
/* Check if transmission has completed */
- if (isr & ISR_TXEMP_I) {
+ if (isr & ISR_TXEMP_I) {
/* Check if we need to change the speed? */
if (self->new_speed) {
pr_debug("%s(), Changing speed!\n", __func__);
@@ -966,11 +966,11 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
iobase = self->io.fir_base;
set = inb(iobase+SSR);
-
+
/* End of frame detected in FIFO */
if (isr & (ISR_FEND_I|ISR_FSF_I)) {
if (w83977af_dma_receive_complete(self)) {
-
+
/* Wait for next status FIFO interrupt */
new_icr |= ICR_EFSFI;
} else {
@@ -995,7 +995,7 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
/* Clear timer event */
/* switch_bank(iobase, SET0); */
-/* outb(ASCR_CTE, iobase+ASCR); */
+/* outb(ASCR_CTE, iobase+ASCR); */
/* Check if this is a TX timer interrupt */
if (self->io.direction == IO_XMIT) {
@@ -1008,23 +1008,23 @@ static __u8 w83977af_fir_interrupt(struct w83977af_ir *self, int isr)
new_icr |= ICR_EFSFI;
}
- }
+ }
/* Finished with DMA */
if (isr & ISR_DMA_I) {
w83977af_dma_xmit_complete(self);
/* Check if there are more frames to be transmitted */
/* if (irda_device_txqueue_empty(self)) { */
-
- /* Prepare for receive
- *
+
+ /* Prepare for receive
+ *
* ** Netwinder Tx DMA likes that we do this anyway **
*/
w83977af_dma_receive(self);
new_icr = ICR_EFSFI;
/* } */
}
-
+
/* Restore set */
outb(set, iobase+SSR);
@@ -1051,12 +1051,12 @@ static irqreturn_t w83977af_interrupt(int irq, void *dev_id)
/* Save current bank */
set = inb(iobase+SSR);
switch_bank(iobase, SET0);
-
- icr = inb(iobase+ICR);
- isr = inb(iobase+ISR) & icr; /* Mask out the interesting ones */
+
+ icr = inb(iobase+ICR);
+ isr = inb(iobase+ISR) & icr; /* Mask out the interesting ones */
outb(0, iobase+ICR); /* Disable interrupts */
-
+
if (isr) {
/* Dispatch interrupt handler for the current speed */
if (self->io.speed > PIO_MAX_SPEED )
@@ -1095,9 +1095,9 @@ static int w83977af_is_receiving(struct w83977af_ir *self)
status = TRUE;
}
outb(set, iobase+SSR);
- } else
+ } else
status = (self->rx_buff.state != OUTSIDE_FRAME);
-
+
return status;
}
@@ -1113,16 +1113,16 @@ static int w83977af_net_open(struct net_device *dev)
int iobase;
char hwname[32];
__u8 set;
-
-
+
+
IRDA_ASSERT(dev != NULL, return -1;);
self = netdev_priv(dev);
-
+
IRDA_ASSERT(self != NULL, return 0;);
-
+
iobase = self->io.fir_base;
- if (request_irq(self->io.irq, w83977af_interrupt, 0, dev->name,
+ if (request_irq(self->io.irq, w83977af_interrupt, 0, dev->name,
(void *) dev)) {
return -EAGAIN;
}
@@ -1134,30 +1134,30 @@ static int w83977af_net_open(struct net_device *dev)
free_irq(self->io.irq, dev);
return -EAGAIN;
}
-
+
/* Save current set */
set = inb(iobase+SSR);
- /* Enable some interrupts so we can receive frames again */
- switch_bank(iobase, SET0);
- if (self->io.speed > 115200) {
- outb(ICR_EFSFI, iobase+ICR);
- w83977af_dma_receive(self);
- } else
- outb(ICR_ERBRI, iobase+ICR);
+ /* Enable some interrupts so we can receive frames again */
+ switch_bank(iobase, SET0);
+ if (self->io.speed > 115200) {
+ outb(ICR_EFSFI, iobase+ICR);
+ w83977af_dma_receive(self);
+ } else
+ outb(ICR_ERBRI, iobase+ICR);
/* Restore bank register */
outb(set, iobase+SSR);
/* Ready to play! */
netif_start_queue(dev);
-
+
/* Give self a hardware name */
sprintf(hwname, "w83977af @ 0x%03x", self->io.fir_base);
- /*
+ /*
* Open new IrLAP layer instance, now that everything should be
- * initialized properly
+ * initialized properly
*/
self->irlap = irlap_open(dev, &self->qos, hwname);
@@ -1177,16 +1177,16 @@ static int w83977af_net_close(struct net_device *dev)
__u8 set;
IRDA_ASSERT(dev != NULL, return -1;);
-
+
self = netdev_priv(dev);
-
+
IRDA_ASSERT(self != NULL, return 0;);
-
+
iobase = self->io.fir_base;
/* Stop device */
netif_stop_queue(dev);
-
+
/* Stop and remove instance of IrLAP */
if (self->irlap)
irlap_close(self->irlap);
@@ -1196,10 +1196,10 @@ static int w83977af_net_close(struct net_device *dev)
/* Save current set */
set = inb(iobase+SSR);
-
+
/* Disable interrupts */
switch_bank(iobase, SET0);
- outb(0, iobase+ICR);
+ outb(0, iobase+ICR);
free_irq(self->io.irq, dev);
free_dma(self->io.dma);
@@ -1230,7 +1230,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
IRDA_ASSERT(self != NULL, return -1;);
pr_debug("%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
-
+
spin_lock_irqsave(&self->lock, flags);
switch (cmd) {
@@ -1274,7 +1274,7 @@ MODULE_PARM_DESC(irq, "IRQ lines");
/*
* Function init_module (void)
*
- *
+ *
*
*/
module_init(w83977af_init);
@@ -1282,7 +1282,7 @@ module_init(w83977af_init);
/*
* Function cleanup_module (void)
*
- *
+ *
*
*/
module_exit(w83977af_cleanup);
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related
* [PATCH resend 0/8] irda: w83977af_ir: Neatening
From: Joe Perches @ 2016-12-05 19:00 UTC (permalink / raw)
To: netdev; +Cc: Arnd Bergmann, Sergei Shtylyov, Samuel Ortiz, linux-kernel
On top of Arnd's overly long udelay patch because I noticed a
misindented block.
Even though I haven't turned on the netwinder in a box in the
garage in who knows how long, if this device is still used somewhere,
might as well neaten the code too.
Joe Perches (8):
irda: w83977af_ir: whitespace neatening
irda: w83977af_ir: More whitespace neatening
irda: w83977af_ir: Remove and add blank lines
irda: w83977af_ir: Neaten pointer comparisons
irda: w83977af_ir: Use the common brace style
irda: w83977af_ir: Parenthesis alignment
irda: w83977af_ir: Neaten logging
irda: w83977af_ir: Fix misindented block
drivers/net/irda/w83977af_ir.c | 669 ++++++++++++++++++++---------------------
1 file changed, 333 insertions(+), 336 deletions(-)
Resend: Addressed Sergei's "Removing, really? :-) nudge"
--
2.10.0.rc2.1.g053435c
^ permalink raw reply
* Re: [ovs-dev] [PATCH net-next] net: remove abuse of VLAN DEI/CFI bit
From: Ben Pfaff @ 2016-12-05 18:55 UTC (permalink / raw)
To: Michał Mirosław; +Cc: netdev, dev, bridge
In-Reply-To: <20161205172436.cpxohof6rggxid74@rere.qmqm.pl>
On Mon, Dec 05, 2016 at 06:24:36PM +0100, Michał Mirosław wrote:
> On Sat, Dec 03, 2016 at 03:27:30PM -0800, Ben Pfaff wrote:
> > On Sat, Dec 03, 2016 at 10:22:28AM +0100, Michał Mirosław wrote:
> > > This All-in-one patch removes abuse of VLAN CFI bit, so it can be passed
> > > intact through linux networking stack.
> > This appears to change the established Open vSwitch userspace API. You
> > can see that simply from the way that it changes the documentation for
> > the userspace API. If I'm right about that, then this change will break
> > all userspace programs that use the Open vSwitch kernel module,
> > including Open vSwitch itself.
>
> If I understood the code correctly, it does change expected meaning for
> the (unlikely?) case of header truncated just before the VLAN TCI - it will
> be impossible to differentiate this case from the VLAN TCI == 0.
>
> I guess this is a problem with OVS API, because it doesn't directly show
> the "missing" state of elements, but relies on an "invalid" value.
That particular corner case should not be a huge problem in any case.
The real problem is that this appears to break the common case use of
VLANs in Open vSwitch. After this patch, parse_vlan() in
net/openvswitch/flow.c copies the tpid and tci from sk_buff (either the
accelerated version of them or the version in the skb data) into
sw_flow_key members. OK, that's fine on it's own. However, I don't see
any corresponding change to the code in flow_netlink.c to compensate for
the fact that, until now, the VLAN CFI bit (formerly VLAN_TAG_PRESENT)
was always required to be set to 1 in flow matches inside Netlink
messages sent from userspace, and the kernel always set it to 1 in
corresponding messages sent to userspace.
In other words, if I'm reading this change correctly:
* With a kernel before this change, userspace always had to set
VLAN_TAG_PRESENT to 1 to match on a VLAN, or the kernel would
reject the flow match.
* With a kernel after this change, userspace must not set
VLAN_TAG_PRESENT to 1, otherwise the kernel will accept the flow
match but nothing will ever match because packets do not actually
have the CFI bit set.
Take a look at this code that the patch deletes from
validate_vlan_from_nlattrs(), for example, and see how it insisted that
VLAN_TAG_PRESENT was set:
if (!(tci & htons(VLAN_TAG_PRESENT))) {
if (tci) {
OVS_NLERR(log, "%s TCI does not have VLAN_TAG_PRESENT bit set.",
(inner) ? "C-VLAN" : "VLAN");
return -EINVAL;
} else if (nla_len(a[OVS_KEY_ATTR_ENCAP])) {
/* Corner case for truncated VLAN header. */
OVS_NLERR(log, "Truncated %s header has non-zero encap attribute.",
(inner) ? "C-VLAN" : "VLAN");
return -EINVAL;
}
}
Please let me know if I'm overlooking something.
Thanks,
Ben.
^ permalink raw reply
* Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode
From: Eric Dumazet @ 2016-12-05 18:51 UTC (permalink / raw)
To: Netanel Belgazal
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <8c6eb7b9-c9fc-60f6-c890-5d69c0cc1cd9@annapurnalabs.com>
On Mon, 2016-12-05 at 20:29 +0200, Netanel Belgazal wrote:
> You are correct.
> I didn't see the patches.
> It is much better to use the napi_complete_done() return value.
> I'll rework my patch.
Excellent, please CC me on this particular work on the future.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next] bpf: Preserve const register type on const OR alu ops
From: David Miller @ 2016-12-05 18:41 UTC (permalink / raw)
To: ast; +Cc: daniel, g.borello, netdev
In-Reply-To: <1480797093-1050393-1-git-send-email-ast@fb.com>
From: Alexei Starovoitov <ast@fb.com>
Date: Sat, 3 Dec 2016 12:31:33 -0800
> From: Gianluca Borello <g.borello@gmail.com>
>
> Occasionally, clang (e.g. version 3.8.1) translates a sum between two
> constant operands using a BPF_OR instead of a BPF_ADD. The verifier is
> currently not handling this scenario, and the destination register type
> becomes UNKNOWN_VALUE even if it's still storing a constant. As a result,
> the destination register cannot be used as argument to a helper function
> expecting a ARG_CONST_STACK_*, limiting some use cases.
>
> Modify the verifier to handle this case, and add a few tests to make sure
> all combinations are supported, and stack boundaries are still verified
> even with BPF_OR.
>
> Signed-off-by: Gianluca Borello <g.borello@gmail.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Applied, but...
> diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
> index 3c59f96e3ed8..071431bedde8 100644
> --- a/tools/testing/selftests/bpf/.gitignore
> +++ b/tools/testing/selftests/bpf/.gitignore
> @@ -1,2 +1,3 @@
> test_verifier
> test_maps
> +test_lru_map
This had nothing to do with this change, nor was it mentioned in the
commit message.
Please do not do this in the future.
^ permalink raw reply
* Re: [PATCH] net: ethernet: ti: cpdma: use desc_read in chan_process instead of raw read
From: Grygorii Strashko @ 2016-12-05 18:47 UTC (permalink / raw)
To: Ivan Khoronzhuk, mugunthanvnm; +Cc: linux-omap, netdev, linux-kernel
In-Reply-To: <1480730715-16000-1-git-send-email-ivan.khoronzhuk@linaro.org>
On 12/02/2016 08:05 PM, Ivan Khoronzhuk wrote:
> There is desc_read() macros to read desc fields, so no need to
> use __raw_readl();
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
I'm going to update it all at once as part of [1].
[1] https://lkml.org/lkml/2016/12/1/781
> ---
> Based on net-next/master
>
> drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index c776e45..d96dca5 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -1132,7 +1132,7 @@ static int __cpdma_chan_process(struct cpdma_chan *chan)
> }
> desc_dma = desc_phys(pool, desc);
>
> - status = __raw_readl(&desc->hw_mode);
> + status = desc_read(desc, hw_mode);
> outlen = status & 0x7ff;
> if (status & CPDMA_DESC_OWNER) {
> chan->stats.busy_dequeue++;
>
--
regards,
-grygorii
^ permalink raw reply
* Re: [PATCH net-next] liquidio: 'imply' ptp instead of 'select'
From: Nicolas Pitre @ 2016-12-05 18:44 UTC (permalink / raw)
To: David Miller
Cc: arnd, felix.manlunas, tglx, david.daney, satananda.burla,
rvatsavayi, sgoutham, netdev, linux-kernel
In-Reply-To: <20161205.122029.1310361702811893159.davem@davemloft.net>
On Mon, 5 Dec 2016, David Miller wrote:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
> Date: Mon, 5 Dec 2016 10:44:32 -0500 (EST)
>
> > On Sat, 3 Dec 2016, David Miller wrote:
> >
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> Date: Sat, 3 Dec 2016 00:04:32 +0100
> >>
> >> > ptp now depends on the optional POSIX_TIMERS setting and fails to build
> >> > if we select it without that:
> >> >
> >> > warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet direct dependencies (NET && POSIX_TIMERS)
> >> > warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet direct dependencies (NET && POSIX_TIMERS)
> >> > ERROR: "posix_clock_unregister" [drivers/ptp/ptp.ko] undefined!
> >> > ERROR: "posix_clock_register" [drivers/ptp/ptp.ko] undefined!
> >> > ERROR: "pps_unregister_source" [drivers/ptp/ptp.ko] undefined!
> >> > ERROR: "pps_event" [drivers/ptp/ptp.ko] undefined!
> >> > ERROR: "pps_register_source" [drivers/ptp/ptp.ko] undefined!
> >> >
> >> > It seems that two patches have collided here, the build failure
> >> > is a result of the combination. Changing the new option to 'imply'
> >> > as well fixes it.
> >> >
> >> > Fixes: 111fc64a237f ("liquidio CN23XX: VF registration")
> >> > Fixes: d1cbfd771ce8 ("ptp_clock: Allow for it to be optional")
> >> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >>
> >> Like the kbuild robot, when I apply this it complains about 'imply' being
> >> an unknown option.
> >>
> >> I guess it worked for you because support for 'imply' exists in the -next
> >> tree and gets pulled in from somewhere else.
> >
> > Exact.
> >
> >> In any event, as-is I cannot apply this.
> >
> > It should be carried in linux-next for the time being, and suggested as
> > a probable "merge resolution" to Linus when submitting your tree for
> > merging. I think that's the best that can be done.
>
> This means the build of pure net-next is broken, which is unacceptble, as
> this is the tree that many developers do their work and build tests against.
Why would it be broken?
The only thing that needs to happen is for that "select" to be turned
into a "imply" when your tree is merged into Linus' tree. Or when your
tree is merged into linux-next (I'm sure Stephen can carry a patch to
that effect). It doesn't have to live in net-next directly.
The "imply" support has been available in linux-next for almost a month
now, and it has been discussed for much longer than that.
And if people forget then we'll fix it then. That's not a big issue.
Nicolas
^ permalink raw reply
* Re: [PATCH net-next] r8169: Add support for restarting auto-negotiation
From: David Miller @ 2016-12-05 18:39 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, hau, romieu, nic_swsd, linux-kernel
In-Reply-To: <20161203200119.1474-1-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat, 3 Dec 2016 12:01:19 -0800
> Implement ethtooll::nway_restart by utilizing mii_nway_restart.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Applied.
^ permalink raw reply
* Re: pull request: bluetooth-next 2016-12-03
From: David Miller @ 2016-12-05 18:38 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth, netdev
In-Reply-To: <20161203195341.GA17607@x1c.ukservers.net>
From: Johan Hedberg <johan.hedberg@gmail.com>
Date: Sat, 3 Dec 2016 19:53:41 +0000
> Here's a set of Bluetooth & 802.15.4 patches for net-next (i.e. 4.10
> kernel):
>
> - Fix for a potential NULL deref in the ieee802154 netlink code
> - Fix for the ED values of the at86rf2xx driver
> - Documentation updates to ieee802154
> - Cleanups to u8 vs __u8 usage
> - Timer API usage cleanups in HCI drivers
>
> Please let me know if there are any issues pulling. Thanks.
Pulled, thanks Johan.
^ permalink raw reply
* Re: [PATCH v2] net: ping: check minimum size on ICMP header length
From: David Miller @ 2016-12-05 18:36 UTC (permalink / raw)
To: keescook
Cc: netdev, mchong, i, kuznet, jmorris, yoshfuji, kaber, linux-kernel
In-Reply-To: <20161205183438.GA133528@beast>
From: Kees Cook <keescook@chromium.org>
Date: Mon, 5 Dec 2016 10:34:38 -0800
> Prior to commit c0371da6047a ("put iov_iter into msghdr") in v3.19, there
> was no check that the iovec contained enough bytes for an ICMP header,
> and the read loop would walk across neighboring stack contents. Since the
> iov_iter conversion, bad arguments are noticed, but the returned error is
> EFAULT. Returning EINVAL is a clearer error and also solves the problem
> prior to v3.19.
>
> This was found using trinity with KASAN on v3.18:
...
> CVE-2016-8399
>
> Reported-by: Qidan He <i@flanker017.me>
> Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* [PATCH v2] net: ping: check minimum size on ICMP header length
From: Kees Cook @ 2016-12-05 18:34 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Min Chong, Qidan He, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, linux-kernel
Prior to commit c0371da6047a ("put iov_iter into msghdr") in v3.19, there
was no check that the iovec contained enough bytes for an ICMP header,
and the read loop would walk across neighboring stack contents. Since the
iov_iter conversion, bad arguments are noticed, but the returned error is
EFAULT. Returning EINVAL is a clearer error and also solves the problem
prior to v3.19.
This was found using trinity with KASAN on v3.18:
BUG: KASAN: stack-out-of-bounds in memcpy_fromiovec+0x60/0x114 at addr ffffffc071077da0
Read of size 8 by task trinity-c2/9623
page:ffffffbe034b9a08 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x0()
page dumped because: kasan: bad access detected
CPU: 0 PID: 9623 Comm: trinity-c2 Tainted: G BU 3.18.0-dirty #15
Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
Call trace:
[<ffffffc000209c98>] dump_backtrace+0x0/0x1ac arch/arm64/kernel/traps.c:90
[<ffffffc000209e54>] show_stack+0x10/0x1c arch/arm64/kernel/traps.c:171
[< inline >] __dump_stack lib/dump_stack.c:15
[<ffffffc000f18dc4>] dump_stack+0x7c/0xd0 lib/dump_stack.c:50
[< inline >] print_address_description mm/kasan/report.c:147
[< inline >] kasan_report_error mm/kasan/report.c:236
[<ffffffc000373dcc>] kasan_report+0x380/0x4b8 mm/kasan/report.c:259
[< inline >] check_memory_region mm/kasan/kasan.c:264
[<ffffffc00037352c>] __asan_load8+0x20/0x70 mm/kasan/kasan.c:507
[<ffffffc0005b9624>] memcpy_fromiovec+0x5c/0x114 lib/iovec.c:15
[< inline >] memcpy_from_msg include/linux/skbuff.h:2667
[<ffffffc000ddeba0>] ping_common_sendmsg+0x50/0x108 net/ipv4/ping.c:674
[<ffffffc000dded30>] ping_v4_sendmsg+0xd8/0x698 net/ipv4/ping.c:714
[<ffffffc000dc91dc>] inet_sendmsg+0xe0/0x12c net/ipv4/af_inet.c:749
[< inline >] __sock_sendmsg_nosec net/socket.c:624
[< inline >] __sock_sendmsg net/socket.c:632
[<ffffffc000cab61c>] sock_sendmsg+0x124/0x164 net/socket.c:643
[< inline >] SYSC_sendto net/socket.c:1797
[<ffffffc000cad270>] SyS_sendto+0x178/0x1d8 net/socket.c:1761
CVE-2016-8399
Reported-by: Qidan He <i@flanker017.me>
Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
v2: return -EINVAL, Lorenzo.
---
net/ipv4/ping.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 205e2000d395..96b8e2b95731 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -657,6 +657,10 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
if (len > 0xFFFF)
return -EMSGSIZE;
+ /* Must have at least a full ICMP header. */
+ if (len < icmph_len)
+ return -EINVAL;
+
/*
* Check the flags.
*/
--
2.7.4
--
Kees Cook
Nexus Security
^ permalink raw reply related
* Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration
From: Netanel Belgazal @ 2016-12-05 18:32 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205042028.GF4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:20 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:23PM +0200, Netanel Belgazal wrote:
>> ENA default hash configure IPv4_frag hash twice instead of
> configure -> configures. You may want to include "erroneously". What
> is the consequence of this bug?
I'll fix and I'll add explain the effect of this bug.
>
>> configure non ip packets.
> configuring non-IP packets.
OK.
>
> --msw
>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_com.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
>> index 3066d9c..46aad3a 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_com.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_com.c
>> @@ -2184,7 +2184,7 @@ int ena_com_set_default_hash_ctrl(struct ena_com_dev *ena_dev)
>> hash_ctrl->selected_fields[ENA_ADMIN_RSS_IP4_FRAG].fields =
>> ENA_ADMIN_RSS_L3_SA | ENA_ADMIN_RSS_L3_DA;
>>
>> - hash_ctrl->selected_fields[ENA_ADMIN_RSS_IP4_FRAG].fields =
>> + hash_ctrl->selected_fields[ENA_ADMIN_RSS_NOT_IP].fields =
>> ENA_ADMIN_RSS_L2_DA | ENA_ADMIN_RSS_L2_SA;
>>
>> for (i = 0; i < ENA_ADMIN_RSS_PROTO_NUM; i++) {
^ permalink raw reply
* Re: [PATCH 0/8] irda: w83977af_ir: Neatening
From: David Miller @ 2016-12-05 18:33 UTC (permalink / raw)
To: joe; +Cc: netdev, arnd, samuel, linux-kernel
In-Reply-To: <1480961801.27883.4.camel@perches.com>
From: Joe Perches <joe@perches.com>
Date: Mon, 05 Dec 2016 10:16:41 -0800
> On Thu, 2016-11-24 at 11:10 -0800, Joe Perches wrote:
>> On top of Arnd's overly long udelay patch because I noticed a
>> misindented block.
>>
>> Even though I haven't turned on the netwinder in a box in in the
>> garage in who knows how long, if this device is still used somewhere,
>> might as well neaten the code too.
>
> Marked as "changes requested" in patchwork?
>
> I didn't see any change requested.
Sorry if I mis-marked it, please resubmit the series.
^ permalink raw reply
* Re: [PATCH v3 00/13] net: ethernet: ti: cpts: update and fixes
From: Grygorii Strashko @ 2016-12-05 18:31 UTC (permalink / raw)
To: Richard Cochran
Cc: David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA, Mugunthan V N,
Sekhar Nori, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
devicetree-u79uwXL29TY76Z2rM5mHXA, Murali Karicheri, Wingman Kwok,
Thomas Gleixner
In-Reply-To: <20161203092211.GA2762@netboy>
On 12/03/2016 03:22 AM, Richard Cochran wrote:
> On Fri, Dec 02, 2016 at 02:30:10PM -0600, Grygorii Strashko wrote:
>> It is preparation series intended to clean up and optimize TI CPTS driver to
>> facilitate further integration with other TI's SoCs like Keystone 2.
>>
>> Changes in v3:
>> - patches reordered: fixes and small updates moved first
>> - added comments in code about cpts->cc_mult
>> - conversation range (maxsec) limited to 10sec
>
> On net-next:
>
> $ git am ~/grygorii.strashko
> Applying: net: ethernet: ti: cpts: switch to readl/writel_relaxed()
> Applying: net: ethernet: ti: allow cpts to be built separately
> error: patch failed: drivers/net/ethernet/ti/cpsw.c:1963
> error: drivers/net/ethernet/ti/cpsw.c: patch does not apply
> Patch failed at 0002 net: ethernet: ti: allow cpts to be built separately
Sorry for that, also there build error due to patch reordering :(
>
> Also, you have the order of the SOB tags wrong. The author's SOB goes
> first.
Will fix and resend, sorry again.
--
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to the driver
From: Netanel Belgazal @ 2016-12-05 18:31 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205043113.GI4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:31 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:26PM +0200, Netanel Belgazal wrote:
>> The ENA device can update the ena driver about the desire timeouts.
>> The hardware hints are transmitted as Asynchronous event to the driver.
> This is really a new feature, not a bugfix - correct? If it is a new
> feature, submit it separately. If the built-in defaults need to be
> changed, submit that as a bugfix.
I'll submit this patch as a new feature.
There is a patch that sets the new defaults.
> --msw
>
>> In case the device does not support this capability, the driver
>> will use its own defines.
>>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 31 +++++++++
>> drivers/net/ethernet/amazon/ena/ena_com.c | 41 ++++++++---
>> drivers/net/ethernet/amazon/ena/ena_com.h | 5 ++
>> drivers/net/ethernet/amazon/ena/ena_ethtool.c | 1 -
>> drivers/net/ethernet/amazon/ena/ena_netdev.c | 86 +++++++++++++++++++-----
>> drivers/net/ethernet/amazon/ena/ena_netdev.h | 19 +++++-
>> drivers/net/ethernet/amazon/ena/ena_regs_defs.h | 2 +
>> 7 files changed, 157 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> index 6d70bf5..35ae511 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> @@ -70,6 +70,8 @@ enum ena_admin_aq_feature_id {
>>
>> ENA_ADMIN_MAX_QUEUES_NUM = 2,
>>
>> + ENA_ADMIN_HW_HINTS = 3,
>> +
>> ENA_ADMIN_RSS_HASH_FUNCTION = 10,
>>
>> ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
>> @@ -749,6 +751,31 @@ struct ena_admin_feature_rss_ind_table {
>> struct ena_admin_rss_ind_table_entry inline_entry;
>> };
>>
>> +/* When hint value is 0, driver should use it's own predefined value */
>> +struct ena_admin_ena_hw_hints {
>> + /* value in ms */
>> + u16 mmio_read_timeout;
>> +
>> + /* value in ms */
>> + u16 driver_watchdog_timeout;
>> +
>> + /* Per packet tx completion timeout. value in ms */
>> + u16 missing_tx_completion_timeout;
>> +
>> + u16 missed_tx_completion_count_threshold_to_reset;
>> +
>> + /* value in ms */
>> + u16 admin_completion_tx_timeout;
>> +
>> + u16 netdev_wd_timeout;
>> +
>> + u16 max_tx_sgl_size;
>> +
>> + u16 max_rx_sgl_size;
>> +
>> + u16 reserved[8];
>> +};
>> +
>> struct ena_admin_get_feat_cmd {
>> struct ena_admin_aq_common_desc aq_common_descriptor;
>>
>> @@ -782,6 +809,8 @@ struct ena_admin_get_feat_resp {
>> struct ena_admin_feature_rss_ind_table ind_table;
>>
>> struct ena_admin_feature_intr_moder_desc intr_moderation;
>> +
>> + struct ena_admin_ena_hw_hints hw_hints;
>> } u;
>> };
>>
>> @@ -857,6 +886,8 @@ enum ena_admin_aenq_notification_syndrom {
>> ENA_ADMIN_SUSPEND = 0,
>>
>> ENA_ADMIN_RESUME = 1,
>> +
>> + ENA_ADMIN_UPDATE_HINTS = 2,
>> };
>>
>> struct ena_admin_aenq_entry {
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
>> index 46aad3a..f1e4f04 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_com.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_com.c
>> @@ -508,15 +508,13 @@ static int ena_com_comp_status_to_errno(u8 comp_status)
>> static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,
>> struct ena_com_admin_queue *admin_queue)
>> {
>> - unsigned long flags;
>> - u32 start_time;
>> + unsigned long flags, timeout;
>> int ret;
>>
>> - start_time = ((u32)jiffies_to_usecs(jiffies));
>> + timeout = jiffies + usecs_to_jiffies(admin_queue->completion_timeout);
>>
>> while (comp_ctx->status == ENA_CMD_SUBMITTED) {
>> - if ((((u32)jiffies_to_usecs(jiffies)) - start_time) >
>> - ADMIN_CMD_TIMEOUT_US) {
>> + if (time_is_before_jiffies(timeout)) {
>> pr_err("Wait for completion (polling) timeout\n");
>> /* ENA didn't have any completion */
>> spin_lock_irqsave(&admin_queue->q_lock, flags);
>> @@ -560,7 +558,8 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
>> int ret;
>>
>> wait_for_completion_timeout(&comp_ctx->wait_event,
>> - usecs_to_jiffies(ADMIN_CMD_TIMEOUT_US));
>> + usecs_to_jiffies(
>> + admin_queue->completion_timeout));
>>
>> /* In case the command wasn't completed find out the root cause.
>> * There might be 2 kinds of errors
>> @@ -600,12 +599,14 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
>> struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read;
>> volatile struct ena_admin_ena_mmio_req_read_less_resp *read_resp =
>> mmio_read->read_resp;
>> - u32 mmio_read_reg, ret;
>> + u32 mmio_read_reg, timeout, ret;
>> unsigned long flags;
>> int i;
>>
>> might_sleep();
>>
>> + timeout = mmio_read->reg_read_to ? : ENA_REG_READ_TIMEOUT;
>> +
>> /* If readless is disabled, perform regular read */
>> if (!mmio_read->readless_supported)
>> return readl(ena_dev->reg_bar + offset);
>> @@ -626,14 +627,14 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
>>
>> writel(mmio_read_reg, ena_dev->reg_bar + ENA_REGS_MMIO_REG_READ_OFF);
>>
>> - for (i = 0; i < ENA_REG_READ_TIMEOUT; i++) {
>> + for (i = 0; i < timeout; i++) {
>> if (read_resp->req_id == mmio_read->seq_num)
>> break;
>>
>> udelay(1);
>> }
>>
>> - if (unlikely(i == ENA_REG_READ_TIMEOUT)) {
>> + if (unlikely(i == timeout)) {
>> pr_err("reading reg failed for timeout. expected: req id[%hu] offset[%hu] actual: req id[%hu] offset[%hu]\n",
>> mmio_read->seq_num, offset, read_resp->req_id,
>> read_resp->reg_off);
>> @@ -1717,6 +1718,20 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
>> memcpy(&get_feat_ctx->offload, &get_resp.u.offload,
>> sizeof(get_resp.u.offload));
>>
>> + /* Driver hints isn't mandatory admin command. So in case the
>> + * command isn't supported set driver hints to 0
>> + */
>> + rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_HW_HINTS);
>> +
>> + if (!rc)
>> + memcpy(&get_feat_ctx->hw_hints, &get_resp.u.hw_hints,
>> + sizeof(get_resp.u.hw_hints));
>> + else if (rc == -EPERM)
>> + memset(&get_feat_ctx->hw_hints, 0x0,
>> + sizeof(get_feat_ctx->hw_hints));
>> + else
>> + return rc;
>> +
>> return 0;
>> }
>>
>> @@ -1842,6 +1857,14 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev)
>> return rc;
>> }
>>
>> + timeout = (cap & ENA_REGS_CAPS_ADMIN_CMD_TO_MASK) >>
>> + ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT;
>> + if (timeout)
>> + /* the resolution of timeout reg is 100ms */
>> + ena_dev->admin_queue.completion_timeout = timeout * 100000;
>> + else
>> + ena_dev->admin_queue.completion_timeout = ADMIN_CMD_TIMEOUT_US;
>> +
>> return 0;
>> }
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h
>> index 509d7b8..6883ee5 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_com.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_com.h
>> @@ -96,6 +96,8 @@
>> #define ENA_INTR_MODER_LEVEL_STRIDE 2
>> #define ENA_INTR_BYTE_COUNT_NOT_SUPPORTED 0xFFFFFF
>>
>> +#define ENA_HW_HINTS_NO_TIMEOUT 0xFFFF
>> +
>> enum ena_intr_moder_level {
>> ENA_INTR_MODER_LOWEST = 0,
>> ENA_INTR_MODER_LOW,
>> @@ -232,6 +234,7 @@ struct ena_com_admin_queue {
>> void *q_dmadev;
>> spinlock_t q_lock; /* spinlock for the admin queue */
>> struct ena_comp_ctx *comp_ctx;
>> + u32 completion_timeout;
>> u16 q_depth;
>> struct ena_com_admin_cq cq;
>> struct ena_com_admin_sq sq;
>> @@ -266,6 +269,7 @@ struct ena_com_aenq {
>> struct ena_com_mmio_read {
>> struct ena_admin_ena_mmio_req_read_less_resp *read_resp;
>> dma_addr_t read_resp_dma_addr;
>> + u32 reg_read_to; /* in us */
>> u16 seq_num;
>> bool readless_supported;
>> /* spin lock to ensure a single outstanding read */
>> @@ -335,6 +339,7 @@ struct ena_com_dev_get_features_ctx {
>> struct ena_admin_device_attr_feature_desc dev_attr;
>> struct ena_admin_feature_aenq_desc aenq;
>> struct ena_admin_feature_offload_desc offload;
>> + struct ena_admin_ena_hw_hints hw_hints;
>> };
>>
>> struct ena_com_create_io_ctx {
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
>> index 67b2338f..a1fbfc2 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
>> @@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = {
>> ENA_STAT_TX_ENTRY(tx_poll),
>> ENA_STAT_TX_ENTRY(doorbells),
>> ENA_STAT_TX_ENTRY(prepare_ctx_err),
>> - ENA_STAT_TX_ENTRY(missing_tx_comp),
>> ENA_STAT_TX_ENTRY(bad_req_id),
>> };
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> index 962ffb5..0b718ee 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> @@ -1981,6 +1981,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev)
>>
>> tx_info->tx_descs = nb_hw_desc;
>> tx_info->last_jiffies = jiffies;
>> + tx_info->print_once = 0;
>>
>> tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use,
>> tx_ring->ring_size);
>> @@ -2554,33 +2555,34 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter)
>> if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
>> return;
>>
>> + if (adapter->missing_tx_completion_to == ENA_HW_HINTS_NO_TIMEOUT)
>> + return;
>> +
>> budget = ENA_MONITORED_TX_QUEUES;
>>
>> for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) {
>> tx_ring = &adapter->tx_ring[i];
>>
>> + missed_tx = 0;
>> +
>> for (j = 0; j < tx_ring->ring_size; j++) {
>> tx_buf = &tx_ring->tx_buffer_info[j];
>> last_jiffies = tx_buf->last_jiffies;
>> - if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
>> - netif_notice(adapter, tx_err, adapter->netdev,
>> - "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
>> - tx_ring->qid, j);
>> + if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + adapter->missing_tx_completion_to))) {
>> + if (!tx_buf->print_once)
>> + netif_notice(adapter, tx_err, adapter->netdev,
>> + "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
>> + tx_ring->qid, j);
>>
>> - u64_stats_update_begin(&tx_ring->syncp);
>> - missed_tx = tx_ring->tx_stats.missing_tx_comp++;
>> - u64_stats_update_end(&tx_ring->syncp);
>> + tx_buf->print_once = 1;
>> + missed_tx++;
>>
>> - /* Clear last jiffies so the lost buffer won't
>> - * be counted twice.
>> - */
>> - tx_buf->last_jiffies = 0;
>> -
>> - if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
>> + if (unlikely(missed_tx > adapter->missing_tx_completion_threshold)) {
>> netif_err(adapter, tx_err, adapter->netdev,
>> "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n",
>> - missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
>> + missed_tx, adapter->missing_tx_completion_threshold);
>> set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
>> + return;
>> }
>> }
>> }
>> @@ -2601,8 +2603,11 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter)
>> if (!adapter->wd_state)
>> return;
>>
>> - keep_alive_expired = round_jiffies(adapter->last_keep_alive_jiffies
>> - + ENA_DEVICE_KALIVE_TIMEOUT);
>> + if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT)
>> + return;
>> +
>> + keep_alive_expired = round_jiffies(adapter->last_keep_alive_jiffies +
>> + adapter->keep_alive_timeout);
>> if (unlikely(time_is_before_jiffies(keep_alive_expired))) {
>> netif_err(adapter, drv, adapter->netdev,
>> "Keep alive watchdog timeout.\n");
>> @@ -2625,6 +2630,44 @@ static void check_for_admin_com_state(struct ena_adapter *adapter)
>> }
>> }
>>
>> +static void ena_update_hints(struct ena_adapter *adapter,
>> + struct ena_admin_ena_hw_hints *hints)
>> +{
>> + struct net_device *netdev = adapter->netdev;
>> +
>> + if (hints->admin_completion_tx_timeout)
>> + adapter->ena_dev->admin_queue.completion_timeout =
>> + hints->admin_completion_tx_timeout * 1000;
>> +
>> + if (hints->mmio_read_timeout)
>> + /* convert to usec */
>> + adapter->ena_dev->mmio_read.reg_read_to =
>> + hints->mmio_read_timeout * 1000;
>> +
>> + if (hints->missed_tx_completion_count_threshold_to_reset)
>> + adapter->missing_tx_completion_threshold =
>> + hints->missed_tx_completion_count_threshold_to_reset;
>> +
>> + if (hints->missing_tx_completion_timeout) {
>> + if (hints->missing_tx_completion_timeout == ENA_HW_HINTS_NO_TIMEOUT)
>> + adapter->missing_tx_completion_to = ENA_HW_HINTS_NO_TIMEOUT;
>> + else
>> + adapter->missing_tx_completion_to =
>> + msecs_to_jiffies(hints->missing_tx_completion_timeout);
>> + }
>> +
>> + if (hints->netdev_wd_timeout)
>> + netdev->watchdog_timeo = msecs_to_jiffies(hints->netdev_wd_timeout);
>> +
>> + if (hints->driver_watchdog_timeout) {
>> + if (hints->driver_watchdog_timeout == ENA_HW_HINTS_NO_TIMEOUT)
>> + adapter->keep_alive_timeout = ENA_HW_HINTS_NO_TIMEOUT;
>> + else
>> + adapter->keep_alive_timeout =
>> + msecs_to_jiffies(hints->driver_watchdog_timeout);
>> + }
>> +}
>> +
>> static void ena_update_host_info(struct ena_admin_host_info *host_info,
>> struct net_device *netdev)
>> {
>> @@ -3036,6 +3079,11 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> INIT_WORK(&adapter->reset_task, ena_fw_reset_device);
>>
>> adapter->last_keep_alive_jiffies = jiffies;
>> + adapter->keep_alive_timeout = ENA_DEVICE_KALIVE_TIMEOUT;
>> + adapter->missing_tx_completion_to = TX_TIMEOUT;
>> + adapter->missing_tx_completion_threshold = MAX_NUM_OF_TIMEOUTED_PACKETS;
>> +
>> + ena_update_hints(adapter, &get_feat_ctx.hw_hints);
>>
>> init_timer(&adapter->timer_service);
>> adapter->timer_service.expires = round_jiffies(jiffies + HZ);
>> @@ -3256,6 +3304,7 @@ static void ena_notification(void *adapter_data,
>> struct ena_admin_aenq_entry *aenq_e)
>> {
>> struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
>> + struct ena_admin_ena_hw_hints *hints;
>>
>> WARN(aenq_e->aenq_common_desc.group != ENA_ADMIN_NOTIFICATION,
>> "Invalid group(%x) expected %x\n",
>> @@ -3273,6 +3322,11 @@ static void ena_notification(void *adapter_data,
>> case ENA_ADMIN_RESUME:
>> queue_work(ena_wq, &adapter->resume_io_task);
>> break;
>> + case ENA_ADMIN_UPDATE_HINTS:
>> + hints = (struct ena_admin_ena_hw_hints *)
>> + (&aenq_e->inline_data_w4);
>> + ena_update_hints(adapter, hints);
>> + break;
>> default:
>> netif_err(adapter, drv, adapter->netdev,
>> "Invalid aenq notification link state %d\n",
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> index f0ddc11..2897fab 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> @@ -146,7 +146,18 @@ struct ena_tx_buffer {
>> u32 tx_descs;
>> /* num of buffers used by this skb */
>> u32 num_of_bufs;
>> - /* Save the last jiffies to detect missing tx packets */
>> +
>> + /* Used for detect missing tx packets to limit the number of prints */
>> + u32 print_once;
>> + /* Save the last jiffies to detect missing tx packets
>> + *
>> + * sets to non zero value on ena_start_xmit and set to zero on
>> + * napi and timer_Service_routine.
>> + *
>> + * while this value is not protected by lock,
>> + * a given packet is not expected to be handled by ena_start_xmit
>> + * and by napi/timer_service at the same time.
>> + */
>> unsigned long last_jiffies;
>> struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
>> } ____cacheline_aligned;
>> @@ -170,7 +181,6 @@ struct ena_stats_tx {
>> u64 napi_comp;
>> u64 tx_poll;
>> u64 doorbells;
>> - u64 missing_tx_comp;
>> u64 bad_req_id;
>> };
>>
>> @@ -270,6 +280,8 @@ struct ena_adapter {
>> struct msix_entry *msix_entries;
>> int msix_vecs;
>>
>> + u32 missing_tx_completion_threshold;
>> +
>> u32 tx_usecs, rx_usecs; /* interrupt moderation */
>> u32 tx_frames, rx_frames; /* interrupt moderation */
>>
>> @@ -283,6 +295,9 @@ struct ena_adapter {
>>
>> u8 mac_addr[ETH_ALEN];
>>
>> + unsigned long keep_alive_timeout;
>> + unsigned long missing_tx_completion_to;
>> +
>> char name[ENA_NAME_MAX_LEN];
>>
>> unsigned long flags;
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_regs_defs.h b/drivers/net/ethernet/amazon/ena/ena_regs_defs.h
>> index 26097a2..c3891c5 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_regs_defs.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_regs_defs.h
>> @@ -78,6 +78,8 @@
>> #define ENA_REGS_CAPS_RESET_TIMEOUT_MASK 0x3e
>> #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT 8
>> #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK 0xff00
>> +#define ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT 16
>> +#define ENA_REGS_CAPS_ADMIN_CMD_TO_MASK 0xf0000
>>
>> /* aq_caps register */
>> #define ENA_REGS_AQ_CAPS_AQ_DEPTH_MASK 0xffff
^ permalink raw reply
* Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild
From: Netanel Belgazal @ 2016-12-05 18:30 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205042915.GH4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:29 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:24PM +0200, Netanel Belgazal wrote:
>> If for some reason the device stop responding and the device reset failed
>> to recover the device, the mmio register read datastructure will not be
>> reinitialized.
> If for some reason the device stops responding, and the device reset
> fails to recover the device, the MMIO register read data structure
> will not be reinitialized.
OK
>
>> On driver removal, the driver will also tries to reset the device
>> but this time the mmio data structure will be NULL.
> On driver removal, the driver will also try to reset the device, but
> this time the MMIO data structure will be NULL.
OK
>> To solve this issue perform the device reset in the remove function only if
>> the device is runnig.
> To solve this issue, perform the device reset in the remove function
> only if the device is running.
>
> Do you have an example of the NULL pointer dereference that you can
> paste in? It can be helpful for those searching for a fix for a bug
> they've experienced.
I'll add a crash dump.
> --msw
>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> index 224302c..ad5f78f 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> @@ -2516,6 +2516,8 @@ static void ena_fw_reset_device(struct work_struct *work)
>> err:
>> rtnl_unlock();
>>
>> + clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
>> +
>> dev_err(&pdev->dev,
>> "Reset attempt failed. Can not reset the device\n");
>> }
>> @@ -3126,7 +3128,9 @@ static void ena_remove(struct pci_dev *pdev)
>>
>> cancel_work_sync(&adapter->resume_io_task);
>>
>> - ena_com_dev_reset(ena_dev);
>> + /* Reset the device only if the device is running. */
>> + if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
>> + ena_com_dev_reset(ena_dev);
>>
>> ena_free_mgmnt_irq(adapter);
>>
^ permalink raw reply
* Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be atomic context safe
From: Netanel Belgazal @ 2016-12-05 18:29 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205042435.GG4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:24 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:25PM +0200, Netanel Belgazal wrote:
>> ndo_get_stat64 can be called from atomic context.
>> However the current implementation sends an admin command to retrieve
>> the statistics from the device.
>> This admin commands uses sleep.
> Suggest some comment edits:
>
> ndo_get_stat64() can be called from atomic context, but the current
> implementation sends an admin command to retrieve the statistics from
> the device. This admin command can sleep.
>
>> Refactor the implementation of ena_get_stats64 to take the
>> {rx,tx}bytes/cnt from the driver's inner counters
>> and to take the rx drops counter
>> from the asynchronous keep alive (heart bit) event.
> This patch re-factors the implementation of ena_get_stats64() to use
> the {rx,tx}bytes/count from the driver's inner counters, and to obtain
> the rx drop counter from the asynchronous keep alive (heart bit)
> event.
Applied
> --msw
>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 8 ++++
>> drivers/net/ethernet/amazon/ena/ena_netdev.c | 57 +++++++++++++++++-------
>> drivers/net/ethernet/amazon/ena/ena_netdev.h | 1 +
>> 3 files changed, 51 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> index f48c886..6d70bf5 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> @@ -873,6 +873,14 @@ struct ena_admin_aenq_link_change_desc {
>> u32 flags;
>> };
>>
>> +struct ena_admin_aenq_keep_alive_desc {
>> + struct ena_admin_aenq_common_desc aenq_common_desc;
>> +
>> + u32 rx_drops_low;
>> +
>> + u32 rx_drops_high;
>> +};
>> +
>> struct ena_admin_ena_mmio_req_read_less_resp {
>> u16 req_id;
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> index ad5f78f..962ffb5 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> @@ -2176,28 +2176,46 @@ static struct rtnl_link_stats64 *ena_get_stats64(struct net_device *netdev,
>> struct rtnl_link_stats64 *stats)
>> {
>> struct ena_adapter *adapter = netdev_priv(netdev);
>> - struct ena_admin_basic_stats ena_stats;
>> - int rc;
>> + struct ena_ring *rx_ring, *tx_ring;
>> + unsigned int start;
>> + u64 rx_drops;
>> + int i;
>>
>> if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
>> return NULL;
>>
>> - rc = ena_com_get_dev_basic_stats(adapter->ena_dev, &ena_stats);
>> - if (rc)
>> - return NULL;
>> + for (i = 0; i < adapter->num_queues; i++) {
>> + u64 bytes, packets;
>> +
>> + tx_ring = &adapter->tx_ring[i];
>> +
>> + do {
>> + start = u64_stats_fetch_begin_irq(&tx_ring->syncp);
>> + packets = tx_ring->tx_stats.cnt;
>> + bytes = tx_ring->tx_stats.bytes;
>> + } while (u64_stats_fetch_retry_irq(&tx_ring->syncp, start));
>> +
>> + stats->tx_packets += packets;
>> + stats->tx_bytes += bytes;
>>
>> - stats->tx_bytes = ((u64)ena_stats.tx_bytes_high << 32) |
>> - ena_stats.tx_bytes_low;
>> - stats->rx_bytes = ((u64)ena_stats.rx_bytes_high << 32) |
>> - ena_stats.rx_bytes_low;
>> + rx_ring = &adapter->rx_ring[i];
>> +
>> + do {
>> + start = u64_stats_fetch_begin_irq(&rx_ring->syncp);
>> + packets = rx_ring->rx_stats.cnt;
>> + bytes = rx_ring->rx_stats.bytes;
>> + } while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start));
>>
>> - stats->rx_packets = ((u64)ena_stats.rx_pkts_high << 32) |
>> - ena_stats.rx_pkts_low;
>> - stats->tx_packets = ((u64)ena_stats.tx_pkts_high << 32) |
>> - ena_stats.tx_pkts_low;
>> + stats->rx_packets += packets;
>> + stats->rx_bytes += bytes;
>> + }
>> +
>> + do {
>> + start = u64_stats_fetch_begin_irq(&adapter->syncp);
>> + rx_drops = adapter->dev_stats.rx_drops;
>> + } while (u64_stats_fetch_retry_irq(&adapter->syncp, start));
>>
>> - stats->rx_dropped = ((u64)ena_stats.rx_drops_high << 32) |
>> - ena_stats.rx_drops_low;
>> + stats->rx_dropped = rx_drops;
>>
>> stats->multicast = 0;
>> stats->collisions = 0;
>> @@ -3221,8 +3239,17 @@ static void ena_keep_alive_wd(void *adapter_data,
>> struct ena_admin_aenq_entry *aenq_e)
>> {
>> struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
>> + struct ena_admin_aenq_keep_alive_desc *desc;
>> + u64 rx_drops;
>>
>> + desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
>> adapter->last_keep_alive_jiffies = jiffies;
>> +
>> + rx_drops = ((u64)desc->rx_drops_high << 32) | desc->rx_drops_low;
>> +
>> + u64_stats_update_begin(&adapter->syncp);
>> + adapter->dev_stats.rx_drops = rx_drops;
>> + u64_stats_update_end(&adapter->syncp);
>> }
>>
>> static void ena_notification(void *adapter_data,
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> index 69d7e9e..f0ddc11 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> @@ -241,6 +241,7 @@ struct ena_stats_dev {
>> u64 interface_up;
>> u64 interface_down;
>> u64 admin_q_pause;
>> + u64 rx_drops;
>> };
>>
>> enum ena_flags_t {
^ permalink raw reply
* Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode
From: Netanel Belgazal @ 2016-12-05 18:29 UTC (permalink / raw)
To: Eric Dumazet
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <1480916739.18162.516.camel@edumazet-glaptop3.roam.corp.google.com>
On 12/05/2016 07:45 AM, Eric Dumazet wrote:
> On Sun, 2016-12-04 at 15:19 +0200, Netanel Belgazal wrote:
>> sk_busy_loop can call the napi callback few million times a sec.
>> For each call there is unmask interrupt.
>> We want to reduce the number of unmasks.
>>
>> Add an atomic variable that will tell the napi handler if
>> it was called from irq context or not.
>> Unmask the interrupt only from irq context.
>>
>> A schenario where the driver left with missed unmask isn't feasible.
>> when ena_intr_msix_io is called the driver have 2 options:
>> 1)Before napi completes and call napi_complete_done
>> 2)After calling napi_complete_done
>>
>> In the former case the napi will unmask the interrupt as needed.
>> In the latter case napi_complete_done will remove napi from the schedule
>> list so napi will be rescheduled (by ena_intr_msix_io) and interrupt
>> will be unmasked as desire in the 2nd napi call.
>>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>
> This looks very complicated to me.
>
> I guess you missed the recent patches that happened on net-next ?
You are correct.
I didn't see the patches.
It is much better to use the napi_complete_done() return value.
I'll rework my patch.
>
> 2e713283751f494596655d9125c168aeb913f71d net/mlx4_en: use napi_complete_done() return value
> 364b6055738b4c752c30ccaaf25c624e69d76195 net: busy-poll: return busypolling status to drivers
> 21cb84c48ca0619181106f0f44f3802a989de024 net: busy-poll: remove need_resched() from sk_can_busy_loop()
> 217f6974368188fd8bd7804bf5a036aa5762c5e4 net: busy-poll: allow preemption in sk_busy_loop()
>
> napi_complete_done() return code can be used by a driver,
> no need to add yet another atomic operation in fast path.
>
> Anyway, this looks wrong :
>
> @@ -1186,6 +1201,7 @@ static irqreturn_t ena_intr_msix_io(int irq, void *data)
> {
> struct ena_napi *ena_napi = data;
>
> + atomic_set(&ena_napi->unmask_interrupt, 1);
> napi_schedule(&ena_napi->napi);
>
> You probably wanted :
>
> if (napi_schedule_prep(n)) {
> atomic_set(&ena_napi->unmask_interrupt, 1);
> __napi_schedule(n);
> }
>
>
>
> Please rework this napi poll using core infrastructure.
>
> busypoll logic should be centralized, not reimplemented in different ways in a driver.
>
> Thanks.
>
>
>
^ permalink raw reply
* Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts
From: Netanel Belgazal @ 2016-12-05 18:28 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205043524.GJ4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:35 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:31PM +0200, Netanel Belgazal wrote:
>
> ... because? (they turned out to be too aggressive, I believe.)
Yes, The timeout were too aggressive on some specific machines.
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_com.c | 4 ++--
>> drivers/net/ethernet/amazon/ena/ena_netdev.h | 7 ++++---
>> 2 files changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
>> index 4147d6e..a550c8a 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_com.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_com.c
>> @@ -36,9 +36,9 @@
>> /*****************************************************************************/
>>
>> /* Timeout in micro-sec */
>> -#define ADMIN_CMD_TIMEOUT_US (1000000)
>> +#define ADMIN_CMD_TIMEOUT_US (3000000)
>>
>> -#define ENA_ASYNC_QUEUE_DEPTH 4
>> +#define ENA_ASYNC_QUEUE_DEPTH 16
> Why is this changed at the same time?
It related to the too aggressive thresholds.
On some heavy loaded system we reached to a state where the AENQ
was full so the driver missed some events.
>
>> #define ENA_ADMIN_QUEUE_DEPTH 32
>>
>> #define MIN_ENA_VER (((ENA_COMMON_SPEC_VERSION_MAJOR) << \
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> index c081fd3..ed42e07 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
>> @@ -39,6 +39,7 @@
>> #include <linux/interrupt.h>
>> #include <linux/netdevice.h>
>> #include <linux/skbuff.h>
>> +#include <linux/u64_stats_sync.h>
> This change seems unrelated.
Removed to a different patch (will be submitted in a new patchset)
>
>> #include "ena_com.h"
>> #include "ena_eth_com.h"
>> @@ -100,7 +101,7 @@
>> /* Number of queues to check for missing queues per timer service */
>> #define ENA_MONITORED_TX_QUEUES 4
>> /* Max timeout packets before device reset */
>> -#define MAX_NUM_OF_TIMEOUTED_PACKETS 32
>> +#define MAX_NUM_OF_TIMEOUTED_PACKETS 128
>>
>> #define ENA_TX_RING_IDX_NEXT(idx, ring_size) (((idx) + 1) & ((ring_size) - 1))
>>
>> @@ -116,9 +117,9 @@
>> #define ENA_IO_IRQ_IDX(q) (ENA_IO_IRQ_FIRST_IDX + (q))
>>
>> /* ENA device should send keep alive msg every 1 sec.
>> - * We wait for 3 sec just to be on the safe side.
>> + * We wait for 6 sec just to be on the safe side.
>> */
>> -#define ENA_DEVICE_KALIVE_TIMEOUT (3 * HZ)
>> +#define ENA_DEVICE_KALIVE_TIMEOUT (6 * HZ)
>>
>> #define ENA_MMIO_DISABLE_REG_READ BIT(0)
>>
^ permalink raw reply
* Re: [PATCH 1/1] atm: lanai: set error code when ioremap fails
From: David Miller @ 2016-12-05 18:28 UTC (permalink / raw)
To: bianpan2016; +Cc: 3chas3, linux-atm-general, netdev, linux-kernel
In-Reply-To: <1480767945-5676-1-git-send-email-bianpan2016@163.com>
From: Pan Bian <bianpan2016@163.com>
Date: Sat, 3 Dec 2016 20:25:45 +0800
> In function lanai_dev_open(), when the call to ioremap() fails, the
> value of return variable result is 0. 0 means no error in this context.
> This patch fixes the bug, assigning "-ENOMEM" to result when ioremap()
> returns a NULL pointer.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188791
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Applied.
^ permalink raw reply
* Re: [PATCH 1/1] net: bridge: set error code on failure
From: David Miller @ 2016-12-05 18:27 UTC (permalink / raw)
To: bianpan2016; +Cc: netdev, bridge, linux-kernel
In-Reply-To: <1480764803-5577-1-git-send-email-bianpan2016@163.com>
From: Pan Bian <bianpan2016@163.com>
Date: Sat, 3 Dec 2016 19:33:23 +0800
> Function br_sysfs_addbr() does not set error code when the call
> kobject_create_and_add() returns a NULL pointer. It may be better to
> return "-ENOMEM" when kobject_create_and_add() fails.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Applied.
^ permalink raw reply
* Re: [PATCH 1/1] net: usb: set error code when usb_alloc_urb fails
From: David Miller @ 2016-12-05 18:27 UTC (permalink / raw)
To: bianpan2016; +Cc: woojung.huh, UNGLinuxDriver, netdev, linux-usb, linux-kernel
In-Reply-To: <1480764288-5448-1-git-send-email-bianpan2016@163.com>
From: Pan Bian <bianpan2016@163.com>
Date: Sat, 3 Dec 2016 19:24:48 +0800
> In function lan78xx_probe(), variable ret takes the errno code on
> failures. However, when the call to usb_alloc_urb() fails, its value
> will keeps 0. 0 indicates success in the context, which is inconsistent
> with the execution result. This patch fixes the bug, assigning
> "-ENOMEM" to ret when usb_alloc_urb() returns a NULL pointer.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188771
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Applied.
^ permalink raw reply
* Re: [PATCH 1/1] netdev: broadcom: propagate error code
From: David Miller @ 2016-12-05 18:26 UTC (permalink / raw)
To: bianpan2016
Cc: michael.chan, prashant.sreedharan, sbaddipa, netdev, linux-kernel
In-Reply-To: <1480758977-4234-1-git-send-email-bianpan2016@163.com>
From: Pan Bian <bianpan2016@163.com>
Date: Sat, 3 Dec 2016 17:56:17 +0800
> Function bnxt_hwrm_stat_ctx_alloc() always returns 0, even if the call
> to _hwrm_send_message() fails. It may be better to propagate the errors
> to the caller of bnxt_hwrm_stat_ctx_alloc().
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188661
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Applied.
^ permalink raw reply
* Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration
From: Netanel Belgazal @ 2016-12-05 18:26 UTC (permalink / raw)
To: Matt Wilson
Cc: linux-kernel, davem, netdev, dwmw, zorik, alex, saeed, msw,
aliguori, nafea
In-Reply-To: <20161205041815.GE4310@u54ee753d2d1854bda401.ant.amazon.com>
On 12/05/2016 06:18 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:22PM +0200, Netanel Belgazal wrote:
>> ena_flow_data_to_flow_hash and ena_flow_hash_to_flow_type
>> treat the ena_flow_hash_to_flow_type enum as power of two values.
>>
>> Change the values of ena_admin_flow_hash_fields to be power of two values.
> Then I generally prefer BIT(0), BIT(1), BIT(2), etc.
I'll use BIT(x)
>
> Also it would be helpful to include some comments about the
> consequences of the current state of the code.
I'll add explanation.
>
> --msw
>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>> drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> index a46e749..f48c886 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> +++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h
>> @@ -631,22 +631,22 @@ enum ena_admin_flow_hash_proto {
>> /* RSS flow hash fields */
>> enum ena_admin_flow_hash_fields {
>> /* Ethernet Dest Addr */
>> - ENA_ADMIN_RSS_L2_DA = 0,
>> + ENA_ADMIN_RSS_L2_DA = 0x1,
>>
>> /* Ethernet Src Addr */
>> - ENA_ADMIN_RSS_L2_SA = 1,
>> + ENA_ADMIN_RSS_L2_SA = 0x2,
>>
>> /* ipv4/6 Dest Addr */
>> - ENA_ADMIN_RSS_L3_DA = 2,
>> + ENA_ADMIN_RSS_L3_DA = 0x4,
>>
>> /* ipv4/6 Src Addr */
>> - ENA_ADMIN_RSS_L3_SA = 5,
>> + ENA_ADMIN_RSS_L3_SA = 0x8,
>>
>> /* tcp/udp Dest Port */
>> - ENA_ADMIN_RSS_L4_DP = 6,
>> + ENA_ADMIN_RSS_L4_DP = 0x10,
>>
>> /* tcp/udp Src Port */
>> - ENA_ADMIN_RSS_L4_SP = 7,
>> + ENA_ADMIN_RSS_L4_SP = 0x20,
>> };
>>
>> struct ena_admin_proto_input {
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox