Alan Maguire wrote:
> Anurag S. Maskey wrote:
>> Alan,
>>
>> various things, tell me if you agree or not. One of us can fix the
>> issues:
>>
>> * when DL_NOTE_LINK_UP/DOWN event is received, and
>> nwamd_ncu_handle_link_state_event() is called, it should not change
>> the state as it does now. Rather, nwamd_ncp_check_priority_group()
>> should be called with the link's priority-group.
> Not sure that's the right approach. I think the right answer
> is for manaul NCUs to go online on getting a link up.
> For prioritized, we should ignore the link up event
> if the priority of the link is > (less prioritized) the
> current priority, otherwise we go online and then
> the object state change handler
> (nwamd_ncu_handle_state_event()) should check the
> priority group associated with the link going online
> or offline.
So, the algorithm here in nwamd_ncu_handle_link_state_event() should be:
if (DL_NOTE_LINK_UP event) {
if (priority of link > current_ncu_priority_group)
ignore event, do nothing.
if (priority of link = current_ncu_priority_group)
nwamd_ncp_check_priority_group(priority of link);
/* because if link in exclusive mode, with different link already
online, came UP, then ignore.
* If shared, then bring it up. All these will be taken care by
*nwamd_ncp_check_priority_group(). */
if (priority of link < current_ncu_priority_group) {
nwamd_ncp_deactivate_priority_group(current_ncu_priority_group);
nwamd_ncp_activate_priority_group(priority group of link);
}
if (DL_NOTE_LINK_DOWN event) {
if (priority of link != current_ncu_priority_group) {
do nothing;
} else {
nwamd_event_enqueue_timed(nwamd_event_init_ncu_check(),
ncu_wait_time);
}
}
>>
>> * current_ncu_priority_group should be initially set to UINT64_MAXINT
>> and also on refresh so that nwamd_ncp_check_priority_group() can
>> proceed above.
>>
> hmm, not sure. The find_next_priority_group stuff works
> on the value >= the current, so if we start with 0 we
> should be fine.
>> * from what I understand, wa.activate should be B_FALSE in
>> nwamd_ncp_deactivate_priority_group().
>>
> good catch!
>> * link_is_up() function doesn't seem to be working correctly, right?
>>
> no, and I don't think it's needed - I reintroduced it because
> I didn't realize that the dlpi_enabnotify() will trigger initial
> link state events for us. Thanks!
Don't we need to determine if a link is UP or not? If a link comes up
and it is in a lower priority-group than the current one, then nothing
is done (as per the algorithm above). Then, when that link's
priority-group is checked, we want to be able to find out if the link is
UP or not.
Anurag