032-net-mvneta-Make-the-default-queue-related-for-each-p.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. From: Gregory CLEMENT <gregory.clement@free-electrons.com>
  2. Date: Wed, 9 Dec 2015 18:23:48 +0100
  3. Subject: [PATCH] net: mvneta: Make the default queue related for each port
  4. Instead of using the same default queue for all the port. Move it in the
  5. port struct. It will allow have a different default queue for each port.
  6. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
  7. Signed-off-by: David S. Miller <davem@davemloft.net>
  8. ---
  9. --- a/drivers/net/ethernet/marvell/mvneta.c
  10. +++ b/drivers/net/ethernet/marvell/mvneta.c
  11. @@ -356,6 +356,7 @@ struct mvneta_port {
  12. struct mvneta_tx_queue *txqs;
  13. struct net_device *dev;
  14. struct notifier_block cpu_notifier;
  15. + int rxq_def;
  16. /* Core clock */
  17. struct clk *clk;
  18. @@ -819,7 +820,7 @@ static void mvneta_port_up(struct mvneta
  19. mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
  20. /* Enable all initialized RXQs. */
  21. - mvreg_write(pp, MVNETA_RXQ_CMD, BIT(rxq_def));
  22. + mvreg_write(pp, MVNETA_RXQ_CMD, BIT(pp->rxq_def));
  23. }
  24. /* Stop the Ethernet port activity */
  25. @@ -1067,7 +1068,7 @@ static void mvneta_defaults_set(struct m
  26. mvreg_write(pp, MVNETA_ACC_MODE, val);
  27. /* Update val of portCfg register accordingly with all RxQueue types */
  28. - val = MVNETA_PORT_CONFIG_DEFL_VALUE(rxq_def);
  29. + val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
  30. mvreg_write(pp, MVNETA_PORT_CONFIG, val);
  31. val = 0;
  32. @@ -2101,19 +2102,19 @@ static void mvneta_set_rx_mode(struct ne
  33. if (dev->flags & IFF_PROMISC) {
  34. /* Accept all: Multicast + Unicast */
  35. mvneta_rx_unicast_promisc_set(pp, 1);
  36. - mvneta_set_ucast_table(pp, rxq_def);
  37. - mvneta_set_special_mcast_table(pp, rxq_def);
  38. - mvneta_set_other_mcast_table(pp, rxq_def);
  39. + mvneta_set_ucast_table(pp, pp->rxq_def);
  40. + mvneta_set_special_mcast_table(pp, pp->rxq_def);
  41. + mvneta_set_other_mcast_table(pp, pp->rxq_def);
  42. } else {
  43. /* Accept single Unicast */
  44. mvneta_rx_unicast_promisc_set(pp, 0);
  45. mvneta_set_ucast_table(pp, -1);
  46. - mvneta_mac_addr_set(pp, dev->dev_addr, rxq_def);
  47. + mvneta_mac_addr_set(pp, dev->dev_addr, pp->rxq_def);
  48. if (dev->flags & IFF_ALLMULTI) {
  49. /* Accept all multicast */
  50. - mvneta_set_special_mcast_table(pp, rxq_def);
  51. - mvneta_set_other_mcast_table(pp, rxq_def);
  52. + mvneta_set_special_mcast_table(pp, pp->rxq_def);
  53. + mvneta_set_other_mcast_table(pp, pp->rxq_def);
  54. } else {
  55. /* Accept only initialized multicast */
  56. mvneta_set_special_mcast_table(pp, -1);
  57. @@ -2122,7 +2123,7 @@ static void mvneta_set_rx_mode(struct ne
  58. if (!netdev_mc_empty(dev)) {
  59. netdev_for_each_mc_addr(ha, dev) {
  60. mvneta_mcast_addr_set(pp, ha->addr,
  61. - rxq_def);
  62. + pp->rxq_def);
  63. }
  64. }
  65. }
  66. @@ -2205,7 +2206,7 @@ static int mvneta_poll(struct napi_struc
  67. * RX packets
  68. */
  69. cause_rx_tx |= port->cause_rx_tx;
  70. - rx_done = mvneta_rx(pp, budget, &pp->rxqs[rxq_def]);
  71. + rx_done = mvneta_rx(pp, budget, &pp->rxqs[pp->rxq_def]);
  72. budget -= rx_done;
  73. if (budget > 0) {
  74. @@ -2418,17 +2419,17 @@ static void mvneta_cleanup_txqs(struct m
  75. /* Cleanup all Rx queues */
  76. static void mvneta_cleanup_rxqs(struct mvneta_port *pp)
  77. {
  78. - mvneta_rxq_deinit(pp, &pp->rxqs[rxq_def]);
  79. + mvneta_rxq_deinit(pp, &pp->rxqs[pp->rxq_def]);
  80. }
  81. /* Init all Rx queues */
  82. static int mvneta_setup_rxqs(struct mvneta_port *pp)
  83. {
  84. - int err = mvneta_rxq_init(pp, &pp->rxqs[rxq_def]);
  85. + int err = mvneta_rxq_init(pp, &pp->rxqs[pp->rxq_def]);
  86. if (err) {
  87. netdev_err(pp->dev, "%s: can't create rxq=%d\n",
  88. - __func__, rxq_def);
  89. + __func__, pp->rxq_def);
  90. mvneta_cleanup_rxqs(pp);
  91. return err;
  92. }
  93. @@ -2634,7 +2635,7 @@ static int mvneta_set_mac_addr(struct ne
  94. mvneta_mac_addr_set(pp, dev->dev_addr, -1);
  95. /* Set new addr in hw */
  96. - mvneta_mac_addr_set(pp, sockaddr->sa_data, rxq_def);
  97. + mvneta_mac_addr_set(pp, sockaddr->sa_data, pp->rxq_def);
  98. eth_commit_mac_addr_change(dev, addr);
  99. return 0;
  100. @@ -2753,7 +2754,7 @@ static void mvneta_percpu_elect(struct m
  101. {
  102. int online_cpu_idx, cpu, i = 0;
  103. - online_cpu_idx = rxq_def % num_online_cpus();
  104. + online_cpu_idx = pp->rxq_def % num_online_cpus();
  105. for_each_online_cpu(cpu) {
  106. if (i == online_cpu_idx)
  107. @@ -3363,6 +3364,8 @@ static int mvneta_probe(struct platform_
  108. strcmp(managed, "in-band-status") == 0);
  109. pp->cpu_notifier.notifier_call = mvneta_percpu_notifier;
  110. + pp->rxq_def = rxq_def;
  111. +
  112. pp->clk = devm_clk_get(&pdev->dev, NULL);
  113. if (IS_ERR(pp->clk)) {
  114. err = PTR_ERR(pp->clk);