On Tue, Feb 2, 2010 at 5:44 AM, Vladimir Sokolovsky
<vlad@xxxxxxxxxxxxxxxxxx> wrote:
> Sean Hefty wrote:
>>>
>>> This patchset adds support for the following enhanced atomic operations:
>>> - Masked atomic compare and swap
>>> - Masked atomic fetch and add
>>
>> Can you explain these in more detail? How exactly is a mask used? Are
>> there
>> any restrictions on the format of the mask? How is the mask carried over
>> the
>> wire? etc.
>>
>> --
>
> Masked Compare and Swap (MskCmpSwap)
> The MskCmpSwap atomic operation is an extension to the CmpSwap operation
> defined in the IB
> spec. MskCmpSwap allows the user to select a portion of the 64 bit target
> data for the “compare”
> check as well as to restrict the swap to a (possibly different) portion. The
> pseudo code below
> describes the operation:
>
> -----
> atomic_response = *va
> if (((cmp XOR *va) AND cmp_mask) is ZERO) then
> *va = (*va AND NOT(swap_mask)) OR (swap AND swap_mask)
>
> return atomic_response
> -----
>
> The additional operands are carried in the Extended Transport Header. Atomic
> response generation
> and packet format for MskCmpSwap is as for standard IB Atomic operations.
>
>
> Masked Fetch and Add (MFetchAdd)
> The MFetchAdd Atomic operation extends the functionality of the standard IB
> FetchAdd by
> allowing the user to split the target into multiple fields of selectable
> length. The atomic add is done
> independently on each one of this fields. A bit set in the field_boundary
> parameter specifies the
> field boundaries. The pseudo code below describes the operation:
>
> ------------
> bit_adder(ci, b1, b2, *co)
> {
> value = ci + b1 + b2;
>
> if (value & 2)
> *co = 1
> else
> *co = 0
>
> return value & 1
> }
>
> mask = 1
> carry = 0
> atomic_response = *va
> #define MASK_IS_SET(mask, attr) (((mask)&(attr))!=0)
>
> for i = 0 to 63
> {
> if ( i != 0 )
> mask = mask << 1;
>
> bit_add_res = bit_adder(carry, MASK_IS_SET(atomic_response, mask),
> MASK_IS_SET(add_value, mask), &new_carry)
> if (bit_add_res)
> atomic_response |= mask
>
> carry = ((new_carry) && (!MASK_IS_SET(cmp_mask, mask)))
> }
>
> return atomic_response
> ------------
>
> The additional operands are carried in the Extended Transport Header. Atomic
> response generation
> and packet format for MFetchAdd is as for standard IB Atomic operations.
Will Mellanox be adding this option to the IB spec rather than keep it
as vendor proprietary ?
-- Hal
>
> Regards,
> Vladimir
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html