>>      * dld_qdepth() loop seems a bit odd -- why does it calculate the
>>        first iteration in the initialization to the `for' loop?  Would
>>        seem more natural as:
>>
>>           for (mp = dsp->ds_tx_list_head, mp != NULL; mp = mp->b_next) {
>>                  size = get_mpsize(mp);
>>                  cnt += size;
>>                  msgcnt++;
>>                  if (cnt >= dld_max_q_count || msgcnt > dld_max_q_count) {
>>                          ASSERT(dsp->ds_tx_qbusy);
>>                          dsp->ds_tx_list_tail = mp;
>>                          freemsgchain(mp->b_next);
>>                          mp->b_next = NULL;
>>                          cnt -= size;
>>                          msgcnt--;
>>                          break;
>>                  }
>>           }
>>
>>        ... or (perhaps slower, but simpler):
>>
>>           for (mp = dsp->ds_tx_list_head, mp != NULL; mp = mp->b_next) {
>>                  size = get_mpsize(mp);
>>                  if (cnt + size > dld_max_q_count ||
>>                   msgcnt == dld_max_q_count) {
>>                          ASSERT(dsp->ds_tx_qbusy);
>>                          dsp->ds_tx_list_tail = mp;
>>                          freemsgchain(mp->b_next);
>>                          mp->b_next = NULL;
>>                          break;
>>                  }
>>                  cnt += size;
>>                  msgcnt++;
>>           }
>>
>>        Either would also eliminate the need for the check at line 2215.

I don't think either of the above is correct. Note that once the message 
size reaches the threshold, mp should be the first one needs to be freed, 
the the previous message should be set as dsp->ds_tx_list_tail.

- Cathy


Reply via email to