Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/myri10ge/drv/myri10ge.c
          +++ new/usr/src/uts/common/io/myri10ge/drv/myri10ge.c
↓ open down ↓ 2130 lines elided ↑ open up ↑
2131 2131  
2132 2132          /*
2133 2133           * Tell the MCP how many buffers he has, and to
2134 2134           *  bring the ethernet interface up
2135 2135           *
2136 2136           * Firmware needs the big buff size as a power of 2.  Lie and
2137 2137           * tell him the buffer is larger, because we only use 1
2138 2138           * buffer/pkt, and the mtu will prevent overruns
2139 2139           */
2140 2140          big_pow2 = myri10ge_mtu + MXGEFW_PAD;
2141      -        while ((big_pow2 & (big_pow2 - 1)) != 0)
     2141 +        while (!ISP2(big_pow2))
2142 2142                  big_pow2++;
2143 2143  
2144 2144          /* now give firmware buffers sizes, and MTU */
2145 2145          cmd.data0 = myri10ge_mtu;
2146 2146          status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_MTU, &cmd);
2147 2147          cmd.data0 = myri10ge_small_bytes;
2148 2148          status |=
2149 2149              myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, &cmd);
2150 2150          cmd.data0 = big_pow2;
2151 2151          status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd);
↓ open down ↓ 3278 lines elided ↑ open up ↑
5430 5430                  mgp->num_slices = myri10ge_max_slices;
5431 5431  
5432 5432  
5433 5433          /*
5434 5434           * Now try to allocate as many MSI-X vectors as we have
5435 5435           * slices. We give up on MSI-X if we can only get a single
5436 5436           * vector.
5437 5437           */
5438 5438          while (mgp->num_slices > 1) {
5439 5439                  /* make sure it is a power of two */
5440      -                while (mgp->num_slices & (mgp->num_slices - 1))
     5440 +                while (!ISP2(mgp->num_slices))
5441 5441                          mgp->num_slices--;
5442 5442                  if (mgp->num_slices == 1)
5443 5443                          return (0);
5444 5444  
5445 5445                  status = myri10ge_add_intrs(mgp, 0);
5446 5446                  if (status == 0) {
5447 5447                          myri10ge_rem_intrs(mgp, 0);
5448 5448                          if (mgp->intr_cnt == mgp->num_slices) {
5449 5449                                  if (myri10ge_verbose)
5450 5450                                          printf("Got %d slices!\n",
↓ open down ↓ 728 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX