• Marcin Szycik's avatar
    ice: Add direction metadata · 0960a27b
    Marcin Szycik authored
    Currently it is possible to create a filter which breaks TX traffic, e.g.:
    
    tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp
    dst_port $PORT action mirred egress redirect dev $VF1_PR
    
    This adds a rule which might match both TX and RX traffic, and in TX path
    the PF will actually receive the traffic, which breaks communication.
    
    To fix this, add a match on direction metadata flag when adding a tc rule.
    
    Because of the way metadata is currently handled, a duplicate lookup word
    would appear if VLAN metadata is also added. The lookup would still work
    correctly, but one word would be wasted. To prevent it, lookup 0 now always
    contains all metadata. When any metadata needs to be added, it is added to
    lookup 0 and lookup count is not incremented. This way, two flags residing
    in the same word will take up one word, instead of two.
    
    Note: the drop action is also affected, i.e. it will now only work in one
    direction.
    Signed-off-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
    Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
    Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    0960a27b
ice_tc_lib.c 54.7 KB