diff options
64 files changed, 500 insertions, 299 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c9ac06cfe6b7..a5115fb7cf33 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -2471,7 +2471,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
| 2471 | bond_slave_state_change(bond); | 2471 | bond_slave_state_change(bond); |
| 2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) | 2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) |
| 2473 | bond_update_slave_arr(bond, NULL); | 2473 | bond_update_slave_arr(bond, NULL); |
| 2474 | } else if (do_failover) { | 2474 | } |
| 2475 | if (do_failover) { | ||
| 2475 | block_netpoll_tx(); | 2476 | block_netpoll_tx(); |
| 2476 | bond_select_active_slave(bond); | 2477 | bond_select_active_slave(bond); |
| 2477 | unblock_netpoll_tx(); | 2478 | unblock_netpoll_tx(); |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 02492d241e4c..2cfe5012e4e5 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -110,7 +110,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, | |||
| 110 | long rate; | 110 | long rate; |
| 111 | u64 v64; | 111 | u64 v64; |
| 112 | 112 | ||
| 113 | /* Use CIA recommended sample points */ | 113 | /* Use CiA recommended sample points */ |
| 114 | if (bt->sample_point) { | 114 | if (bt->sample_point) { |
| 115 | sampl_pt = bt->sample_point; | 115 | sampl_pt = bt->sample_point; |
| 116 | } else { | 116 | } else { |
| @@ -382,7 +382,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx) | |||
| 382 | BUG_ON(idx >= priv->echo_skb_max); | 382 | BUG_ON(idx >= priv->echo_skb_max); |
| 383 | 383 | ||
| 384 | if (priv->echo_skb[idx]) { | 384 | if (priv->echo_skb[idx]) { |
| 385 | kfree_skb(priv->echo_skb[idx]); | 385 | dev_kfree_skb_any(priv->echo_skb[idx]); |
| 386 | priv->echo_skb[idx] = NULL; | 386 | priv->echo_skb[idx] = NULL; |
| 387 | } | 387 | } |
| 388 | } | 388 | } |
diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig index fca5482c09ac..04f20dd39007 100644 --- a/drivers/net/can/m_can/Kconfig +++ b/drivers/net/can/m_can/Kconfig | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | config CAN_M_CAN | 1 | config CAN_M_CAN |
| 2 | depends on HAS_IOMEM | ||
| 2 | tristate "Bosch M_CAN devices" | 3 | tristate "Bosch M_CAN devices" |
| 3 | ---help--- | 4 | ---help--- |
| 4 | Say Y here if you want to support for Bosch M_CAN controller. | 5 | Say Y here if you want to support for Bosch M_CAN controller. |
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 10d571eaed85..d7bc462aafdc 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c | |||
| @@ -105,14 +105,36 @@ enum m_can_mram_cfg { | |||
| 105 | MRAM_CFG_NUM, | 105 | MRAM_CFG_NUM, |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | /* Fast Bit Timing & Prescaler Register (FBTP) */ | ||
| 109 | #define FBTR_FBRP_MASK 0x1f | ||
| 110 | #define FBTR_FBRP_SHIFT 16 | ||
| 111 | #define FBTR_FTSEG1_SHIFT 8 | ||
| 112 | #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) | ||
| 113 | #define FBTR_FTSEG2_SHIFT 4 | ||
| 114 | #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) | ||
| 115 | #define FBTR_FSJW_SHIFT 0 | ||
| 116 | #define FBTR_FSJW_MASK 0x3 | ||
| 117 | |||
| 108 | /* Test Register (TEST) */ | 118 | /* Test Register (TEST) */ |
| 109 | #define TEST_LBCK BIT(4) | 119 | #define TEST_LBCK BIT(4) |
| 110 | 120 | ||
| 111 | /* CC Control Register(CCCR) */ | 121 | /* CC Control Register(CCCR) */ |
| 112 | #define CCCR_TEST BIT(7) | 122 | #define CCCR_TEST BIT(7) |
| 113 | #define CCCR_MON BIT(5) | 123 | #define CCCR_CMR_MASK 0x3 |
| 114 | #define CCCR_CCE BIT(1) | 124 | #define CCCR_CMR_SHIFT 10 |
| 115 | #define CCCR_INIT BIT(0) | 125 | #define CCCR_CMR_CANFD 0x1 |
| 126 | #define CCCR_CMR_CANFD_BRS 0x2 | ||
| 127 | #define CCCR_CMR_CAN 0x3 | ||
| 128 | #define CCCR_CME_MASK 0x3 | ||
| 129 | #define CCCR_CME_SHIFT 8 | ||
| 130 | #define CCCR_CME_CAN 0 | ||
| 131 | #define CCCR_CME_CANFD 0x1 | ||
| 132 | #define CCCR_CME_CANFD_BRS 0x2 | ||
| 133 | #define CCCR_TEST BIT(7) | ||
| 134 | #define CCCR_MON BIT(5) | ||
| 135 | #define CCCR_CCE BIT(1) | ||
| 136 | #define CCCR_INIT BIT(0) | ||
| 137 | #define CCCR_CANFD 0x10 | ||
| 116 | 138 | ||
| 117 | /* Bit Timing & Prescaler Register (BTP) */ | 139 | /* Bit Timing & Prescaler Register (BTP) */ |
| 118 | #define BTR_BRP_MASK 0x3ff | 140 | #define BTR_BRP_MASK 0x3ff |
| @@ -204,6 +226,7 @@ enum m_can_mram_cfg { | |||
| 204 | 226 | ||
| 205 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ | 227 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ |
| 206 | #define M_CAN_RXESC_8BYTES 0x0 | 228 | #define M_CAN_RXESC_8BYTES 0x0 |
| 229 | #define M_CAN_RXESC_64BYTES 0x777 | ||
| 207 | 230 | ||
| 208 | /* Tx Buffer Configuration(TXBC) */ | 231 | /* Tx Buffer Configuration(TXBC) */ |
| 209 | #define TXBC_NDTB_OFF 16 | 232 | #define TXBC_NDTB_OFF 16 |
| @@ -211,6 +234,7 @@ enum m_can_mram_cfg { | |||
| 211 | 234 | ||
| 212 | /* Tx Buffer Element Size Configuration(TXESC) */ | 235 | /* Tx Buffer Element Size Configuration(TXESC) */ |
| 213 | #define TXESC_TBDS_8BYTES 0x0 | 236 | #define TXESC_TBDS_8BYTES 0x0 |
| 237 | #define TXESC_TBDS_64BYTES 0x7 | ||
| 214 | 238 | ||
| 215 | /* Tx Event FIFO Con.guration (TXEFC) */ | 239 | /* Tx Event FIFO Con.guration (TXEFC) */ |
| 216 | #define TXEFC_EFS_OFF 16 | 240 | #define TXEFC_EFS_OFF 16 |
| @@ -219,11 +243,11 @@ enum m_can_mram_cfg { | |||
| 219 | /* Message RAM Configuration (in bytes) */ | 243 | /* Message RAM Configuration (in bytes) */ |
| 220 | #define SIDF_ELEMENT_SIZE 4 | 244 | #define SIDF_ELEMENT_SIZE 4 |
| 221 | #define XIDF_ELEMENT_SIZE 8 | 245 | #define XIDF_ELEMENT_SIZE 8 |
| 222 | #define RXF0_ELEMENT_SIZE 16 | 246 | #define RXF0_ELEMENT_SIZE 72 |
| 223 | #define RXF1_ELEMENT_SIZE 16 | 247 | #define RXF1_ELEMENT_SIZE 72 |
| 224 | #define RXB_ELEMENT_SIZE 16 | 248 | #define RXB_ELEMENT_SIZE 16 |
| 225 | #define TXE_ELEMENT_SIZE 8 | 249 | #define TXE_ELEMENT_SIZE 8 |
| 226 | #define TXB_ELEMENT_SIZE 16 | 250 | #define TXB_ELEMENT_SIZE 72 |
| 227 | 251 | ||
| 228 | /* Message RAM Elements */ | 252 | /* Message RAM Elements */ |
| 229 | #define M_CAN_FIFO_ID 0x0 | 253 | #define M_CAN_FIFO_ID 0x0 |
| @@ -231,11 +255,17 @@ enum m_can_mram_cfg { | |||
| 231 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) | 255 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) |
| 232 | 256 | ||
| 233 | /* Rx Buffer Element */ | 257 | /* Rx Buffer Element */ |
| 258 | /* R0 */ | ||
| 234 | #define RX_BUF_ESI BIT(31) | 259 | #define RX_BUF_ESI BIT(31) |
| 235 | #define RX_BUF_XTD BIT(30) | 260 | #define RX_BUF_XTD BIT(30) |
| 236 | #define RX_BUF_RTR BIT(29) | 261 | #define RX_BUF_RTR BIT(29) |
| 262 | /* R1 */ | ||
| 263 | #define RX_BUF_ANMF BIT(31) | ||
| 264 | #define RX_BUF_EDL BIT(21) | ||
| 265 | #define RX_BUF_BRS BIT(20) | ||
| 237 | 266 | ||
| 238 | /* Tx Buffer Element */ | 267 | /* Tx Buffer Element */ |
| 268 | /* R0 */ | ||
| 239 | #define TX_BUF_XTD BIT(30) | 269 | #define TX_BUF_XTD BIT(30) |
| 240 | #define TX_BUF_RTR BIT(29) | 270 | #define TX_BUF_RTR BIT(29) |
| 241 | 271 | ||
| @@ -296,6 +326,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv, | |||
| 296 | if (enable) { | 326 | if (enable) { |
| 297 | /* enable m_can configuration */ | 327 | /* enable m_can configuration */ |
| 298 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); | 328 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); |
| 329 | udelay(5); | ||
| 299 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ | 330 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ |
| 300 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); | 331 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); |
| 301 | } else { | 332 | } else { |
| @@ -326,41 +357,67 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv) | |||
| 326 | m_can_write(priv, M_CAN_ILE, 0x0); | 357 | m_can_write(priv, M_CAN_ILE, 0x0); |
| 327 | } | 358 | } |
| 328 | 359 | ||
| 329 | static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, | 360 | static void m_can_read_fifo(struct net_device *dev, u32 rxfs) |
| 330 | u32 rxfs) | ||
| 331 | { | 361 | { |
| 362 | struct net_device_stats *stats = &dev->stats; | ||
| 332 | struct m_can_priv *priv = netdev_priv(dev); | 363 | struct m_can_priv *priv = netdev_priv(dev); |
| 333 | u32 id, fgi; | 364 | struct canfd_frame *cf; |
| 365 | struct sk_buff *skb; | ||
| 366 | u32 id, fgi, dlc; | ||
| 367 | int i; | ||
| 334 | 368 | ||
| 335 | /* calculate the fifo get index for where to read data */ | 369 | /* calculate the fifo get index for where to read data */ |
| 336 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; | 370 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; |
| 371 | dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | ||
| 372 | if (dlc & RX_BUF_EDL) | ||
| 373 | skb = alloc_canfd_skb(dev, &cf); | ||
| 374 | else | ||
| 375 | skb = alloc_can_skb(dev, (struct can_frame **)&cf); | ||
| 376 | if (!skb) { | ||
| 377 | stats->rx_dropped++; | ||
| 378 | return; | ||
| 379 | } | ||
| 380 | |||
| 381 | if (dlc & RX_BUF_EDL) | ||
| 382 | cf->len = can_dlc2len((dlc >> 16) & 0x0F); | ||
| 383 | else | ||
| 384 | cf->len = get_can_dlc((dlc >> 16) & 0x0F); | ||
| 385 | |||
| 337 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); | 386 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); |
| 338 | if (id & RX_BUF_XTD) | 387 | if (id & RX_BUF_XTD) |
| 339 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; | 388 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; |
| 340 | else | 389 | else |
| 341 | cf->can_id = (id >> 18) & CAN_SFF_MASK; | 390 | cf->can_id = (id >> 18) & CAN_SFF_MASK; |
| 342 | 391 | ||
| 343 | if (id & RX_BUF_RTR) { | 392 | if (id & RX_BUF_ESI) { |
| 393 | cf->flags |= CANFD_ESI; | ||
| 394 | netdev_dbg(dev, "ESI Error\n"); | ||
| 395 | } | ||
| 396 | |||
| 397 | if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { | ||
| 344 | cf->can_id |= CAN_RTR_FLAG; | 398 | cf->can_id |= CAN_RTR_FLAG; |
| 345 | } else { | 399 | } else { |
| 346 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | 400 | if (dlc & RX_BUF_BRS) |
| 347 | cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); | 401 | cf->flags |= CANFD_BRS; |
| 348 | *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, | 402 | |
| 349 | M_CAN_FIFO_DATA(0)); | 403 | for (i = 0; i < cf->len; i += 4) |
| 350 | *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, | 404 | *(u32 *)(cf->data + i) = |
| 351 | M_CAN_FIFO_DATA(1)); | 405 | m_can_fifo_read(priv, fgi, |
| 406 | M_CAN_FIFO_DATA(i / 4)); | ||
| 352 | } | 407 | } |
| 353 | 408 | ||
| 354 | /* acknowledge rx fifo 0 */ | 409 | /* acknowledge rx fifo 0 */ |
| 355 | m_can_write(priv, M_CAN_RXF0A, fgi); | 410 | m_can_write(priv, M_CAN_RXF0A, fgi); |
| 411 | |||
| 412 | stats->rx_packets++; | ||
| 413 | stats->rx_bytes += cf->len; | ||
| 414 | |||
| 415 | netif_receive_skb(skb); | ||
| 356 | } | 416 | } |
| 357 | 417 | ||
| 358 | static int m_can_do_rx_poll(struct net_device *dev, int quota) | 418 | static int m_can_do_rx_poll(struct net_device *dev, int quota) |
| 359 | { | 419 | { |
| 360 | struct m_can_priv *priv = netdev_priv(dev); | 420 | struct m_can_priv *priv = netdev_priv(dev); |
| 361 | struct net_device_stats *stats = &dev->stats; | ||
| 362 | struct sk_buff *skb; | ||
| 363 | struct can_frame *frame; | ||
| 364 | u32 pkts = 0; | 421 | u32 pkts = 0; |
| 365 | u32 rxfs; | 422 | u32 rxfs; |
| 366 | 423 | ||
| @@ -374,18 +431,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) | |||
| 374 | if (rxfs & RXFS_RFL) | 431 | if (rxfs & RXFS_RFL) |
| 375 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); | 432 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); |
| 376 | 433 | ||
| 377 | skb = alloc_can_skb(dev, &frame); | 434 | m_can_read_fifo(dev, rxfs); |
| 378 | if (!skb) { | ||
| 379 | stats->rx_dropped++; | ||
| 380 | return pkts; | ||
| 381 | } | ||
| 382 | |||
| 383 | m_can_read_fifo(dev, frame, rxfs); | ||
| 384 | |||
| 385 | stats->rx_packets++; | ||
| 386 | stats->rx_bytes += frame->can_dlc; | ||
| 387 | |||
| 388 | netif_receive_skb(skb); | ||
| 389 | 435 | ||
| 390 | quota--; | 436 | quota--; |
| 391 | pkts++; | 437 | pkts++; |
| @@ -481,11 +527,23 @@ static int m_can_handle_lec_err(struct net_device *dev, | |||
| 481 | return 1; | 527 | return 1; |
| 482 | } | 528 | } |
| 483 | 529 | ||
| 530 | static int __m_can_get_berr_counter(const struct net_device *dev, | ||
| 531 | struct can_berr_counter *bec) | ||
| 532 | { | ||
| 533 | struct m_can_priv *priv = netdev_priv(dev); | ||
| 534 | unsigned int ecr; | ||
| 535 | |||
| 536 | ecr = m_can_read(priv, M_CAN_ECR); | ||
| 537 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
| 538 | bec->txerr = ecr & ECR_TEC_MASK; | ||
| 539 | |||
| 540 | return 0; | ||
| 541 | } | ||
| 542 | |||
| 484 | static int m_can_get_berr_counter(const struct net_device *dev, | 543 | static int m_can_get_berr_counter(const struct net_device *dev, |
| 485 | struct can_berr_counter *bec) | 544 | struct can_berr_counter *bec) |
| 486 | { | 545 | { |
| 487 | struct m_can_priv *priv = netdev_priv(dev); | 546 | struct m_can_priv *priv = netdev_priv(dev); |
| 488 | unsigned int ecr; | ||
| 489 | int err; | 547 | int err; |
| 490 | 548 | ||
| 491 | err = clk_prepare_enable(priv->hclk); | 549 | err = clk_prepare_enable(priv->hclk); |
| @@ -498,9 +556,7 @@ static int m_can_get_berr_counter(const struct net_device *dev, | |||
| 498 | return err; | 556 | return err; |
| 499 | } | 557 | } |
| 500 | 558 | ||
| 501 | ecr = m_can_read(priv, M_CAN_ECR); | 559 | __m_can_get_berr_counter(dev, bec); |
| 502 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
| 503 | bec->txerr = ecr & ECR_TEC_MASK; | ||
| 504 | 560 | ||
| 505 | clk_disable_unprepare(priv->cclk); | 561 | clk_disable_unprepare(priv->cclk); |
| 506 | clk_disable_unprepare(priv->hclk); | 562 | clk_disable_unprepare(priv->hclk); |
| @@ -544,7 +600,7 @@ static int m_can_handle_state_change(struct net_device *dev, | |||
| 544 | if (unlikely(!skb)) | 600 | if (unlikely(!skb)) |
| 545 | return 0; | 601 | return 0; |
| 546 | 602 | ||
| 547 | m_can_get_berr_counter(dev, &bec); | 603 | __m_can_get_berr_counter(dev, &bec); |
| 548 | 604 | ||
| 549 | switch (new_state) { | 605 | switch (new_state) { |
| 550 | case CAN_STATE_ERROR_ACTIVE: | 606 | case CAN_STATE_ERROR_ACTIVE: |
| @@ -596,14 +652,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr) | |||
| 596 | 652 | ||
| 597 | if ((psr & PSR_EP) && | 653 | if ((psr & PSR_EP) && |
| 598 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { | 654 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { |
| 599 | netdev_dbg(dev, "entered error warning state\n"); | 655 | netdev_dbg(dev, "entered error passive state\n"); |
| 600 | work_done += m_can_handle_state_change(dev, | 656 | work_done += m_can_handle_state_change(dev, |
| 601 | CAN_STATE_ERROR_PASSIVE); | 657 | CAN_STATE_ERROR_PASSIVE); |
| 602 | } | 658 | } |
| 603 | 659 | ||
| 604 | if ((psr & PSR_BO) && | 660 | if ((psr & PSR_BO) && |
| 605 | (priv->can.state != CAN_STATE_BUS_OFF)) { | 661 | (priv->can.state != CAN_STATE_BUS_OFF)) { |
| 606 | netdev_dbg(dev, "entered error warning state\n"); | 662 | netdev_dbg(dev, "entered error bus off state\n"); |
| 607 | work_done += m_can_handle_state_change(dev, | 663 | work_done += m_can_handle_state_change(dev, |
| 608 | CAN_STATE_BUS_OFF); | 664 | CAN_STATE_BUS_OFF); |
| 609 | } | 665 | } |
| @@ -615,7 +671,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus) | |||
| 615 | { | 671 | { |
| 616 | if (irqstatus & IR_WDI) | 672 | if (irqstatus & IR_WDI) |
| 617 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); | 673 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); |
| 618 | if (irqstatus & IR_BEU) | 674 | if (irqstatus & IR_ELO) |
| 619 | netdev_err(dev, "Error Logging Overflow\n"); | 675 | netdev_err(dev, "Error Logging Overflow\n"); |
| 620 | if (irqstatus & IR_BEU) | 676 | if (irqstatus & IR_BEU) |
| 621 | netdev_err(dev, "Bit Error Uncorrected\n"); | 677 | netdev_err(dev, "Bit Error Uncorrected\n"); |
| @@ -733,10 +789,23 @@ static const struct can_bittiming_const m_can_bittiming_const = { | |||
| 733 | .brp_inc = 1, | 789 | .brp_inc = 1, |
| 734 | }; | 790 | }; |
| 735 | 791 | ||
| 792 | static const struct can_bittiming_const m_can_data_bittiming_const = { | ||
| 793 | .name = KBUILD_MODNAME, | ||
| 794 | .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ | ||
| 795 | .tseg1_max = 16, | ||
| 796 | .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ | ||
| 797 | .tseg2_max = 8, | ||
| 798 | .sjw_max = 4, | ||
| 799 | .brp_min = 1, | ||
| 800 | .brp_max = 32, | ||
| 801 | .brp_inc = 1, | ||
| 802 | }; | ||
| 803 | |||
| 736 | static int m_can_set_bittiming(struct net_device *dev) | 804 | static int m_can_set_bittiming(struct net_device *dev) |
| 737 | { | 805 | { |
| 738 | struct m_can_priv *priv = netdev_priv(dev); | 806 | struct m_can_priv *priv = netdev_priv(dev); |
| 739 | const struct can_bittiming *bt = &priv->can.bittiming; | 807 | const struct can_bittiming *bt = &priv->can.bittiming; |
| 808 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | ||
| 740 | u16 brp, sjw, tseg1, tseg2; | 809 | u16 brp, sjw, tseg1, tseg2; |
| 741 | u32 reg_btp; | 810 | u32 reg_btp; |
| 742 | 811 | ||
| @@ -747,7 +816,17 @@ static int m_can_set_bittiming(struct net_device *dev) | |||
| 747 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | | 816 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | |
| 748 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); | 817 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); |
| 749 | m_can_write(priv, M_CAN_BTP, reg_btp); | 818 | m_can_write(priv, M_CAN_BTP, reg_btp); |
| 750 | netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); | 819 | |
| 820 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
| 821 | brp = dbt->brp - 1; | ||
| 822 | sjw = dbt->sjw - 1; | ||
| 823 | tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; | ||
| 824 | tseg2 = dbt->phase_seg2 - 1; | ||
| 825 | reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | | ||
| 826 | (tseg1 << FBTR_FTSEG1_SHIFT) | | ||
| 827 | (tseg2 << FBTR_FTSEG2_SHIFT); | ||
| 828 | m_can_write(priv, M_CAN_FBTP, reg_btp); | ||
| 829 | } | ||
| 751 | 830 | ||
| 752 | return 0; | 831 | return 0; |
| 753 | } | 832 | } |
| @@ -767,8 +846,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
| 767 | 846 | ||
| 768 | m_can_config_endisable(priv, true); | 847 | m_can_config_endisable(priv, true); |
| 769 | 848 | ||
| 770 | /* RX Buffer/FIFO Element Size 8 bytes data field */ | 849 | /* RX Buffer/FIFO Element Size 64 bytes data field */ |
| 771 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); | 850 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); |
| 772 | 851 | ||
| 773 | /* Accept Non-matching Frames Into FIFO 0 */ | 852 | /* Accept Non-matching Frames Into FIFO 0 */ |
| 774 | m_can_write(priv, M_CAN_GFC, 0x0); | 853 | m_can_write(priv, M_CAN_GFC, 0x0); |
| @@ -777,8 +856,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
| 777 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | | 856 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | |
| 778 | priv->mcfg[MRAM_TXB].off); | 857 | priv->mcfg[MRAM_TXB].off); |
| 779 | 858 | ||
| 780 | /* only support 8 bytes firstly */ | 859 | /* support 64 bytes payload */ |
| 781 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); | 860 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); |
| 782 | 861 | ||
| 783 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | | 862 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | |
| 784 | priv->mcfg[MRAM_TXE].off); | 863 | priv->mcfg[MRAM_TXE].off); |
| @@ -793,7 +872,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
| 793 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); | 872 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); |
| 794 | 873 | ||
| 795 | cccr = m_can_read(priv, M_CAN_CCCR); | 874 | cccr = m_can_read(priv, M_CAN_CCCR); |
| 796 | cccr &= ~(CCCR_TEST | CCCR_MON); | 875 | cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | |
| 876 | (CCCR_CME_MASK << CCCR_CME_SHIFT)); | ||
| 797 | test = m_can_read(priv, M_CAN_TEST); | 877 | test = m_can_read(priv, M_CAN_TEST); |
| 798 | test &= ~TEST_LBCK; | 878 | test &= ~TEST_LBCK; |
| 799 | 879 | ||
| @@ -805,6 +885,9 @@ static void m_can_chip_config(struct net_device *dev) | |||
| 805 | test |= TEST_LBCK; | 885 | test |= TEST_LBCK; |
| 806 | } | 886 | } |
| 807 | 887 | ||
| 888 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) | ||
| 889 | cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; | ||
| 890 | |||
| 808 | m_can_write(priv, M_CAN_CCCR, cccr); | 891 | m_can_write(priv, M_CAN_CCCR, cccr); |
| 809 | m_can_write(priv, M_CAN_TEST, test); | 892 | m_can_write(priv, M_CAN_TEST, test); |
| 810 | 893 | ||
| @@ -869,11 +952,13 @@ static struct net_device *alloc_m_can_dev(void) | |||
| 869 | 952 | ||
| 870 | priv->dev = dev; | 953 | priv->dev = dev; |
| 871 | priv->can.bittiming_const = &m_can_bittiming_const; | 954 | priv->can.bittiming_const = &m_can_bittiming_const; |
| 955 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; | ||
| 872 | priv->can.do_set_mode = m_can_set_mode; | 956 | priv->can.do_set_mode = m_can_set_mode; |
| 873 | priv->can.do_get_berr_counter = m_can_get_berr_counter; | 957 | priv->can.do_get_berr_counter = m_can_get_berr_counter; |
| 874 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | | 958 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | |
| 875 | CAN_CTRLMODE_LISTENONLY | | 959 | CAN_CTRLMODE_LISTENONLY | |
| 876 | CAN_CTRLMODE_BERR_REPORTING; | 960 | CAN_CTRLMODE_BERR_REPORTING | |
| 961 | CAN_CTRLMODE_FD; | ||
| 877 | 962 | ||
| 878 | return dev; | 963 | return dev; |
| 879 | } | 964 | } |
| @@ -956,8 +1041,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
| 956 | struct net_device *dev) | 1041 | struct net_device *dev) |
| 957 | { | 1042 | { |
| 958 | struct m_can_priv *priv = netdev_priv(dev); | 1043 | struct m_can_priv *priv = netdev_priv(dev); |
| 959 | struct can_frame *cf = (struct can_frame *)skb->data; | 1044 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; |
| 960 | u32 id; | 1045 | u32 id, cccr; |
| 1046 | int i; | ||
| 961 | 1047 | ||
| 962 | if (can_dropped_invalid_skb(dev, skb)) | 1048 | if (can_dropped_invalid_skb(dev, skb)) |
| 963 | return NETDEV_TX_OK; | 1049 | return NETDEV_TX_OK; |
| @@ -976,11 +1062,28 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
| 976 | 1062 | ||
| 977 | /* message ram configuration */ | 1063 | /* message ram configuration */ |
| 978 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); | 1064 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); |
| 979 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); | 1065 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); |
| 980 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); | 1066 | |
| 981 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); | 1067 | for (i = 0; i < cf->len; i += 4) |
| 1068 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), | ||
| 1069 | *(u32 *)(cf->data + i)); | ||
| 1070 | |||
| 982 | can_put_echo_skb(skb, dev, 0); | 1071 | can_put_echo_skb(skb, dev, 0); |
| 983 | 1072 | ||
| 1073 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
| 1074 | cccr = m_can_read(priv, M_CAN_CCCR); | ||
| 1075 | cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); | ||
| 1076 | if (can_is_canfd_skb(skb)) { | ||
| 1077 | if (cf->flags & CANFD_BRS) | ||
| 1078 | cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; | ||
| 1079 | else | ||
| 1080 | cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; | ||
| 1081 | } else { | ||
| 1082 | cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; | ||
| 1083 | } | ||
| 1084 | m_can_write(priv, M_CAN_CCCR, cccr); | ||
| 1085 | } | ||
| 1086 | |||
| 984 | /* enable first TX buffer to start transfer */ | 1087 | /* enable first TX buffer to start transfer */ |
| 985 | m_can_write(priv, M_CAN_TXBTIE, 0x1); | 1088 | m_can_write(priv, M_CAN_TXBTIE, 0x1); |
| 986 | m_can_write(priv, M_CAN_TXBAR, 0x1); | 1089 | m_can_write(priv, M_CAN_TXBAR, 0x1); |
| @@ -992,6 +1095,7 @@ static const struct net_device_ops m_can_netdev_ops = { | |||
| 992 | .ndo_open = m_can_open, | 1095 | .ndo_open = m_can_open, |
| 993 | .ndo_stop = m_can_close, | 1096 | .ndo_stop = m_can_close, |
| 994 | .ndo_start_xmit = m_can_start_xmit, | 1097 | .ndo_start_xmit = m_can_start_xmit, |
| 1098 | .ndo_change_mtu = can_change_mtu, | ||
| 995 | }; | 1099 | }; |
| 996 | 1100 | ||
| 997 | static int register_m_can_dev(struct net_device *dev) | 1101 | static int register_m_can_dev(struct net_device *dev) |
| @@ -1009,7 +1113,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
| 1009 | struct resource *res; | 1113 | struct resource *res; |
| 1010 | void __iomem *addr; | 1114 | void __iomem *addr; |
| 1011 | u32 out_val[MRAM_CFG_LEN]; | 1115 | u32 out_val[MRAM_CFG_LEN]; |
| 1012 | int ret; | 1116 | int i, start, end, ret; |
| 1013 | 1117 | ||
| 1014 | /* message ram could be shared */ | 1118 | /* message ram could be shared */ |
| 1015 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); | 1119 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); |
| @@ -1060,6 +1164,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
| 1060 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, | 1164 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, |
| 1061 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); | 1165 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); |
| 1062 | 1166 | ||
| 1167 | /* initialize the entire Message RAM in use to avoid possible | ||
| 1168 | * ECC/parity checksum errors when reading an uninitialized buffer | ||
| 1169 | */ | ||
| 1170 | start = priv->mcfg[MRAM_SIDF].off; | ||
| 1171 | end = priv->mcfg[MRAM_TXB].off + | ||
| 1172 | priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; | ||
| 1173 | for (i = start; i < end; i += 4) | ||
| 1174 | writel(0x0, priv->mram_base + i); | ||
| 1175 | |||
| 1063 | return 0; | 1176 | return 0; |
| 1064 | } | 1177 | } |
| 1065 | 1178 | ||
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index 1abe133d1594..9718248e55f1 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c | |||
| @@ -628,6 +628,7 @@ static const struct net_device_ops rcar_can_netdev_ops = { | |||
| 628 | .ndo_open = rcar_can_open, | 628 | .ndo_open = rcar_can_open, |
| 629 | .ndo_stop = rcar_can_close, | 629 | .ndo_stop = rcar_can_close, |
| 630 | .ndo_start_xmit = rcar_can_start_xmit, | 630 | .ndo_start_xmit = rcar_can_start_xmit, |
| 631 | .ndo_change_mtu = can_change_mtu, | ||
| 631 | }; | 632 | }; |
| 632 | 633 | ||
| 633 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) | 634 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) |
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 8ff3424d5147..15c00faeec61 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
| @@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
| 214 | struct net_device *dev; | 214 | struct net_device *dev; |
| 215 | struct sja1000_priv *priv; | 215 | struct sja1000_priv *priv; |
| 216 | struct kvaser_pci *board; | 216 | struct kvaser_pci *board; |
| 217 | int err, init_step; | 217 | int err; |
| 218 | 218 | ||
| 219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); | 219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); |
| 220 | if (dev == NULL) | 220 | if (dev == NULL) |
| @@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
| 235 | if (channel == 0) { | 235 | if (channel == 0) { |
| 236 | board->xilinx_ver = | 236 | board->xilinx_ver = |
| 237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; | 237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; |
| 238 | init_step = 2; | ||
| 239 | 238 | ||
| 240 | /* Assert PTADR# - we're in passive mode so the other bits are | 239 | /* Assert PTADR# - we're in passive mode so the other bits are |
| 241 | not important */ | 240 | not important */ |
| @@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
| 264 | priv->irq_flags = IRQF_SHARED; | 263 | priv->irq_flags = IRQF_SHARED; |
| 265 | dev->irq = pdev->irq; | 264 | dev->irq = pdev->irq; |
| 266 | 265 | ||
| 267 | init_step = 4; | ||
| 268 | |||
| 269 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", | 266 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", |
| 270 | priv->reg_base, board->conf_addr, dev->irq); | 267 | priv->reg_base, board->conf_addr, dev->irq); |
| 271 | 268 | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 00f2534dde73..29d3f0938eb8 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
| @@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb) | |||
| 434 | if (urb->actual_length > CPC_HEADER_SIZE) { | 434 | if (urb->actual_length > CPC_HEADER_SIZE) { |
| 435 | struct ems_cpc_msg *msg; | 435 | struct ems_cpc_msg *msg; |
| 436 | u8 *ibuf = urb->transfer_buffer; | 436 | u8 *ibuf = urb->transfer_buffer; |
| 437 | u8 msg_count, again, start; | 437 | u8 msg_count, start; |
| 438 | 438 | ||
| 439 | msg_count = ibuf[0] & ~0x80; | 439 | msg_count = ibuf[0] & ~0x80; |
| 440 | again = ibuf[0] & 0x80; | ||
| 441 | 440 | ||
| 442 | start = CPC_HEADER_SIZE; | 441 | start = CPC_HEADER_SIZE; |
| 443 | 442 | ||
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index b7c9e8b11460..c063a54ab8dd 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
| @@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
| 464 | { | 464 | { |
| 465 | struct esd_tx_urb_context *context = urb->context; | 465 | struct esd_tx_urb_context *context = urb->context; |
| 466 | struct esd_usb2_net_priv *priv; | 466 | struct esd_usb2_net_priv *priv; |
| 467 | struct esd_usb2 *dev; | ||
| 468 | struct net_device *netdev; | 467 | struct net_device *netdev; |
| 469 | size_t size = sizeof(struct esd_usb2_msg); | 468 | size_t size = sizeof(struct esd_usb2_msg); |
| 470 | 469 | ||
| @@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
| 472 | 471 | ||
| 473 | priv = context->priv; | 472 | priv = context->priv; |
| 474 | netdev = priv->netdev; | 473 | netdev = priv->netdev; |
| 475 | dev = priv->usb2; | ||
| 476 | 474 | ||
| 477 | /* free up our allocated buffer */ | 475 | /* free up our allocated buffer */ |
| 478 | usb_free_coherent(urb->dev, size, | 476 | usb_free_coherent(urb->dev, size, |
| @@ -1143,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf) | |||
| 1143 | } | 1141 | } |
| 1144 | } | 1142 | } |
| 1145 | unlink_all_urbs(dev); | 1143 | unlink_all_urbs(dev); |
| 1144 | kfree(dev); | ||
| 1146 | } | 1145 | } |
| 1147 | } | 1146 | } |
| 1148 | 1147 | ||
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 04b0f84612f0..009acc8641fc 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c | |||
| @@ -718,6 +718,7 @@ static const struct net_device_ops gs_usb_netdev_ops = { | |||
| 718 | .ndo_open = gs_can_open, | 718 | .ndo_open = gs_can_open, |
| 719 | .ndo_stop = gs_can_close, | 719 | .ndo_stop = gs_can_close, |
| 720 | .ndo_start_xmit = gs_can_start_xmit, | 720 | .ndo_start_xmit = gs_can_start_xmit, |
| 721 | .ndo_change_mtu = can_change_mtu, | ||
| 721 | }; | 722 | }; |
| 722 | 723 | ||
| 723 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) | 724 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) |
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 5e8b5609c067..8a998e3884ce 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c | |||
| @@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev) | |||
| 300 | static int xcan_chip_start(struct net_device *ndev) | 300 | static int xcan_chip_start(struct net_device *ndev) |
| 301 | { | 301 | { |
| 302 | struct xcan_priv *priv = netdev_priv(ndev); | 302 | struct xcan_priv *priv = netdev_priv(ndev); |
| 303 | u32 err, reg_msr, reg_sr_mask; | 303 | u32 reg_msr, reg_sr_mask; |
| 304 | int err; | ||
| 304 | unsigned long timeout; | 305 | unsigned long timeout; |
| 305 | 306 | ||
| 306 | /* Check if it is in reset mode */ | 307 | /* Check if it is in reset mode */ |
| @@ -961,6 +962,7 @@ static const struct net_device_ops xcan_netdev_ops = { | |||
| 961 | .ndo_open = xcan_open, | 962 | .ndo_open = xcan_open, |
| 962 | .ndo_stop = xcan_close, | 963 | .ndo_stop = xcan_close, |
| 963 | .ndo_start_xmit = xcan_start_xmit, | 964 | .ndo_start_xmit = xcan_start_xmit, |
| 965 | .ndo_change_mtu = can_change_mtu, | ||
| 964 | }; | 966 | }; |
| 965 | 967 | ||
| 966 | /** | 968 | /** |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index cca604994003..4fe33606f372 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
| @@ -1082,7 +1082,7 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg) | |||
| 1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
| 1083 | 1083 | ||
| 1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) | 1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) |
| 1085 | pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; | 1085 | pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; |
| 1086 | 1086 | ||
| 1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | 1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); |
| 1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | 1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9a18e7930b31..3e8475cae4f9 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -4421,6 +4421,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
| 4421 | "Disabled VxLAN offloads for UDP port %d\n", | 4421 | "Disabled VxLAN offloads for UDP port %d\n", |
| 4422 | be16_to_cpu(port)); | 4422 | be16_to_cpu(port)); |
| 4423 | } | 4423 | } |
| 4424 | |||
| 4425 | static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
| 4426 | { | ||
| 4427 | return vxlan_gso_check(skb); | ||
| 4428 | } | ||
| 4424 | #endif | 4429 | #endif |
| 4425 | 4430 | ||
| 4426 | static const struct net_device_ops be_netdev_ops = { | 4431 | static const struct net_device_ops be_netdev_ops = { |
| @@ -4450,6 +4455,7 @@ static const struct net_device_ops be_netdev_ops = { | |||
| 4450 | #ifdef CONFIG_BE2NET_VXLAN | 4455 | #ifdef CONFIG_BE2NET_VXLAN |
| 4451 | .ndo_add_vxlan_port = be_add_vxlan_port, | 4456 | .ndo_add_vxlan_port = be_add_vxlan_port, |
| 4452 | .ndo_del_vxlan_port = be_del_vxlan_port, | 4457 | .ndo_del_vxlan_port = be_del_vxlan_port, |
| 4458 | .ndo_gso_check = be_gso_check, | ||
| 4453 | #endif | 4459 | #endif |
| 4454 | }; | 4460 | }; |
| 4455 | 4461 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 02266e3de514..4d69e382b4e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
| 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
| 1694 | 1694 | ||
| 1695 | #ifdef CONFIG_MLX4_EN_VXLAN | 1695 | #ifdef CONFIG_MLX4_EN_VXLAN |
| 1696 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1696 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 1697 | vxlan_get_rx_port(dev); | 1697 | vxlan_get_rx_port(dev); |
| 1698 | #endif | 1698 | #endif |
| 1699 | priv->port_up = true; | 1699 | priv->port_up = true; |
| @@ -2355,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
| 2355 | 2355 | ||
| 2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
| 2357 | } | 2357 | } |
| 2358 | |||
| 2359 | static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
| 2360 | { | ||
| 2361 | return vxlan_gso_check(skb); | ||
| 2362 | } | ||
| 2358 | #endif | 2363 | #endif |
| 2359 | 2364 | ||
| 2360 | static const struct net_device_ops mlx4_netdev_ops = { | 2365 | static const struct net_device_ops mlx4_netdev_ops = { |
| @@ -2386,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
| 2386 | #ifdef CONFIG_MLX4_EN_VXLAN | 2391 | #ifdef CONFIG_MLX4_EN_VXLAN |
| 2387 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2392 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
| 2388 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2393 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
| 2394 | .ndo_gso_check = mlx4_en_gso_check, | ||
| 2389 | #endif | 2395 | #endif |
| 2390 | }; | 2396 | }; |
| 2391 | 2397 | ||
| @@ -2416,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = { | |||
| 2416 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2422 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
| 2417 | #endif | 2423 | #endif |
| 2418 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2424 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
| 2425 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
| 2426 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | ||
| 2427 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | ||
| 2428 | .ndo_gso_check = mlx4_en_gso_check, | ||
| 2429 | #endif | ||
| 2419 | }; | 2430 | }; |
| 2420 | 2431 | ||
| 2421 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | 2432 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index f5e29f7bdae3..a913b3ad2f89 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
| @@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev, | |||
| 503 | 503 | ||
| 504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | 504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; |
| 505 | } | 505 | } |
| 506 | |||
| 507 | static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
| 508 | { | ||
| 509 | return vxlan_gso_check(skb); | ||
| 510 | } | ||
| 506 | #endif | 511 | #endif |
| 507 | 512 | ||
| 508 | static const struct net_device_ops qlcnic_netdev_ops = { | 513 | static const struct net_device_ops qlcnic_netdev_ops = { |
| @@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
| 526 | #ifdef CONFIG_QLCNIC_VXLAN | 531 | #ifdef CONFIG_QLCNIC_VXLAN |
| 527 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, | 532 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, |
| 528 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, | 533 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, |
| 534 | .ndo_gso_check = qlcnic_gso_check, | ||
| 529 | #endif | 535 | #endif |
| 530 | #ifdef CONFIG_NET_POLL_CONTROLLER | 536 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 531 | .ndo_poll_controller = qlcnic_poll_controller, | 537 | .ndo_poll_controller = qlcnic_poll_controller, |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index d8794488f80a..c560f9aeb55d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -129,9 +129,9 @@ do { \ | |||
| 129 | #define CPSW_VLAN_AWARE BIT(1) | 129 | #define CPSW_VLAN_AWARE BIT(1) |
| 130 | #define CPSW_ALE_VLAN_AWARE 1 | 130 | #define CPSW_ALE_VLAN_AWARE 1 |
| 131 | 131 | ||
| 132 | #define CPSW_FIFO_NORMAL_MODE (0 << 15) | 132 | #define CPSW_FIFO_NORMAL_MODE (0 << 16) |
| 133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) | 133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) |
| 134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) | 134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) |
| 135 | 135 | ||
| 136 | #define CPSW_INTPACEEN (0x3f << 16) | 136 | #define CPSW_INTPACEEN (0x3f << 16) |
| 137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) | 137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) |
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c index 9ce854f43917..6cbc56ad9ff4 100644 --- a/drivers/net/ieee802154/fakehard.c +++ b/drivers/net/ieee802154/fakehard.c | |||
| @@ -377,17 +377,20 @@ static int ieee802154fake_probe(struct platform_device *pdev) | |||
| 377 | 377 | ||
| 378 | err = wpan_phy_register(phy); | 378 | err = wpan_phy_register(phy); |
| 379 | if (err) | 379 | if (err) |
| 380 | goto out; | 380 | goto err_phy_reg; |
| 381 | 381 | ||
| 382 | err = register_netdev(dev); | 382 | err = register_netdev(dev); |
| 383 | if (err < 0) | 383 | if (err) |
| 384 | goto out; | 384 | goto err_netdev_reg; |
| 385 | 385 | ||
| 386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); | 386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); |
| 387 | return 0; | 387 | return 0; |
| 388 | 388 | ||
| 389 | out: | 389 | err_netdev_reg: |
| 390 | unregister_netdev(dev); | 390 | wpan_phy_unregister(phy); |
| 391 | err_phy_reg: | ||
| 392 | free_netdev(dev); | ||
| 393 | wpan_phy_free(phy); | ||
| 391 | return err; | 394 | return err; |
| 392 | } | 395 | } |
| 393 | 396 | ||
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 1aff970be33e..1dc628ffce2b 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
| @@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, | |||
| 506 | int len = sizeof(struct sockaddr_pppox); | 506 | int len = sizeof(struct sockaddr_pppox); |
| 507 | struct sockaddr_pppox sp; | 507 | struct sockaddr_pppox sp; |
| 508 | 508 | ||
| 509 | sp.sa_family = AF_PPPOX; | 509 | memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); |
| 510 | |||
| 511 | sp.sa_family = AF_PPPOX; | ||
| 510 | sp.sa_protocol = PX_PROTO_PPTP; | 512 | sp.sa_protocol = PX_PROTO_PPTP; |
| 511 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; | 513 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; |
| 512 | 514 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 22756db53dca..b8a82b86f909 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -780,6 +780,7 @@ static const struct usb_device_id products[] = { | |||
| 780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
| 781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 783 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ | ||
| 783 | 784 | ||
| 784 | /* 4. Gobi 1000 devices */ | 785 | /* 4. Gobi 1000 devices */ |
| 785 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 786 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ec2a8b41ed41..b0bc8ead47de 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -1673,6 +1673,40 @@ static const struct attribute_group virtio_net_mrg_rx_group = { | |||
| 1673 | }; | 1673 | }; |
| 1674 | #endif | 1674 | #endif |
| 1675 | 1675 | ||
| 1676 | static bool virtnet_fail_on_feature(struct virtio_device *vdev, | ||
| 1677 | unsigned int fbit, | ||
| 1678 | const char *fname, const char *dname) | ||
| 1679 | { | ||
| 1680 | if (!virtio_has_feature(vdev, fbit)) | ||
| 1681 | return false; | ||
| 1682 | |||
| 1683 | dev_err(&vdev->dev, "device advertises feature %s but not %s", | ||
| 1684 | fname, dname); | ||
| 1685 | |||
| 1686 | return true; | ||
| 1687 | } | ||
| 1688 | |||
| 1689 | #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ | ||
| 1690 | virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) | ||
| 1691 | |||
| 1692 | static bool virtnet_validate_features(struct virtio_device *vdev) | ||
| 1693 | { | ||
| 1694 | if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && | ||
| 1695 | (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, | ||
| 1696 | "VIRTIO_NET_F_CTRL_VQ") || | ||
| 1697 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, | ||
| 1698 | "VIRTIO_NET_F_CTRL_VQ") || | ||
| 1699 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, | ||
| 1700 | "VIRTIO_NET_F_CTRL_VQ") || | ||
| 1701 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || | ||
| 1702 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, | ||
| 1703 | "VIRTIO_NET_F_CTRL_VQ"))) { | ||
| 1704 | return false; | ||
| 1705 | } | ||
| 1706 | |||
| 1707 | return true; | ||
| 1708 | } | ||
| 1709 | |||
| 1676 | static int virtnet_probe(struct virtio_device *vdev) | 1710 | static int virtnet_probe(struct virtio_device *vdev) |
| 1677 | { | 1711 | { |
| 1678 | int i, err; | 1712 | int i, err; |
| @@ -1680,6 +1714,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1680 | struct virtnet_info *vi; | 1714 | struct virtnet_info *vi; |
| 1681 | u16 max_queue_pairs; | 1715 | u16 max_queue_pairs; |
| 1682 | 1716 | ||
| 1717 | if (!virtnet_validate_features(vdev)) | ||
| 1718 | return -EINVAL; | ||
| 1719 | |||
| 1683 | /* Find if host supports multiqueue virtio_net device */ | 1720 | /* Find if host supports multiqueue virtio_net device */ |
| 1684 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, | 1721 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, |
| 1685 | struct virtio_net_config, | 1722 | struct virtio_net_config, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index fa9dc45b75a6..e1e335c339e3 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -67,12 +67,6 @@ | |||
| 67 | 67 | ||
| 68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ | 68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ |
| 69 | 69 | ||
| 70 | /* VXLAN protocol header */ | ||
| 71 | struct vxlanhdr { | ||
| 72 | __be32 vx_flags; | ||
| 73 | __be32 vx_vni; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /* UDP port for VXLAN traffic. | 70 | /* UDP port for VXLAN traffic. |
| 77 | * The IANA assigned port is 4789, but the Linux default is 8472 | 71 | * The IANA assigned port is 4789, but the Linux default is 8472 |
| 78 | * for compatibility with early adopters. | 72 | * for compatibility with early adopters. |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 697c4ae90af0..1e8ea5e4d4ca 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
| @@ -664,6 +664,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah) | |||
| 664 | ah->enabled_cals |= TX_CL_CAL; | 664 | ah->enabled_cals |= TX_CL_CAL; |
| 665 | else | 665 | else |
| 666 | ah->enabled_cals &= ~TX_CL_CAL; | 666 | ah->enabled_cals &= ~TX_CL_CAL; |
| 667 | |||
| 668 | if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { | ||
| 669 | if (ah->is_clk_25mhz) { | ||
| 670 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
| 671 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
| 672 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
| 673 | } else { | ||
| 674 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
| 675 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
| 676 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
| 677 | } | ||
| 678 | udelay(100); | ||
| 679 | } | ||
| 667 | } | 680 | } |
| 668 | 681 | ||
| 669 | static void ar9003_hw_prog_ini(struct ath_hw *ah, | 682 | static void ar9003_hw_prog_ini(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 8be4b1453394..2ad605760e21 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -861,19 +861,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, | |||
| 861 | udelay(RTC_PLL_SETTLE_DELAY); | 861 | udelay(RTC_PLL_SETTLE_DELAY); |
| 862 | 862 | ||
| 863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); | 863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); |
| 864 | |||
| 865 | if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { | ||
| 866 | if (ah->is_clk_25mhz) { | ||
| 867 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
| 868 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
| 869 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
| 870 | } else { | ||
| 871 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
| 872 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
| 873 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
| 874 | } | ||
| 875 | udelay(100); | ||
| 876 | } | ||
| 877 | } | 864 | } |
| 878 | 865 | ||
| 879 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | 866 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 30c66dfcd7a0..4f18a6be0c7d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -974,9 +974,8 @@ void ath9k_calculate_iter_data(struct ath_softc *sc, | |||
| 974 | struct ath_vif *avp; | 974 | struct ath_vif *avp; |
| 975 | 975 | ||
| 976 | /* | 976 | /* |
| 977 | * Pick the MAC address of the first interface as the new hardware | 977 | * The hardware will use primary station addr together with the |
| 978 | * MAC address. The hardware will use it together with the BSSID mask | 978 | * BSSID mask when matching addresses. |
| 979 | * when matching addresses. | ||
| 980 | */ | 979 | */ |
| 981 | memset(iter_data, 0, sizeof(*iter_data)); | 980 | memset(iter_data, 0, sizeof(*iter_data)); |
| 982 | memset(&iter_data->mask, 0xff, ETH_ALEN); | 981 | memset(&iter_data->mask, 0xff, ETH_ALEN); |
| @@ -1205,6 +1204,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
| 1205 | list_add_tail(&avp->list, &avp->chanctx->vifs); | 1204 | list_add_tail(&avp->list, &avp->chanctx->vifs); |
| 1206 | } | 1205 | } |
| 1207 | 1206 | ||
| 1207 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
| 1208 | |||
| 1208 | ath9k_assign_hw_queues(hw, vif); | 1209 | ath9k_assign_hw_queues(hw, vif); |
| 1209 | 1210 | ||
| 1210 | an->sc = sc; | 1211 | an->sc = sc; |
| @@ -1274,6 +1275,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
| 1274 | 1275 | ||
| 1275 | ath_tx_node_cleanup(sc, &avp->mcast_node); | 1276 | ath_tx_node_cleanup(sc, &avp->mcast_node); |
| 1276 | 1277 | ||
| 1278 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
| 1279 | |||
| 1277 | mutex_unlock(&sc->mutex); | 1280 | mutex_unlock(&sc->mutex); |
| 1278 | } | 1281 | } |
| 1279 | 1282 | ||
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 1dfc682a8055..ee27b06074e1 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
| @@ -300,9 +300,7 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value) | |||
| 300 | 300 | ||
| 301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) | 301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) |
| 302 | { | 302 | { |
| 303 | assert_mac_suspended(dev); | 303 | b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg)); |
| 304 | dev->phy.ops->phy_write(dev, destreg, | ||
| 305 | dev->phy.ops->phy_read(dev, srcreg)); | ||
| 306 | } | 304 | } |
| 307 | 305 | ||
| 308 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) | 306 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c b/drivers/net/wireless/brcm80211/brcmfmac/of.c index f05f5270fec1..927bffd5be64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c | |||
| @@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev) | |||
| 40 | return; | 40 | return; |
| 41 | 41 | ||
| 42 | irq = irq_of_parse_and_map(np, 0); | 42 | irq = irq_of_parse_and_map(np, 0); |
| 43 | if (irq < 0) { | 43 | if (!irq) { |
| 44 | brcmf_err("interrupt could not be mapped: err=%d\n", irq); | 44 | brcmf_err("interrupt could not be mapped\n"); |
| 45 | devm_kfree(dev, sdiodev->pdata); | 45 | devm_kfree(dev, sdiodev->pdata); |
| 46 | return; | 46 | return; |
| 47 | } | 47 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c index 8c0632ec9f7a..16fef3382019 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c | |||
| @@ -19,10 +19,10 @@ | |||
| 19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
| 20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
| 21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
| 22 | #include <linux/unaligned/access_ok.h> | ||
| 23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
| 24 | #include <linux/bcma/bcma.h> | 23 | #include <linux/bcma/bcma.h> |
| 25 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
| 25 | #include <asm/unaligned.h> | ||
| 26 | 26 | ||
| 27 | #include <soc.h> | 27 | #include <soc.h> |
| 28 | #include <chipcommon.h> | 28 | #include <chipcommon.h> |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index dc135915470d..875d1142c8b0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
| @@ -669,10 +669,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, | |||
| 669 | goto finalize; | 669 | goto finalize; |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) | 672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) { |
| 673 | usb_kill_urb(devinfo->ctl_urb); | ||
| 673 | ret = -ETIMEDOUT; | 674 | ret = -ETIMEDOUT; |
| 674 | else | 675 | } else { |
| 675 | memcpy(buffer, tmpbuf, buflen); | 676 | memcpy(buffer, tmpbuf, buflen); |
| 677 | } | ||
| 676 | 678 | ||
| 677 | finalize: | 679 | finalize: |
| 678 | kfree(tmpbuf); | 680 | kfree(tmpbuf); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 28fa25b509db..39b45c038a93 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
| @@ -299,6 +299,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
| 299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; | 299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; |
| 300 | switch (ch->width) { | 300 | switch (ch->width) { |
| 301 | case NL80211_CHAN_WIDTH_20: | 301 | case NL80211_CHAN_WIDTH_20: |
| 302 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
| 302 | ch_inf.bw = BRCMU_CHAN_BW_20; | 303 | ch_inf.bw = BRCMU_CHAN_BW_20; |
| 303 | WARN_ON(primary_offset != 0); | 304 | WARN_ON(primary_offset != 0); |
| 304 | break; | 305 | break; |
| @@ -323,6 +324,10 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
| 323 | ch_inf.sb = BRCMU_CHAN_SB_LU; | 324 | ch_inf.sb = BRCMU_CHAN_SB_LU; |
| 324 | } | 325 | } |
| 325 | break; | 326 | break; |
| 327 | case NL80211_CHAN_WIDTH_80P80: | ||
| 328 | case NL80211_CHAN_WIDTH_160: | ||
| 329 | case NL80211_CHAN_WIDTH_5: | ||
| 330 | case NL80211_CHAN_WIDTH_10: | ||
| 326 | default: | 331 | default: |
| 327 | WARN_ON_ONCE(1); | 332 | WARN_ON_ONCE(1); |
| 328 | } | 333 | } |
| @@ -333,6 +338,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
| 333 | case IEEE80211_BAND_5GHZ: | 338 | case IEEE80211_BAND_5GHZ: |
| 334 | ch_inf.band = BRCMU_CHAN_BAND_5G; | 339 | ch_inf.band = BRCMU_CHAN_BAND_5G; |
| 335 | break; | 340 | break; |
| 341 | case IEEE80211_BAND_60GHZ: | ||
| 336 | default: | 342 | default: |
| 337 | WARN_ON_ONCE(1); | 343 | WARN_ON_ONCE(1); |
| 338 | } | 344 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index b280d5d87127..7554f7053830 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -602,16 +602,6 @@ static int iwl_mvm_cancel_regular_scan(struct iwl_mvm *mvm) | |||
| 602 | SCAN_COMPLETE_NOTIFICATION }; | 602 | SCAN_COMPLETE_NOTIFICATION }; |
| 603 | int ret; | 603 | int ret; |
| 604 | 604 | ||
| 605 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
| 606 | return 0; | ||
| 607 | |||
| 608 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
| 609 | ieee80211_scan_completed(mvm->hw, true); | ||
| 610 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
| 611 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
| 612 | return 0; | ||
| 613 | } | ||
| 614 | |||
| 615 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, | 605 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, |
| 616 | scan_abort_notif, | 606 | scan_abort_notif, |
| 617 | ARRAY_SIZE(scan_abort_notif), | 607 | ARRAY_SIZE(scan_abort_notif), |
| @@ -1400,6 +1390,16 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, | |||
| 1400 | 1390 | ||
| 1401 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) | 1391 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) |
| 1402 | { | 1392 | { |
| 1393 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
| 1394 | return 0; | ||
| 1395 | |||
| 1396 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
| 1397 | ieee80211_scan_completed(mvm->hw, true); | ||
| 1398 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
| 1399 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
| 1400 | return 0; | ||
| 1401 | } | ||
| 1402 | |||
| 1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) | 1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) |
| 1404 | return iwl_mvm_scan_offload_stop(mvm, true); | 1404 | return iwl_mvm_scan_offload_stop(mvm, true); |
| 1405 | return iwl_mvm_cancel_regular_scan(mvm); | 1405 | return iwl_mvm_cancel_regular_scan(mvm); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 160c3ebc48d0..dd2f3f8baa9d 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
| @@ -1894,8 +1894,7 @@ static u32 iwl_trans_pcie_dump_prph(struct iwl_trans *trans, | |||
| 1894 | int reg; | 1894 | int reg; |
| 1895 | __le32 *val; | 1895 | __le32 *val; |
| 1896 | 1896 | ||
| 1897 | prph_len += sizeof(*data) + sizeof(*prph) + | 1897 | prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk; |
| 1898 | num_bytes_in_chunk; | ||
| 1899 | 1898 | ||
| 1900 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); | 1899 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); |
| 1901 | (*data)->len = cpu_to_le32(sizeof(*prph) + | 1900 | (*data)->len = cpu_to_le32(sizeof(*prph) + |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 8e68f87ab13c..66ff36447b94 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
| @@ -158,55 +158,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb) | |||
| 158 | skb_trim(skb, frame_length); | 158 | skb_trim(skb, frame_length); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) | 161 | /* |
| 162 | * H/W needs L2 padding between the header and the paylod if header size | ||
| 163 | * is not 4 bytes aligned. | ||
| 164 | */ | ||
| 165 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) | ||
| 162 | { | 166 | { |
| 163 | unsigned int payload_length = skb->len - header_length; | 167 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
| 164 | unsigned int header_align = ALIGN_SIZE(skb, 0); | ||
| 165 | unsigned int payload_align = ALIGN_SIZE(skb, header_length); | ||
| 166 | unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; | ||
| 167 | 168 | ||
| 168 | /* | 169 | if (!l2pad) |
| 169 | * Adjust the header alignment if the payload needs to be moved more | ||
| 170 | * than the header. | ||
| 171 | */ | ||
| 172 | if (payload_align > header_align) | ||
| 173 | header_align += 4; | ||
| 174 | |||
| 175 | /* There is nothing to do if no alignment is needed */ | ||
| 176 | if (!header_align) | ||
| 177 | return; | 170 | return; |
| 178 | 171 | ||
| 179 | /* Reserve the amount of space needed in front of the frame */ | 172 | skb_push(skb, l2pad); |
| 180 | skb_push(skb, header_align); | 173 | memmove(skb->data, skb->data + l2pad, hdr_len); |
| 181 | |||
| 182 | /* | ||
| 183 | * Move the header. | ||
| 184 | */ | ||
| 185 | memmove(skb->data, skb->data + header_align, header_length); | ||
| 186 | |||
| 187 | /* Move the payload, if present and if required */ | ||
| 188 | if (payload_length && payload_align) | ||
| 189 | memmove(skb->data + header_length + l2pad, | ||
| 190 | skb->data + header_length + l2pad + payload_align, | ||
| 191 | payload_length); | ||
| 192 | |||
| 193 | /* Trim the skb to the correct size */ | ||
| 194 | skb_trim(skb, header_length + l2pad + payload_length); | ||
| 195 | } | 174 | } |
| 196 | 175 | ||
| 197 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) | 176 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) |
| 198 | { | 177 | { |
| 199 | /* | 178 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
| 200 | * L2 padding is only present if the skb contains more than just the | ||
| 201 | * IEEE 802.11 header. | ||
| 202 | */ | ||
| 203 | unsigned int l2pad = (skb->len > header_length) ? | ||
| 204 | L2PAD_SIZE(header_length) : 0; | ||
| 205 | 179 | ||
| 206 | if (!l2pad) | 180 | if (!l2pad) |
| 207 | return; | 181 | return; |
| 208 | 182 | ||
| 209 | memmove(skb->data + l2pad, skb->data, header_length); | 183 | memmove(skb->data + l2pad, skb->data, hdr_len); |
| 210 | skb_pull(skb, l2pad); | 184 | skb_pull(skb, l2pad); |
| 211 | } | 185 | } |
| 212 | 186 | ||
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 25daa8715219..61f5d36eca6a 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
| @@ -842,7 +842,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
| 842 | break; | 842 | break; |
| 843 | } | 843 | } |
| 844 | /* handle command packet here */ | 844 | /* handle command packet here */ |
| 845 | if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | 845 | if (rtlpriv->cfg->ops->rx_command_packet && |
| 846 | rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | ||
| 846 | dev_kfree_skb_any(skb); | 847 | dev_kfree_skb_any(skb); |
| 847 | goto end; | 848 | goto end; |
| 848 | } | 849 | } |
| @@ -1127,9 +1128,14 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
| 1127 | 1128 | ||
| 1128 | __skb_queue_tail(&ring->queue, pskb); | 1129 | __skb_queue_tail(&ring->queue, pskb); |
| 1129 | 1130 | ||
| 1130 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | 1131 | if (rtlpriv->use_new_trx_flow) { |
| 1131 | &temp_one); | 1132 | temp_one = 4; |
| 1132 | 1133 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true, | |
| 1134 | HW_DESC_OWN, (u8 *)&temp_one); | ||
| 1135 | } else { | ||
| 1136 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | ||
| 1137 | &temp_one); | ||
| 1138 | } | ||
| 1133 | return; | 1139 | return; |
| 1134 | } | 1140 | } |
| 1135 | 1141 | ||
| @@ -1370,9 +1376,9 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, | |||
| 1370 | ring->desc = NULL; | 1376 | ring->desc = NULL; |
| 1371 | if (rtlpriv->use_new_trx_flow) { | 1377 | if (rtlpriv->use_new_trx_flow) { |
| 1372 | pci_free_consistent(rtlpci->pdev, | 1378 | pci_free_consistent(rtlpci->pdev, |
| 1373 | sizeof(*ring->desc) * ring->entries, | 1379 | sizeof(*ring->buffer_desc) * ring->entries, |
| 1374 | ring->buffer_desc, ring->buffer_desc_dma); | 1380 | ring->buffer_desc, ring->buffer_desc_dma); |
| 1375 | ring->desc = NULL; | 1381 | ring->buffer_desc = NULL; |
| 1376 | } | 1382 | } |
| 1377 | } | 1383 | } |
| 1378 | 1384 | ||
| @@ -1543,7 +1549,6 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
| 1543 | true, | 1549 | true, |
| 1544 | HW_DESC_TXBUFF_ADDR), | 1550 | HW_DESC_TXBUFF_ADDR), |
| 1545 | skb->len, PCI_DMA_TODEVICE); | 1551 | skb->len, PCI_DMA_TODEVICE); |
| 1546 | ring->idx = (ring->idx + 1) % ring->entries; | ||
| 1547 | kfree_skb(skb); | 1552 | kfree_skb(skb); |
| 1548 | ring->idx = (ring->idx + 1) % ring->entries; | 1553 | ring->idx = (ring->idx + 1) % ring->entries; |
| 1549 | } | 1554 | } |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c index 00e067044c08..5761d5b49e39 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c | |||
| @@ -1201,6 +1201,9 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw, | |||
| 1201 | 1201 | ||
| 1202 | } | 1202 | } |
| 1203 | 1203 | ||
| 1204 | if (type != NL80211_IFTYPE_AP && | ||
| 1205 | rtlpriv->mac80211.link_state < MAC80211_LINKED) | ||
| 1206 | bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK; | ||
| 1204 | rtl_write_byte(rtlpriv, (MSR), bt_msr); | 1207 | rtl_write_byte(rtlpriv, (MSR), bt_msr); |
| 1205 | 1208 | ||
| 1206 | temp = rtl_read_dword(rtlpriv, TCR); | 1209 | temp = rtl_read_dword(rtlpriv, TCR); |
| @@ -1262,6 +1265,7 @@ void rtl92se_enable_interrupt(struct ieee80211_hw *hw) | |||
| 1262 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); | 1265 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); |
| 1263 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ | 1266 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ |
| 1264 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); | 1267 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); |
| 1268 | rtlpci->irq_enabled = true; | ||
| 1265 | } | 1269 | } |
| 1266 | 1270 | ||
| 1267 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | 1271 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) |
| @@ -1276,8 +1280,7 @@ void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | |||
| 1276 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1280 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
| 1277 | rtl_write_dword(rtlpriv, INTA_MASK, 0); | 1281 | rtl_write_dword(rtlpriv, INTA_MASK, 0); |
| 1278 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); | 1282 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); |
| 1279 | 1283 | rtlpci->irq_enabled = false; | |
| 1280 | synchronize_irq(rtlpci->pdev->irq); | ||
| 1281 | } | 1284 | } |
| 1282 | 1285 | ||
| 1283 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) | 1286 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 77c5b5f35244..4b4612fe2fdb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
| @@ -399,6 +399,8 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | |||
| 399 | case 2: | 399 | case 2: |
| 400 | currentcmd = &postcommoncmd[*step]; | 400 | currentcmd = &postcommoncmd[*step]; |
| 401 | break; | 401 | break; |
| 402 | default: | ||
| 403 | return true; | ||
| 402 | } | 404 | } |
| 403 | 405 | ||
| 404 | if (currentcmd->cmdid == CMDID_END) { | 406 | if (currentcmd->cmdid == CMDID_END) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index aadba29c167a..fb003868bdef 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
| @@ -236,6 +236,19 @@ static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw) | |||
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, | ||
| 240 | u16 index) | ||
| 241 | { | ||
| 242 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
| 243 | struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; | ||
| 244 | u8 *entry = (u8 *)(&ring->desc[ring->idx]); | ||
| 245 | u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN); | ||
| 246 | |||
| 247 | if (own) | ||
| 248 | return false; | ||
| 249 | return true; | ||
| 250 | } | ||
| 251 | |||
| 239 | static struct rtl_hal_ops rtl8192se_hal_ops = { | 252 | static struct rtl_hal_ops rtl8192se_hal_ops = { |
| 240 | .init_sw_vars = rtl92s_init_sw_vars, | 253 | .init_sw_vars = rtl92s_init_sw_vars, |
| 241 | .deinit_sw_vars = rtl92s_deinit_sw_vars, | 254 | .deinit_sw_vars = rtl92s_deinit_sw_vars, |
| @@ -269,6 +282,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
| 269 | .led_control = rtl92se_led_control, | 282 | .led_control = rtl92se_led_control, |
| 270 | .set_desc = rtl92se_set_desc, | 283 | .set_desc = rtl92se_set_desc, |
| 271 | .get_desc = rtl92se_get_desc, | 284 | .get_desc = rtl92se_get_desc, |
| 285 | .is_tx_desc_closed = rtl92se_is_tx_desc_closed, | ||
| 272 | .tx_polling = rtl92se_tx_polling, | 286 | .tx_polling = rtl92se_tx_polling, |
| 273 | .enable_hw_sec = rtl92se_enable_hw_security_config, | 287 | .enable_hw_sec = rtl92se_enable_hw_security_config, |
| 274 | .set_key = rtl92se_set_key, | 288 | .set_key = rtl92se_set_key, |
| @@ -306,6 +320,8 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = { | |||
| 306 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, | 320 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, |
| 307 | .maps[MAC_RCR_ACF] = RCR_ACF, | 321 | .maps[MAC_RCR_ACF] = RCR_ACF, |
| 308 | .maps[MAC_RCR_AAP] = RCR_AAP, | 322 | .maps[MAC_RCR_AAP] = RCR_AAP, |
| 323 | .maps[MAC_HIMR] = INTA_MASK, | ||
| 324 | .maps[MAC_HIMRE] = INTA_MASK + 4, | ||
| 309 | 325 | ||
| 310 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, | 326 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, |
| 311 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, | 327 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 81bb3bd7909d..15081257cfc8 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
| @@ -828,6 +828,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
| 828 | if (status == CPL_ERR_RTX_NEG_ADVICE) | 828 | if (status == CPL_ERR_RTX_NEG_ADVICE) |
| 829 | goto rel_skb; | 829 | goto rel_skb; |
| 830 | 830 | ||
| 831 | module_put(THIS_MODULE); | ||
| 832 | |||
| 831 | if (status && status != CPL_ERR_TCAM_FULL && | 833 | if (status && status != CPL_ERR_TCAM_FULL && |
| 832 | status != CPL_ERR_CONN_EXIST && | 834 | status != CPL_ERR_CONN_EXIST && |
| 833 | status != CPL_ERR_ARP_MISS) | 835 | status != CPL_ERR_ARP_MISS) |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 13d869a92248..7da59c38a69e 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
| @@ -816,7 +816,7 @@ static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) | |||
| 816 | read_lock_bh(&csk->callback_lock); | 816 | read_lock_bh(&csk->callback_lock); |
| 817 | if (csk->user_data) | 817 | if (csk->user_data) |
| 818 | iscsi_conn_failure(csk->user_data, | 818 | iscsi_conn_failure(csk->user_data, |
| 819 | ISCSI_ERR_CONN_FAILED); | 819 | ISCSI_ERR_TCP_CONN_CLOSE); |
| 820 | read_unlock_bh(&csk->callback_lock); | 820 | read_unlock_bh(&csk->callback_lock); |
| 821 | } | 821 | } |
| 822 | } | 822 | } |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 6992afc6ba7f..b37ea95bc348 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -99,6 +99,12 @@ inval_skb: | |||
| 99 | return 1; | 99 | return 1; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static inline bool can_is_canfd_skb(const struct sk_buff *skb) | ||
| 103 | { | ||
| 104 | /* the CAN specific type of skb is identified by its data length */ | ||
| 105 | return skb->len == CANFD_MTU; | ||
| 106 | } | ||
| 107 | |||
| 102 | /* get data length from can_dlc with sanitized can_dlc */ | 108 | /* get data length from can_dlc with sanitized can_dlc */ |
| 103 | u8 can_dlc2len(u8 can_dlc); | 109 | u8 can_dlc2len(u8 can_dlc); |
| 104 | 110 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 0068708161ff..0a21fbefdfbe 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -242,7 +242,7 @@ static inline void in_dev_put(struct in_device *idev) | |||
| 242 | static __inline__ __be32 inet_make_mask(int logmask) | 242 | static __inline__ __be32 inet_make_mask(int logmask) |
| 243 | { | 243 | { |
| 244 | if (logmask) | 244 | if (logmask) |
| 245 | return htonl(~((1<<(32-logmask))-1)); | 245 | return htonl(~((1U<<(32-logmask))-1)); |
| 246 | return 0; | 246 | return 0; |
| 247 | } | 247 | } |
| 248 | 248 | ||
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 845c596bf594..3ae969e3acf0 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -396,14 +396,12 @@ struct nft_rule { | |||
| 396 | /** | 396 | /** |
| 397 | * struct nft_trans - nf_tables object update in transaction | 397 | * struct nft_trans - nf_tables object update in transaction |
| 398 | * | 398 | * |
| 399 | * @rcu_head: rcu head to defer release of transaction data | ||
| 400 | * @list: used internally | 399 | * @list: used internally |
| 401 | * @msg_type: message type | 400 | * @msg_type: message type |
| 402 | * @ctx: transaction context | 401 | * @ctx: transaction context |
| 403 | * @data: internal information related to the transaction | 402 | * @data: internal information related to the transaction |
| 404 | */ | 403 | */ |
| 405 | struct nft_trans { | 404 | struct nft_trans { |
| 406 | struct rcu_head rcu_head; | ||
| 407 | struct list_head list; | 405 | struct list_head list; |
| 408 | int msg_type; | 406 | int msg_type; |
| 409 | struct nft_ctx ctx; | 407 | struct nft_ctx ctx; |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index d5f59f3fc35d..57cccd0052e5 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
| @@ -8,6 +8,12 @@ | |||
| 8 | #define VNI_HASH_BITS 10 | 8 | #define VNI_HASH_BITS 10 |
| 9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) | 9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) |
| 10 | 10 | ||
| 11 | /* VXLAN protocol header */ | ||
| 12 | struct vxlanhdr { | ||
| 13 | __be32 vx_flags; | ||
| 14 | __be32 vx_vni; | ||
| 15 | }; | ||
| 16 | |||
| 11 | struct vxlan_sock; | 17 | struct vxlan_sock; |
| 12 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); | 18 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); |
| 13 | 19 | ||
| @@ -45,6 +51,18 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, | |||
| 45 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 51 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
| 46 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); | 52 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); |
| 47 | 53 | ||
| 54 | static inline bool vxlan_gso_check(struct sk_buff *skb) | ||
| 55 | { | ||
| 56 | if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && | ||
| 57 | (skb->inner_protocol_type != ENCAP_TYPE_ETHER || | ||
| 58 | skb->inner_protocol != htons(ETH_P_TEB) || | ||
| 59 | (skb_inner_mac_header(skb) - skb_transport_header(skb) != | ||
| 60 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) | ||
| 61 | return false; | ||
| 62 | |||
| 63 | return true; | ||
| 64 | } | ||
| 65 | |||
| 48 | /* IP header + UDP + VXLAN + Ethernet header */ | 66 | /* IP header + UDP + VXLAN + Ethernet header */ |
| 49 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) | 67 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) |
| 50 | /* IPv6 header + UDP + VXLAN + Ethernet header */ | 68 | /* IPv6 header + UDP + VXLAN + Ethernet header */ |
diff --git a/lib/Makefile b/lib/Makefile index 7512dc978f18..0211d2bd5e17 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -10,7 +10,7 @@ endif | |||
| 10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ | 10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ |
| 11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ | 11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ |
| 12 | idr.o int_sqrt.o extable.o \ | 12 | idr.o int_sqrt.o extable.o \ |
| 13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o md5.o irq_regs.o argv_split.o \ |
| 14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ | 14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ |
| 15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ | 15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ |
| 16 | earlycpio.o | 16 | earlycpio.o |
| @@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | |||
| 26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
| 27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ | 27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ |
| 28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ | 28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ |
| 29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o | 29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o |
| 30 | obj-y += string_helpers.o | 30 | obj-y += string_helpers.o |
| 31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o | 31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o |
| 32 | obj-y += kstrtox.o | 32 | obj-y += kstrtox.o |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 648d79ccf462..c465876c7861 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -813,10 +813,9 @@ static void __br_multicast_send_query(struct net_bridge *br, | |||
| 813 | return; | 813 | return; |
| 814 | 814 | ||
| 815 | if (port) { | 815 | if (port) { |
| 816 | __skb_push(skb, sizeof(struct ethhdr)); | ||
| 817 | skb->dev = port->dev; | 816 | skb->dev = port->dev; |
| 818 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | 817 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, |
| 819 | dev_queue_xmit); | 818 | br_dev_queue_push_xmit); |
| 820 | } else { | 819 | } else { |
| 821 | br_multicast_select_own_querier(br, ip, skb); | 820 | br_multicast_select_own_querier(br, ip, skb); |
| 822 | netif_rx(skb); | 821 | netif_rx(skb); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c16615bfb61e..32e31c299631 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -552,20 +552,13 @@ static void kfree_skbmem(struct sk_buff *skb) | |||
| 552 | case SKB_FCLONE_CLONE: | 552 | case SKB_FCLONE_CLONE: |
| 553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); | 553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); |
| 554 | 554 | ||
| 555 | /* Warning : We must perform the atomic_dec_and_test() before | 555 | /* The clone portion is available for |
| 556 | * setting skb->fclone back to SKB_FCLONE_FREE, otherwise | 556 | * fast-cloning again. |
| 557 | * skb_clone() could set clone_ref to 2 before our decrement. | ||
| 558 | * Anyway, if we are going to free the structure, no need to | ||
| 559 | * rewrite skb->fclone. | ||
| 560 | */ | 557 | */ |
| 561 | if (atomic_dec_and_test(&fclones->fclone_ref)) { | 558 | skb->fclone = SKB_FCLONE_FREE; |
| 559 | |||
| 560 | if (atomic_dec_and_test(&fclones->fclone_ref)) | ||
| 562 | kmem_cache_free(skbuff_fclone_cache, fclones); | 561 | kmem_cache_free(skbuff_fclone_cache, fclones); |
| 563 | } else { | ||
| 564 | /* The clone portion is available for | ||
| 565 | * fast-cloning again. | ||
| 566 | */ | ||
| 567 | skb->fclone = SKB_FCLONE_FREE; | ||
| 568 | } | ||
| 569 | break; | 562 | break; |
| 570 | } | 563 | } |
| 571 | } | 564 | } |
| @@ -887,11 +880,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 887 | if (skb->fclone == SKB_FCLONE_ORIG && | 880 | if (skb->fclone == SKB_FCLONE_ORIG && |
| 888 | n->fclone == SKB_FCLONE_FREE) { | 881 | n->fclone == SKB_FCLONE_FREE) { |
| 889 | n->fclone = SKB_FCLONE_CLONE; | 882 | n->fclone = SKB_FCLONE_CLONE; |
| 890 | /* As our fastclone was free, clone_ref must be 1 at this point. | 883 | atomic_inc(&fclones->fclone_ref); |
| 891 | * We could use atomic_inc() here, but it is faster | ||
| 892 | * to set the final value. | ||
| 893 | */ | ||
| 894 | atomic_set(&fclones->fclone_ref, 2); | ||
| 895 | } else { | 884 | } else { |
| 896 | if (skb_pfmemalloc(skb)) | 885 | if (skb_pfmemalloc(skb)) |
| 897 | gfp_mask |= __GFP_MEMALLOC; | 886 | gfp_mask |= __GFP_MEMALLOC; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index ca11d283bbeb..93ea80196f0e 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
| @@ -1080,13 +1080,13 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
| 1080 | if (!app) | 1080 | if (!app) |
| 1081 | return -EMSGSIZE; | 1081 | return -EMSGSIZE; |
| 1082 | 1082 | ||
| 1083 | spin_lock(&dcb_lock); | 1083 | spin_lock_bh(&dcb_lock); |
| 1084 | list_for_each_entry(itr, &dcb_app_list, list) { | 1084 | list_for_each_entry(itr, &dcb_app_list, list) { |
| 1085 | if (itr->ifindex == netdev->ifindex) { | 1085 | if (itr->ifindex == netdev->ifindex) { |
| 1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), | 1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), |
| 1087 | &itr->app); | 1087 | &itr->app); |
| 1088 | if (err) { | 1088 | if (err) { |
| 1089 | spin_unlock(&dcb_lock); | 1089 | spin_unlock_bh(&dcb_lock); |
| 1090 | return -EMSGSIZE; | 1090 | return -EMSGSIZE; |
| 1091 | } | 1091 | } |
| 1092 | } | 1092 | } |
| @@ -1097,7 +1097,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
| 1097 | else | 1097 | else |
| 1098 | dcbx = -EOPNOTSUPP; | 1098 | dcbx = -EOPNOTSUPP; |
| 1099 | 1099 | ||
| 1100 | spin_unlock(&dcb_lock); | 1100 | spin_unlock_bh(&dcb_lock); |
| 1101 | nla_nest_end(skb, app); | 1101 | nla_nest_end(skb, app); |
| 1102 | 1102 | ||
| 1103 | /* get peer info if available */ | 1103 | /* get peer info if available */ |
| @@ -1234,7 +1234,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
| 1234 | } | 1234 | } |
| 1235 | 1235 | ||
| 1236 | /* local app */ | 1236 | /* local app */ |
| 1237 | spin_lock(&dcb_lock); | 1237 | spin_lock_bh(&dcb_lock); |
| 1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); | 1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); |
| 1239 | if (!app) | 1239 | if (!app) |
| 1240 | goto dcb_unlock; | 1240 | goto dcb_unlock; |
| @@ -1271,7 +1271,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
| 1271 | else | 1271 | else |
| 1272 | dcbx = -EOPNOTSUPP; | 1272 | dcbx = -EOPNOTSUPP; |
| 1273 | 1273 | ||
| 1274 | spin_unlock(&dcb_lock); | 1274 | spin_unlock_bh(&dcb_lock); |
| 1275 | 1275 | ||
| 1276 | /* features flags */ | 1276 | /* features flags */ |
| 1277 | if (ops->getfeatcfg) { | 1277 | if (ops->getfeatcfg) { |
| @@ -1326,7 +1326,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
| 1326 | return 0; | 1326 | return 0; |
| 1327 | 1327 | ||
| 1328 | dcb_unlock: | 1328 | dcb_unlock: |
| 1329 | spin_unlock(&dcb_lock); | 1329 | spin_unlock_bh(&dcb_lock); |
| 1330 | nla_put_failure: | 1330 | nla_put_failure: |
| 1331 | return err; | 1331 | return err; |
| 1332 | } | 1332 | } |
| @@ -1762,10 +1762,10 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) | |||
| 1762 | struct dcb_app_type *itr; | 1762 | struct dcb_app_type *itr; |
| 1763 | u8 prio = 0; | 1763 | u8 prio = 0; |
| 1764 | 1764 | ||
| 1765 | spin_lock(&dcb_lock); | 1765 | spin_lock_bh(&dcb_lock); |
| 1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
| 1767 | prio = itr->app.priority; | 1767 | prio = itr->app.priority; |
| 1768 | spin_unlock(&dcb_lock); | 1768 | spin_unlock_bh(&dcb_lock); |
| 1769 | 1769 | ||
| 1770 | return prio; | 1770 | return prio; |
| 1771 | } | 1771 | } |
| @@ -1789,7 +1789,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
| 1789 | if (dev->dcbnl_ops->getdcbx) | 1789 | if (dev->dcbnl_ops->getdcbx) |
| 1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
| 1791 | 1791 | ||
| 1792 | spin_lock(&dcb_lock); | 1792 | spin_lock_bh(&dcb_lock); |
| 1793 | /* Search for existing match and replace */ | 1793 | /* Search for existing match and replace */ |
| 1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { | 1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { |
| 1795 | if (new->priority) | 1795 | if (new->priority) |
| @@ -1804,7 +1804,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
| 1804 | if (new->priority) | 1804 | if (new->priority) |
| 1805 | err = dcb_app_add(new, dev->ifindex); | 1805 | err = dcb_app_add(new, dev->ifindex); |
| 1806 | out: | 1806 | out: |
| 1807 | spin_unlock(&dcb_lock); | 1807 | spin_unlock_bh(&dcb_lock); |
| 1808 | if (!err) | 1808 | if (!err) |
| 1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
| 1810 | return err; | 1810 | return err; |
| @@ -1823,10 +1823,10 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) | |||
| 1823 | struct dcb_app_type *itr; | 1823 | struct dcb_app_type *itr; |
| 1824 | u8 prio = 0; | 1824 | u8 prio = 0; |
| 1825 | 1825 | ||
| 1826 | spin_lock(&dcb_lock); | 1826 | spin_lock_bh(&dcb_lock); |
| 1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
| 1828 | prio |= 1 << itr->app.priority; | 1828 | prio |= 1 << itr->app.priority; |
| 1829 | spin_unlock(&dcb_lock); | 1829 | spin_unlock_bh(&dcb_lock); |
| 1830 | 1830 | ||
| 1831 | return prio; | 1831 | return prio; |
| 1832 | } | 1832 | } |
| @@ -1850,7 +1850,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
| 1850 | if (dev->dcbnl_ops->getdcbx) | 1850 | if (dev->dcbnl_ops->getdcbx) |
| 1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
| 1852 | 1852 | ||
| 1853 | spin_lock(&dcb_lock); | 1853 | spin_lock_bh(&dcb_lock); |
| 1854 | /* Search for existing match and abort if found */ | 1854 | /* Search for existing match and abort if found */ |
| 1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { | 1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { |
| 1856 | err = -EEXIST; | 1856 | err = -EEXIST; |
| @@ -1859,7 +1859,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
| 1859 | 1859 | ||
| 1860 | err = dcb_app_add(new, dev->ifindex); | 1860 | err = dcb_app_add(new, dev->ifindex); |
| 1861 | out: | 1861 | out: |
| 1862 | spin_unlock(&dcb_lock); | 1862 | spin_unlock_bh(&dcb_lock); |
| 1863 | if (!err) | 1863 | if (!err) |
| 1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
| 1865 | return err; | 1865 | return err; |
| @@ -1882,7 +1882,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
| 1882 | if (dev->dcbnl_ops->getdcbx) | 1882 | if (dev->dcbnl_ops->getdcbx) |
| 1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
| 1884 | 1884 | ||
| 1885 | spin_lock(&dcb_lock); | 1885 | spin_lock_bh(&dcb_lock); |
| 1886 | /* Search for existing match and remove it. */ | 1886 | /* Search for existing match and remove it. */ |
| 1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { | 1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { |
| 1888 | list_del(&itr->list); | 1888 | list_del(&itr->list); |
| @@ -1890,7 +1890,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
| 1890 | err = 0; | 1890 | err = 0; |
| 1891 | } | 1891 | } |
| 1892 | 1892 | ||
| 1893 | spin_unlock(&dcb_lock); | 1893 | spin_unlock_bh(&dcb_lock); |
| 1894 | if (!err) | 1894 | if (!err) |
| 1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
| 1896 | return err; | 1896 | return err; |
| @@ -1902,12 +1902,12 @@ static void dcb_flushapp(void) | |||
| 1902 | struct dcb_app_type *app; | 1902 | struct dcb_app_type *app; |
| 1903 | struct dcb_app_type *tmp; | 1903 | struct dcb_app_type *tmp; |
| 1904 | 1904 | ||
| 1905 | spin_lock(&dcb_lock); | 1905 | spin_lock_bh(&dcb_lock); |
| 1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { | 1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { |
| 1907 | list_del(&app->list); | 1907 | list_del(&app->list); |
| 1908 | kfree(app); | 1908 | kfree(app); |
| 1909 | } | 1909 | } |
| 1910 | spin_unlock(&dcb_lock); | 1910 | spin_unlock_bh(&dcb_lock); |
| 1911 | } | 1911 | } |
| 1912 | 1912 | ||
| 1913 | static int __init dcbnl_init(void) | 1913 | static int __init dcbnl_init(void) |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index f2e15738534d..8f7bd56955b0 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
| @@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) | |||
| 62 | else | 62 | else |
| 63 | res->tclassid = 0; | 63 | res->tclassid = 0; |
| 64 | #endif | 64 | #endif |
| 65 | |||
| 66 | if (err == -ESRCH) | ||
| 67 | err = -ENETUNREACH; | ||
| 68 | |||
| 65 | return err; | 69 | return err; |
| 66 | } | 70 | } |
| 67 | EXPORT_SYMBOL_GPL(__fib_lookup); | 71 | EXPORT_SYMBOL_GPL(__fib_lookup); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index fb70e3ecc3e4..bb15d0e03d4f 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
| @@ -318,9 +318,7 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted) | |||
| 318 | return scount; | 318 | return scount; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | #define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb)) | 321 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) |
| 322 | |||
| 323 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | ||
| 324 | { | 322 | { |
| 325 | struct sk_buff *skb; | 323 | struct sk_buff *skb; |
| 326 | struct rtable *rt; | 324 | struct rtable *rt; |
| @@ -330,6 +328,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
| 330 | struct flowi4 fl4; | 328 | struct flowi4 fl4; |
| 331 | int hlen = LL_RESERVED_SPACE(dev); | 329 | int hlen = LL_RESERVED_SPACE(dev); |
| 332 | int tlen = dev->needed_tailroom; | 330 | int tlen = dev->needed_tailroom; |
| 331 | unsigned int size = mtu; | ||
| 333 | 332 | ||
| 334 | while (1) { | 333 | while (1) { |
| 335 | skb = alloc_skb(size + hlen + tlen, | 334 | skb = alloc_skb(size + hlen + tlen, |
| @@ -341,7 +340,6 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
| 341 | return NULL; | 340 | return NULL; |
| 342 | } | 341 | } |
| 343 | skb->priority = TC_PRIO_CONTROL; | 342 | skb->priority = TC_PRIO_CONTROL; |
| 344 | igmp_skb_size(skb) = size; | ||
| 345 | 343 | ||
| 346 | rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, | 344 | rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, |
| 347 | 0, 0, | 345 | 0, 0, |
| @@ -354,6 +352,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
| 354 | skb_dst_set(skb, &rt->dst); | 352 | skb_dst_set(skb, &rt->dst); |
| 355 | skb->dev = dev; | 353 | skb->dev = dev; |
| 356 | 354 | ||
| 355 | skb->reserved_tailroom = skb_end_offset(skb) - | ||
| 356 | min(mtu, skb_end_offset(skb)); | ||
| 357 | skb_reserve(skb, hlen); | 357 | skb_reserve(skb, hlen); |
| 358 | 358 | ||
| 359 | skb_reset_network_header(skb); | 359 | skb_reset_network_header(skb); |
| @@ -423,8 +423,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
| 423 | return skb; | 423 | return skb; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ | 426 | #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) |
| 427 | skb_tailroom(skb)) : 0) | ||
| 428 | 427 | ||
| 429 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | 428 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, |
| 430 | int type, int gdeleted, int sdeleted) | 429 | int type, int gdeleted, int sdeleted) |
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c index c1023c445920..665de06561cd 100644 --- a/net/ipv4/netfilter/nft_masq_ipv4.c +++ b/net/ipv4/netfilter/nft_masq_ipv4.c | |||
| @@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, | |||
| 24 | struct nf_nat_range range; | 24 | struct nf_nat_range range; |
| 25 | unsigned int verdict; | 25 | unsigned int verdict; |
| 26 | 26 | ||
| 27 | memset(&range, 0, sizeof(range)); | ||
| 27 | range.flags = priv->flags; | 28 | range.flags = priv->flags; |
| 28 | 29 | ||
| 29 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, | 30 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 88fa2d160685..d107ee246a1d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -5231,7 +5231,7 @@ slow_path: | |||
| 5231 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) | 5231 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) |
| 5232 | goto csum_error; | 5232 | goto csum_error; |
| 5233 | 5233 | ||
| 5234 | if (!th->ack && !th->rst) | 5234 | if (!th->ack && !th->rst && !th->syn) |
| 5235 | goto discard; | 5235 | goto discard; |
| 5236 | 5236 | ||
| 5237 | /* | 5237 | /* |
| @@ -5650,7 +5650,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
| 5650 | goto discard; | 5650 | goto discard; |
| 5651 | } | 5651 | } |
| 5652 | 5652 | ||
| 5653 | if (!th->ack && !th->rst) | 5653 | if (!th->ack && !th->rst && !th->syn) |
| 5654 | goto discard; | 5654 | goto discard; |
| 5655 | 5655 | ||
| 5656 | if (!tcp_validate_incoming(sk, skb, th, 0)) | 5656 | if (!tcp_validate_incoming(sk, skb, th, 0)) |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 0171f08325c3..1a01d79b8698 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
| @@ -1439,6 +1439,10 @@ reg_pernet_fail: | |||
| 1439 | 1439 | ||
| 1440 | void ip6_mr_cleanup(void) | 1440 | void ip6_mr_cleanup(void) |
| 1441 | { | 1441 | { |
| 1442 | rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE); | ||
| 1443 | #ifdef CONFIG_IPV6_PIMSM_V2 | ||
| 1444 | inet6_del_protocol(&pim6_protocol, IPPROTO_PIM); | ||
| 1445 | #endif | ||
| 1442 | unregister_netdevice_notifier(&ip6_mr_notifier); | 1446 | unregister_netdevice_notifier(&ip6_mr_notifier); |
| 1443 | unregister_pernet_subsys(&ip6mr_net_ops); | 1447 | unregister_pernet_subsys(&ip6mr_net_ops); |
| 1444 | kmem_cache_destroy(mrt_cachep); | 1448 | kmem_cache_destroy(mrt_cachep); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 9648de2b6745..ed2c4e400b46 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
| @@ -1550,7 +1550,7 @@ static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb, | |||
| 1550 | hdr->daddr = *daddr; | 1550 | hdr->daddr = *daddr; |
| 1551 | } | 1551 | } |
| 1552 | 1552 | ||
| 1553 | static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | 1553 | static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) |
| 1554 | { | 1554 | { |
| 1555 | struct net_device *dev = idev->dev; | 1555 | struct net_device *dev = idev->dev; |
| 1556 | struct net *net = dev_net(dev); | 1556 | struct net *net = dev_net(dev); |
| @@ -1561,13 +1561,13 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | |||
| 1561 | const struct in6_addr *saddr; | 1561 | const struct in6_addr *saddr; |
| 1562 | int hlen = LL_RESERVED_SPACE(dev); | 1562 | int hlen = LL_RESERVED_SPACE(dev); |
| 1563 | int tlen = dev->needed_tailroom; | 1563 | int tlen = dev->needed_tailroom; |
| 1564 | unsigned int size = mtu + hlen + tlen; | ||
| 1564 | int err; | 1565 | int err; |
| 1565 | u8 ra[8] = { IPPROTO_ICMPV6, 0, | 1566 | u8 ra[8] = { IPPROTO_ICMPV6, 0, |
| 1566 | IPV6_TLV_ROUTERALERT, 2, 0, 0, | 1567 | IPV6_TLV_ROUTERALERT, 2, 0, 0, |
| 1567 | IPV6_TLV_PADN, 0 }; | 1568 | IPV6_TLV_PADN, 0 }; |
| 1568 | 1569 | ||
| 1569 | /* we assume size > sizeof(ra) here */ | 1570 | /* we assume size > sizeof(ra) here */ |
| 1570 | size += hlen + tlen; | ||
| 1571 | /* limit our allocations to order-0 page */ | 1571 | /* limit our allocations to order-0 page */ |
| 1572 | size = min_t(int, size, SKB_MAX_ORDER(0, 0)); | 1572 | size = min_t(int, size, SKB_MAX_ORDER(0, 0)); |
| 1573 | skb = sock_alloc_send_skb(sk, size, 1, &err); | 1573 | skb = sock_alloc_send_skb(sk, size, 1, &err); |
| @@ -1576,6 +1576,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | |||
| 1576 | return NULL; | 1576 | return NULL; |
| 1577 | 1577 | ||
| 1578 | skb->priority = TC_PRIO_CONTROL; | 1578 | skb->priority = TC_PRIO_CONTROL; |
| 1579 | skb->reserved_tailroom = skb_end_offset(skb) - | ||
| 1580 | min(mtu, skb_end_offset(skb)); | ||
| 1579 | skb_reserve(skb, hlen); | 1581 | skb_reserve(skb, hlen); |
| 1580 | 1582 | ||
| 1581 | if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { | 1583 | if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { |
| @@ -1690,8 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
| 1690 | return skb; | 1692 | return skb; |
| 1691 | } | 1693 | } |
| 1692 | 1694 | ||
| 1693 | #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ | 1695 | #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) |
| 1694 | skb_tailroom(skb)) : 0) | ||
| 1695 | 1696 | ||
| 1696 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | 1697 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, |
| 1697 | int type, int gdeleted, int sdeleted, int crsend) | 1698 | int type, int gdeleted, int sdeleted, int crsend) |
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c index 8a7ac685076d..529c119cbb14 100644 --- a/net/ipv6/netfilter/nft_masq_ipv6.c +++ b/net/ipv6/netfilter/nft_masq_ipv6.c | |||
| @@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, | |||
| 25 | struct nf_nat_range range; | 25 | struct nf_nat_range range; |
| 26 | unsigned int verdict; | 26 | unsigned int verdict; |
| 27 | 27 | ||
| 28 | memset(&range, 0, sizeof(range)); | ||
| 28 | range.flags = priv->flags; | 29 | range.flags = priv->flags; |
| 29 | 30 | ||
| 30 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); | 31 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 91729b807c7d..1b095ca37aa4 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
| @@ -1764,6 +1764,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1764 | struct ipxhdr *ipx = NULL; | 1764 | struct ipxhdr *ipx = NULL; |
| 1765 | struct sk_buff *skb; | 1765 | struct sk_buff *skb; |
| 1766 | int copied, rc; | 1766 | int copied, rc; |
| 1767 | bool locked = true; | ||
| 1767 | 1768 | ||
| 1768 | lock_sock(sk); | 1769 | lock_sock(sk); |
| 1769 | /* put the autobinding in */ | 1770 | /* put the autobinding in */ |
| @@ -1790,6 +1791,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1790 | if (sock_flag(sk, SOCK_ZAPPED)) | 1791 | if (sock_flag(sk, SOCK_ZAPPED)) |
| 1791 | goto out; | 1792 | goto out; |
| 1792 | 1793 | ||
| 1794 | release_sock(sk); | ||
| 1795 | locked = false; | ||
| 1793 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1796 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
| 1794 | flags & MSG_DONTWAIT, &rc); | 1797 | flags & MSG_DONTWAIT, &rc); |
| 1795 | if (!skb) { | 1798 | if (!skb) { |
| @@ -1826,7 +1829,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1826 | out_free: | 1829 | out_free: |
| 1827 | skb_free_datagram(sk, skb); | 1830 | skb_free_datagram(sk, skb); |
| 1828 | out: | 1831 | out: |
| 1829 | release_sock(sk); | 1832 | if (locked) |
| 1833 | release_sock(sk); | ||
| 1830 | return rc; | 1834 | return rc; |
| 1831 | } | 1835 | } |
| 1832 | 1836 | ||
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c index ec24378caaaf..09d9caaec591 100644 --- a/net/mac80211/aes_ccm.c +++ b/net/mac80211/aes_ccm.c | |||
| @@ -53,6 +53,9 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | |||
| 53 | __aligned(__alignof__(struct aead_request)); | 53 | __aligned(__alignof__(struct aead_request)); |
| 54 | struct aead_request *aead_req = (void *) aead_req_data; | 54 | struct aead_request *aead_req = (void *) aead_req_data; |
| 55 | 55 | ||
| 56 | if (data_len == 0) | ||
| 57 | return -EINVAL; | ||
| 58 | |||
| 56 | memset(aead_req, 0, sizeof(aead_req_data)); | 59 | memset(aead_req, 0, sizeof(aead_req_data)); |
| 57 | 60 | ||
| 58 | sg_init_one(&pt, data, data_len); | 61 | sg_init_one(&pt, data, data_len); |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index df90ce2db00c..408fd8ab4eef 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
| @@ -252,19 +252,16 @@ minstrel_ht_sort_best_tp_rates(struct minstrel_ht_sta *mi, u8 index, | |||
| 252 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; | 252 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; |
| 253 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; | 253 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; |
| 254 | 254 | ||
| 255 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 255 | do { |
| 256 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | ||
| 257 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | ||
| 258 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | ||
| 259 | |||
| 260 | while (j > 0 && (cur_thr > tmp_thr || | ||
| 261 | (cur_thr == tmp_thr && cur_prob > tmp_prob))) { | ||
| 262 | j--; | ||
| 263 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 256 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; |
| 264 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | 257 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; |
| 265 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | 258 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; |
| 266 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | 259 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; |
| 267 | } | 260 | if (cur_thr < tmp_thr || |
| 261 | (cur_thr == tmp_thr && cur_prob <= tmp_prob)) | ||
| 262 | break; | ||
| 263 | j--; | ||
| 264 | } while (j > 0); | ||
| 268 | 265 | ||
| 269 | if (j < MAX_THR_RATES - 1) { | 266 | if (j < MAX_THR_RATES - 1) { |
| 270 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * | 267 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 86f9d76b1464..d259da3ce67a 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
| @@ -1863,6 +1863,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len) | |||
| 1863 | if (*op < IP_SET_OP_VERSION) { | 1863 | if (*op < IP_SET_OP_VERSION) { |
| 1864 | /* Check the version at the beginning of operations */ | 1864 | /* Check the version at the beginning of operations */ |
| 1865 | struct ip_set_req_version *req_version = data; | 1865 | struct ip_set_req_version *req_version = data; |
| 1866 | |||
| 1867 | if (*len < sizeof(struct ip_set_req_version)) { | ||
| 1868 | ret = -EINVAL; | ||
| 1869 | goto done; | ||
| 1870 | } | ||
| 1871 | |||
| 1866 | if (req_version->version != IPSET_PROTOCOL) { | 1872 | if (req_version->version != IPSET_PROTOCOL) { |
| 1867 | ret = -EPROTO; | 1873 | ret = -EPROTO; |
| 1868 | goto done; | 1874 | goto done; |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 437a3663ad03..bd90bf8107da 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
| @@ -846,6 +846,8 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, | |||
| 846 | new_skb = skb_realloc_headroom(skb, max_headroom); | 846 | new_skb = skb_realloc_headroom(skb, max_headroom); |
| 847 | if (!new_skb) | 847 | if (!new_skb) |
| 848 | goto error; | 848 | goto error; |
| 849 | if (skb->sk) | ||
| 850 | skb_set_owner_w(new_skb, skb->sk); | ||
| 849 | consume_skb(skb); | 851 | consume_skb(skb); |
| 850 | skb = new_skb; | 852 | skb = new_skb; |
| 851 | } | 853 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 5016a6929085..2c699757bccf 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -611,12 +611,16 @@ __nf_conntrack_confirm(struct sk_buff *skb) | |||
| 611 | */ | 611 | */ |
| 612 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); | 612 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); |
| 613 | pr_debug("Confirming conntrack %p\n", ct); | 613 | pr_debug("Confirming conntrack %p\n", ct); |
| 614 | /* We have to check the DYING flag inside the lock to prevent | 614 | |
| 615 | a race against nf_ct_get_next_corpse() possibly called from | 615 | /* We have to check the DYING flag after unlink to prevent |
| 616 | user context, else we insert an already 'dead' hash, blocking | 616 | * a race against nf_ct_get_next_corpse() possibly called from |
| 617 | further use of that particular connection -JM */ | 617 | * user context, else we insert an already 'dead' hash, blocking |
| 618 | * further use of that particular connection -JM. | ||
| 619 | */ | ||
| 620 | nf_ct_del_from_dying_or_unconfirmed_list(ct); | ||
| 618 | 621 | ||
| 619 | if (unlikely(nf_ct_is_dying(ct))) { | 622 | if (unlikely(nf_ct_is_dying(ct))) { |
| 623 | nf_ct_add_to_dying_list(ct); | ||
| 620 | nf_conntrack_double_unlock(hash, reply_hash); | 624 | nf_conntrack_double_unlock(hash, reply_hash); |
| 621 | local_bh_enable(); | 625 | local_bh_enable(); |
| 622 | return NF_ACCEPT; | 626 | return NF_ACCEPT; |
| @@ -636,8 +640,6 @@ __nf_conntrack_confirm(struct sk_buff *skb) | |||
| 636 | zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) | 640 | zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) |
| 637 | goto out; | 641 | goto out; |
| 638 | 642 | ||
| 639 | nf_ct_del_from_dying_or_unconfirmed_list(ct); | ||
| 640 | |||
| 641 | /* Timer relative to confirmation time, not original | 643 | /* Timer relative to confirmation time, not original |
| 642 | setting time, otherwise we'd get timer wrap in | 644 | setting time, otherwise we'd get timer wrap in |
| 643 | weird delay cases. */ | 645 | weird delay cases. */ |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 11ab4b078f3b..66e8425dbfe7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -3484,13 +3484,8 @@ static void nft_chain_commit_update(struct nft_trans *trans) | |||
| 3484 | } | 3484 | } |
| 3485 | } | 3485 | } |
| 3486 | 3486 | ||
| 3487 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3487 | static void nf_tables_commit_release(struct nft_trans *trans) |
| 3488 | * removed rules. | ||
| 3489 | */ | ||
| 3490 | static void nf_tables_commit_release_rcu(struct rcu_head *rt) | ||
| 3491 | { | 3488 | { |
| 3492 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
| 3493 | |||
| 3494 | switch (trans->msg_type) { | 3489 | switch (trans->msg_type) { |
| 3495 | case NFT_MSG_DELTABLE: | 3490 | case NFT_MSG_DELTABLE: |
| 3496 | nf_tables_table_destroy(&trans->ctx); | 3491 | nf_tables_table_destroy(&trans->ctx); |
| @@ -3612,10 +3607,11 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
| 3612 | } | 3607 | } |
| 3613 | } | 3608 | } |
| 3614 | 3609 | ||
| 3610 | synchronize_rcu(); | ||
| 3611 | |||
| 3615 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 3612 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { |
| 3616 | list_del(&trans->list); | 3613 | list_del(&trans->list); |
| 3617 | trans->ctx.nla = NULL; | 3614 | nf_tables_commit_release(trans); |
| 3618 | call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); | ||
| 3619 | } | 3615 | } |
| 3620 | 3616 | ||
| 3621 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); | 3617 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); |
| @@ -3623,13 +3619,8 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
| 3623 | return 0; | 3619 | return 0; |
| 3624 | } | 3620 | } |
| 3625 | 3621 | ||
| 3626 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3622 | static void nf_tables_abort_release(struct nft_trans *trans) |
| 3627 | * aborted rules. | ||
| 3628 | */ | ||
| 3629 | static void nf_tables_abort_release_rcu(struct rcu_head *rt) | ||
| 3630 | { | 3623 | { |
| 3631 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
| 3632 | |||
| 3633 | switch (trans->msg_type) { | 3624 | switch (trans->msg_type) { |
| 3634 | case NFT_MSG_NEWTABLE: | 3625 | case NFT_MSG_NEWTABLE: |
| 3635 | nf_tables_table_destroy(&trans->ctx); | 3626 | nf_tables_table_destroy(&trans->ctx); |
| @@ -3725,11 +3716,12 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
| 3725 | } | 3716 | } |
| 3726 | } | 3717 | } |
| 3727 | 3718 | ||
| 3719 | synchronize_rcu(); | ||
| 3720 | |||
| 3728 | list_for_each_entry_safe_reverse(trans, next, | 3721 | list_for_each_entry_safe_reverse(trans, next, |
| 3729 | &net->nft.commit_list, list) { | 3722 | &net->nft.commit_list, list) { |
| 3730 | list_del(&trans->list); | 3723 | list_del(&trans->list); |
| 3731 | trans->ctx.nla = NULL; | 3724 | nf_tables_abort_release(trans); |
| 3732 | call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); | ||
| 3733 | } | 3725 | } |
| 3734 | 3726 | ||
| 3735 | return 0; | 3727 | return 0; |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 6c5a915cfa75..13c2e17bbe27 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
| @@ -47,6 +47,8 @@ static const int nfnl_group2type[NFNLGRP_MAX+1] = { | |||
| 47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, | 47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, |
| 48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, | 48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, |
| 49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, | 49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, |
| 50 | [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES, | ||
| 51 | [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT, | ||
| 50 | }; | 52 | }; |
| 51 | 53 | ||
| 52 | void nfnl_lock(__u8 subsys_id) | 54 | void nfnl_lock(__u8 subsys_id) |
| @@ -464,7 +466,12 @@ static void nfnetlink_rcv(struct sk_buff *skb) | |||
| 464 | static int nfnetlink_bind(int group) | 466 | static int nfnetlink_bind(int group) |
| 465 | { | 467 | { |
| 466 | const struct nfnetlink_subsystem *ss; | 468 | const struct nfnetlink_subsystem *ss; |
| 467 | int type = nfnl_group2type[group]; | 469 | int type; |
| 470 | |||
| 471 | if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) | ||
| 472 | return -EINVAL; | ||
| 473 | |||
| 474 | type = nfnl_group2type[group]; | ||
| 468 | 475 | ||
| 469 | rcu_read_lock(); | 476 | rcu_read_lock(); |
| 470 | ss = nfnetlink_get_subsys(type); | 477 | ss = nfnetlink_get_subsys(type); |
| @@ -514,6 +521,9 @@ static int __init nfnetlink_init(void) | |||
| 514 | { | 521 | { |
| 515 | int i; | 522 | int i; |
| 516 | 523 | ||
| 524 | for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++) | ||
| 525 | BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE); | ||
| 526 | |||
| 517 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) | 527 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) |
| 518 | mutex_init(&table[i].mutex); | 528 | mutex_init(&table[i].mutex); |
| 519 | 529 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 9d6d6f60a80f..265e190f2218 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
| @@ -21,45 +21,17 @@ | |||
| 21 | #include <linux/netfilter_ipv6/ip6_tables.h> | 21 | #include <linux/netfilter_ipv6/ip6_tables.h> |
| 22 | #include <net/netfilter/nf_tables.h> | 22 | #include <net/netfilter/nf_tables.h> |
| 23 | 23 | ||
| 24 | static const struct { | ||
| 25 | const char *name; | ||
| 26 | u8 type; | ||
| 27 | } table_to_chaintype[] = { | ||
| 28 | { "filter", NFT_CHAIN_T_DEFAULT }, | ||
| 29 | { "raw", NFT_CHAIN_T_DEFAULT }, | ||
| 30 | { "security", NFT_CHAIN_T_DEFAULT }, | ||
| 31 | { "mangle", NFT_CHAIN_T_ROUTE }, | ||
| 32 | { "nat", NFT_CHAIN_T_NAT }, | ||
| 33 | { }, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static int nft_compat_table_to_chaintype(const char *table) | ||
| 37 | { | ||
| 38 | int i; | ||
| 39 | |||
| 40 | for (i = 0; table_to_chaintype[i].name != NULL; i++) { | ||
| 41 | if (strcmp(table_to_chaintype[i].name, table) == 0) | ||
| 42 | return table_to_chaintype[i].type; | ||
| 43 | } | ||
| 44 | |||
| 45 | return -1; | ||
| 46 | } | ||
| 47 | |||
| 48 | static int nft_compat_chain_validate_dependency(const char *tablename, | 24 | static int nft_compat_chain_validate_dependency(const char *tablename, |
| 49 | const struct nft_chain *chain) | 25 | const struct nft_chain *chain) |
| 50 | { | 26 | { |
| 51 | enum nft_chain_type type; | ||
| 52 | const struct nft_base_chain *basechain; | 27 | const struct nft_base_chain *basechain; |
| 53 | 28 | ||
| 54 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) | 29 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) |
| 55 | return 0; | 30 | return 0; |
| 56 | 31 | ||
| 57 | type = nft_compat_table_to_chaintype(tablename); | ||
| 58 | if (type < 0) | ||
| 59 | return -EINVAL; | ||
| 60 | |||
| 61 | basechain = nft_base_chain(chain); | 32 | basechain = nft_base_chain(chain); |
| 62 | if (basechain->type->type != type) | 33 | if (strcmp(tablename, "nat") == 0 && |
| 34 | basechain->type->type != NFT_CHAIN_T_NAT) | ||
| 63 | return -EINVAL; | 35 | return -EINVAL; |
| 64 | 36 | ||
| 65 | return 0; | 37 | return 0; |
| @@ -117,7 +89,7 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
| 117 | struct xt_target *target, void *info, | 89 | struct xt_target *target, void *info, |
| 118 | union nft_entry *entry, u8 proto, bool inv) | 90 | union nft_entry *entry, u8 proto, bool inv) |
| 119 | { | 91 | { |
| 120 | par->net = &init_net; | 92 | par->net = ctx->net; |
| 121 | par->table = ctx->table->name; | 93 | par->table = ctx->table->name; |
| 122 | switch (ctx->afi->family) { | 94 | switch (ctx->afi->family) { |
| 123 | case AF_INET: | 95 | case AF_INET: |
| @@ -324,7 +296,7 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
| 324 | struct xt_match *match, void *info, | 296 | struct xt_match *match, void *info, |
| 325 | union nft_entry *entry, u8 proto, bool inv) | 297 | union nft_entry *entry, u8 proto, bool inv) |
| 326 | { | 298 | { |
| 327 | par->net = &init_net; | 299 | par->net = ctx->net; |
| 328 | par->table = ctx->table->name; | 300 | par->table = ctx->table->name; |
| 329 | switch (ctx->afi->family) { | 301 | switch (ctx->afi->family) { |
| 330 | case AF_INET: | 302 | case AF_INET: |
| @@ -374,7 +346,7 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 374 | union nft_entry e = {}; | 346 | union nft_entry e = {}; |
| 375 | int ret; | 347 | int ret; |
| 376 | 348 | ||
| 377 | ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); | 349 | ret = nft_compat_chain_validate_dependency(match->table, ctx->chain); |
| 378 | if (ret < 0) | 350 | if (ret < 0) |
| 379 | goto err; | 351 | goto err; |
| 380 | 352 | ||
| @@ -448,7 +420,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
| 448 | if (!(hook_mask & match->hooks)) | 420 | if (!(hook_mask & match->hooks)) |
| 449 | return -EINVAL; | 421 | return -EINVAL; |
| 450 | 422 | ||
| 451 | ret = nft_compat_chain_validate_dependency(match->name, | 423 | ret = nft_compat_chain_validate_dependency(match->table, |
| 452 | ctx->chain); | 424 | ctx->chain); |
| 453 | if (ret < 0) | 425 | if (ret < 0) |
| 454 | return ret; | 426 | return ret; |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 006886dbee36..8c4229b11c34 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
| @@ -246,11 +246,11 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
| 246 | { | 246 | { |
| 247 | int transport_len = skb->len - skb_transport_offset(skb); | 247 | int transport_len = skb->len - skb_transport_offset(skb); |
| 248 | 248 | ||
| 249 | if (l4_proto == IPPROTO_TCP) { | 249 | if (l4_proto == NEXTHDR_TCP) { |
| 250 | if (likely(transport_len >= sizeof(struct tcphdr))) | 250 | if (likely(transport_len >= sizeof(struct tcphdr))) |
| 251 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, | 251 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, |
| 252 | addr, new_addr, 1); | 252 | addr, new_addr, 1); |
| 253 | } else if (l4_proto == IPPROTO_UDP) { | 253 | } else if (l4_proto == NEXTHDR_UDP) { |
| 254 | if (likely(transport_len >= sizeof(struct udphdr))) { | 254 | if (likely(transport_len >= sizeof(struct udphdr))) { |
| 255 | struct udphdr *uh = udp_hdr(skb); | 255 | struct udphdr *uh = udp_hdr(skb); |
| 256 | 256 | ||
| @@ -261,6 +261,10 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
| 261 | uh->check = CSUM_MANGLED_0; | 261 | uh->check = CSUM_MANGLED_0; |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
| 264 | } else if (l4_proto == NEXTHDR_ICMP) { | ||
| 265 | if (likely(transport_len >= sizeof(struct icmp6hdr))) | ||
| 266 | inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum, | ||
| 267 | skb, addr, new_addr, 1); | ||
| 264 | } | 268 | } |
| 265 | } | 269 | } |
| 266 | 270 | ||
| @@ -722,8 +726,6 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
| 722 | 726 | ||
| 723 | case OVS_ACTION_ATTR_SAMPLE: | 727 | case OVS_ACTION_ATTR_SAMPLE: |
| 724 | err = sample(dp, skb, key, a); | 728 | err = sample(dp, skb, key, a); |
| 725 | if (unlikely(err)) /* skb already freed. */ | ||
| 726 | return err; | ||
| 727 | break; | 729 | break; |
| 728 | } | 730 | } |
| 729 | 731 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e6d7255183eb..f9e556b56086 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -1265,7 +1265,7 @@ static size_t ovs_dp_cmd_msg_size(void) | |||
| 1265 | return msgsize; | 1265 | return msgsize; |
| 1266 | } | 1266 | } |
| 1267 | 1267 | ||
| 1268 | /* Called with ovs_mutex or RCU read lock. */ | 1268 | /* Called with ovs_mutex. */ |
| 1269 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, | 1269 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, |
| 1270 | u32 portid, u32 seq, u32 flags, u8 cmd) | 1270 | u32 portid, u32 seq, u32 flags, u8 cmd) |
| 1271 | { | 1271 | { |
| @@ -1555,7 +1555,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
| 1555 | if (!reply) | 1555 | if (!reply) |
| 1556 | return -ENOMEM; | 1556 | return -ENOMEM; |
| 1557 | 1557 | ||
| 1558 | rcu_read_lock(); | 1558 | ovs_lock(); |
| 1559 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); | 1559 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); |
| 1560 | if (IS_ERR(dp)) { | 1560 | if (IS_ERR(dp)) { |
| 1561 | err = PTR_ERR(dp); | 1561 | err = PTR_ERR(dp); |
| @@ -1564,12 +1564,12 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
| 1564 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, | 1564 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, |
| 1565 | info->snd_seq, 0, OVS_DP_CMD_NEW); | 1565 | info->snd_seq, 0, OVS_DP_CMD_NEW); |
| 1566 | BUG_ON(err < 0); | 1566 | BUG_ON(err < 0); |
| 1567 | rcu_read_unlock(); | 1567 | ovs_unlock(); |
| 1568 | 1568 | ||
| 1569 | return genlmsg_reply(reply, info); | 1569 | return genlmsg_reply(reply, info); |
| 1570 | 1570 | ||
| 1571 | err_unlock_free: | 1571 | err_unlock_free: |
| 1572 | rcu_read_unlock(); | 1572 | ovs_unlock(); |
| 1573 | kfree_skb(reply); | 1573 | kfree_skb(reply); |
| 1574 | return err; | 1574 | return err; |
| 1575 | } | 1575 | } |
| @@ -1581,8 +1581,8 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 1581 | int skip = cb->args[0]; | 1581 | int skip = cb->args[0]; |
| 1582 | int i = 0; | 1582 | int i = 0; |
| 1583 | 1583 | ||
| 1584 | rcu_read_lock(); | 1584 | ovs_lock(); |
| 1585 | list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { | 1585 | list_for_each_entry(dp, &ovs_net->dps, list_node) { |
| 1586 | if (i >= skip && | 1586 | if (i >= skip && |
| 1587 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, | 1587 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, |
| 1588 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1588 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
| @@ -1590,7 +1590,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 1590 | break; | 1590 | break; |
| 1591 | i++; | 1591 | i++; |
| 1592 | } | 1592 | } |
| 1593 | rcu_read_unlock(); | 1593 | ovs_unlock(); |
| 1594 | 1594 | ||
| 1595 | cb->args[0] = i; | 1595 | cb->args[0] = i; |
| 1596 | 1596 | ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 939bcb32100f..089b195c064a 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
| @@ -145,7 +145,7 @@ static bool match_validate(const struct sw_flow_match *match, | |||
| 145 | if (match->key->eth.type == htons(ETH_P_ARP) | 145 | if (match->key->eth.type == htons(ETH_P_ARP) |
| 146 | || match->key->eth.type == htons(ETH_P_RARP)) { | 146 | || match->key->eth.type == htons(ETH_P_RARP)) { |
| 147 | key_expected |= 1 << OVS_KEY_ATTR_ARP; | 147 | key_expected |= 1 << OVS_KEY_ATTR_ARP; |
| 148 | if (match->mask && (match->mask->key.eth.type == htons(0xffff))) | 148 | if (match->mask && (match->mask->key.tp.src == htons(0xff))) |
| 149 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; | 149 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| @@ -689,6 +689,13 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, | |||
| 689 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); | 689 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); |
| 690 | return -EINVAL; | 690 | return -EINVAL; |
| 691 | } | 691 | } |
| 692 | |||
| 693 | if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) { | ||
| 694 | OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n", | ||
| 695 | ntohl(ipv6_key->ipv6_label), (1 << 20) - 1); | ||
| 696 | return -EINVAL; | ||
| 697 | } | ||
| 698 | |||
| 692 | SW_FLOW_KEY_PUT(match, ipv6.label, | 699 | SW_FLOW_KEY_PUT(match, ipv6.label, |
| 693 | ipv6_key->ipv6_label, is_mask); | 700 | ipv6_key->ipv6_label, is_mask); |
| 694 | SW_FLOW_KEY_PUT(match, ip.proto, | 701 | SW_FLOW_KEY_PUT(match, ip.proto, |
