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


2121                             "%s: failed to enable slices\n", mgp->name);
2122                         goto abort_with_toeplitz;
2123                 }
2124         }
2125 
2126         for (i = 0; i < mgp->num_slices; i++) {
2127                 status = myri10ge_setup_slice(&mgp->ss[i]);
2128                 if (status != 0)
2129                         goto abort_with_slices;
2130         }
2131 
2132         /*
2133          * Tell the MCP how many buffers he has, and to
2134          *  bring the ethernet interface up
2135          *
2136          * Firmware needs the big buff size as a power of 2.  Lie and
2137          * tell him the buffer is larger, because we only use 1
2138          * buffer/pkt, and the mtu will prevent overruns
2139          */
2140         big_pow2 = myri10ge_mtu + MXGEFW_PAD;
2141         while ((big_pow2 & (big_pow2 - 1)) != 0)
2142                 big_pow2++;
2143 
2144         /* now give firmware buffers sizes, and MTU */
2145         cmd.data0 = myri10ge_mtu;
2146         status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_MTU, &cmd);
2147         cmd.data0 = myri10ge_small_bytes;
2148         status |=
2149             myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, &cmd);
2150         cmd.data0 = big_pow2;
2151         status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd);
2152         if (status) {
2153                 cmn_err(CE_WARN, "%s: Couldn't set buffer sizes\n", mgp->name);
2154                 goto abort_with_slices;
2155         }
2156 
2157 
2158         cmd.data0 = 1;
2159         status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_TSO_MODE, &cmd);
2160         if (status) {
2161                 cmn_err(CE_WARN, "%s: unable to setup TSO (%d)\n",


5420 
5421         /*
5422          * if the admin did not specify a limit to how many
5423          * slices we should use, cap it automatically to the
5424          * number of CPUs currently online
5425          */
5426         if (myri10ge_max_slices == -1)
5427                 myri10ge_max_slices = ncpus;
5428 
5429         if (mgp->num_slices > myri10ge_max_slices)
5430                 mgp->num_slices = myri10ge_max_slices;
5431 
5432 
5433         /*
5434          * Now try to allocate as many MSI-X vectors as we have
5435          * slices. We give up on MSI-X if we can only get a single
5436          * vector.
5437          */
5438         while (mgp->num_slices > 1) {
5439                 /* make sure it is a power of two */
5440                 while (mgp->num_slices & (mgp->num_slices - 1))
5441                         mgp->num_slices--;
5442                 if (mgp->num_slices == 1)
5443                         return (0);
5444 
5445                 status = myri10ge_add_intrs(mgp, 0);
5446                 if (status == 0) {
5447                         myri10ge_rem_intrs(mgp, 0);
5448                         if (mgp->intr_cnt == mgp->num_slices) {
5449                                 if (myri10ge_verbose)
5450                                         printf("Got %d slices!\n",
5451                                             mgp->num_slices);
5452                                 return (0);
5453                         }
5454                         mgp->num_slices = mgp->intr_cnt;
5455                 } else {
5456                         mgp->num_slices = mgp->num_slices / 2;
5457                 }
5458         }
5459 
5460         if (myri10ge_verbose)




2121                             "%s: failed to enable slices\n", mgp->name);
2122                         goto abort_with_toeplitz;
2123                 }
2124         }
2125 
2126         for (i = 0; i < mgp->num_slices; i++) {
2127                 status = myri10ge_setup_slice(&mgp->ss[i]);
2128                 if (status != 0)
2129                         goto abort_with_slices;
2130         }
2131 
2132         /*
2133          * Tell the MCP how many buffers he has, and to
2134          *  bring the ethernet interface up
2135          *
2136          * Firmware needs the big buff size as a power of 2.  Lie and
2137          * tell him the buffer is larger, because we only use 1
2138          * buffer/pkt, and the mtu will prevent overruns
2139          */
2140         big_pow2 = myri10ge_mtu + MXGEFW_PAD;
2141         while (!ISP2(big_pow2))
2142                 big_pow2++;
2143 
2144         /* now give firmware buffers sizes, and MTU */
2145         cmd.data0 = myri10ge_mtu;
2146         status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_MTU, &cmd);
2147         cmd.data0 = myri10ge_small_bytes;
2148         status |=
2149             myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, &cmd);
2150         cmd.data0 = big_pow2;
2151         status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd);
2152         if (status) {
2153                 cmn_err(CE_WARN, "%s: Couldn't set buffer sizes\n", mgp->name);
2154                 goto abort_with_slices;
2155         }
2156 
2157 
2158         cmd.data0 = 1;
2159         status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_TSO_MODE, &cmd);
2160         if (status) {
2161                 cmn_err(CE_WARN, "%s: unable to setup TSO (%d)\n",


5420 
5421         /*
5422          * if the admin did not specify a limit to how many
5423          * slices we should use, cap it automatically to the
5424          * number of CPUs currently online
5425          */
5426         if (myri10ge_max_slices == -1)
5427                 myri10ge_max_slices = ncpus;
5428 
5429         if (mgp->num_slices > myri10ge_max_slices)
5430                 mgp->num_slices = myri10ge_max_slices;
5431 
5432 
5433         /*
5434          * Now try to allocate as many MSI-X vectors as we have
5435          * slices. We give up on MSI-X if we can only get a single
5436          * vector.
5437          */
5438         while (mgp->num_slices > 1) {
5439                 /* make sure it is a power of two */
5440                 while (!ISP2(mgp->num_slices))
5441                         mgp->num_slices--;
5442                 if (mgp->num_slices == 1)
5443                         return (0);
5444 
5445                 status = myri10ge_add_intrs(mgp, 0);
5446                 if (status == 0) {
5447                         myri10ge_rem_intrs(mgp, 0);
5448                         if (mgp->intr_cnt == mgp->num_slices) {
5449                                 if (myri10ge_verbose)
5450                                         printf("Got %d slices!\n",
5451                                             mgp->num_slices);
5452                                 return (0);
5453                         }
5454                         mgp->num_slices = mgp->intr_cnt;
5455                 } else {
5456                         mgp->num_slices = mgp->num_slices / 2;
5457                 }
5458         }
5459 
5460         if (myri10ge_verbose)