提交 572c7245 编写于 作者: J Jakub Kicinski 提交者: David S. Miller

nfp: pass packet pointer to nfp_net_parse_meta()

Make nfp_net_parse_meta() take a packet pointer and return
a drop/no drop decision. Right now it returns the end of
metadata and caller compares it to the packet pointer.
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8fb0d2ce
...@@ -1661,9 +1661,9 @@ nfp_net_set_hash_desc(struct net_device *netdev, struct nfp_meta_parsed *meta, ...@@ -1661,9 +1661,9 @@ nfp_net_set_hash_desc(struct net_device *netdev, struct nfp_meta_parsed *meta,
&rx_hash->hash); &rx_hash->hash);
} }
static void * static bool
nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta, nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta,
void *data, int meta_len) void *data, void *pkt, int meta_len)
{ {
u32 meta_info; u32 meta_info;
...@@ -1694,13 +1694,13 @@ nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta, ...@@ -1694,13 +1694,13 @@ nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta,
data += 4; data += 4;
break; break;
default: default:
return NULL; return true;
} }
meta_info >>= NFP_NET_META_FIELD_SIZE; meta_info >>= NFP_NET_META_FIELD_SIZE;
} }
return data; return data != pkt;
} }
static void static void
...@@ -1885,12 +1885,10 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget) ...@@ -1885,12 +1885,10 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
nfp_net_set_hash_desc(dp->netdev, &meta, nfp_net_set_hash_desc(dp->netdev, &meta,
rxbuf->frag + meta_off, rxd); rxbuf->frag + meta_off, rxd);
} else if (meta_len) { } else if (meta_len) {
void *end; if (unlikely(nfp_net_parse_meta(dp->netdev, &meta,
end = nfp_net_parse_meta(dp->netdev, &meta,
rxbuf->frag + meta_off, rxbuf->frag + meta_off,
meta_len); rxbuf->frag + pkt_off,
if (unlikely(end != rxbuf->frag + pkt_off)) { meta_len))) {
nn_dp_warn(dp, "invalid RX packet metadata\n"); nn_dp_warn(dp, "invalid RX packet metadata\n");
nfp_net_rx_drop(dp, r_vec, rx_ring, rxbuf, nfp_net_rx_drop(dp, r_vec, rx_ring, rxbuf,
NULL); NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册