mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
dp-packet: Rename 'dp_hash' in 'rss_hash'.
We already have the 'dp_hash' embedded in the metadata. This caused confusion in the code. With this commit it should be clear that 'rss_hash' is the packet hash used for internal purposes, while 'md.dp_hash' is part of the flow, computed during the execution of certain actions. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
committed by
Ethan Jackson
parent
11bfdaddf2
commit
2bc1bbd27d
@@ -63,7 +63,7 @@ struct dp_packet {
|
||||
void *base_; /* First byte of allocated space. */
|
||||
uint16_t data_ofs; /* First byte actually in use. */
|
||||
uint32_t size_; /* Number of bytes in use. */
|
||||
uint32_t dp_hash; /* Packet hash. */
|
||||
uint32_t rss_hash; /* Packet hash. */
|
||||
#endif
|
||||
uint32_t allocated; /* Number of bytes allocated. */
|
||||
|
||||
@@ -484,22 +484,22 @@ static inline void dp_packet_reset_packet(struct dp_packet *b, int off)
|
||||
b->l2_5_ofs = b->l3_ofs = b->l4_ofs = UINT16_MAX;
|
||||
}
|
||||
|
||||
static inline uint32_t dp_packet_get_dp_hash(struct dp_packet *p)
|
||||
static inline uint32_t dp_packet_get_rss_hash(struct dp_packet *p)
|
||||
{
|
||||
#ifdef DPDK_NETDEV
|
||||
return p->mbuf.hash.rss;
|
||||
#else
|
||||
return p->dp_hash;
|
||||
return p->rss_hash;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void dp_packet_set_dp_hash(struct dp_packet *p,
|
||||
static inline void dp_packet_set_rss_hash(struct dp_packet *p,
|
||||
uint32_t hash)
|
||||
{
|
||||
#ifdef DPDK_NETDEV
|
||||
p->mbuf.hash.rss = hash;
|
||||
#else
|
||||
p->dp_hash = hash;
|
||||
p->rss_hash = hash;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -3012,10 +3012,10 @@ dpif_netdev_packet_get_dp_hash(struct dp_packet *packet,
|
||||
{
|
||||
uint32_t hash;
|
||||
|
||||
hash = dp_packet_get_dp_hash(packet);
|
||||
hash = dp_packet_get_rss_hash(packet);
|
||||
if (OVS_UNLIKELY(!hash)) {
|
||||
hash = miniflow_hash_5tuple(mf, 0);
|
||||
dp_packet_set_dp_hash(packet, hash);
|
||||
dp_packet_set_rss_hash(packet, hash);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
@@ -3495,9 +3495,6 @@ dp_execute_cb(void *aux_, struct dp_packet **packets, int cnt,
|
||||
|
||||
recirc_pkt->md.recirc_id = nl_attr_get_u32(a);
|
||||
|
||||
/* Hash is private to each packet */
|
||||
recirc_pkt->md.dp_hash = dp_packet_get_dp_hash(packets[i]);
|
||||
|
||||
dp_netdev_input(pmd, &recirc_pkt, 1);
|
||||
}
|
||||
(*depth)--;
|
||||
|
@@ -642,7 +642,7 @@ netdev_bsd_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
|
||||
dp_packet_delete(packet);
|
||||
} else {
|
||||
dp_packet_pad(packet);
|
||||
dp_packet_set_dp_hash(packet, 0);
|
||||
dp_packet_set_rss_hash(packet, 0);
|
||||
packets[0] = packet;
|
||||
*c = 1;
|
||||
}
|
||||
|
@@ -834,7 +834,7 @@ netdev_dummy_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **arr,
|
||||
ovs_mutex_unlock(&netdev->mutex);
|
||||
|
||||
dp_packet_pad(packet);
|
||||
dp_packet_set_dp_hash(packet, 0);
|
||||
dp_packet_set_rss_hash(packet, 0);
|
||||
|
||||
arr[0] = packet;
|
||||
*c = 1;
|
||||
|
@@ -1058,7 +1058,7 @@ netdev_linux_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
|
||||
dp_packet_delete(buffer);
|
||||
} else {
|
||||
dp_packet_pad(buffer);
|
||||
dp_packet_set_dp_hash(buffer, 0);
|
||||
dp_packet_set_rss_hash(buffer, 0);
|
||||
packets[0] = buffer;
|
||||
*c = 1;
|
||||
}
|
||||
|
@@ -914,7 +914,7 @@ get_src_port(struct dp_packet *packet)
|
||||
{
|
||||
uint32_t hash;
|
||||
|
||||
hash = dp_packet_get_dp_hash(packet);
|
||||
hash = dp_packet_get_rss_hash(packet);
|
||||
|
||||
return htons((((uint64_t) hash * (tnl_udp_port_max - tnl_udp_port_min)) >> 32) +
|
||||
tnl_udp_port_min);
|
||||
|
@@ -312,7 +312,6 @@ odp_execute_set_action(struct dp_packet *packet, const struct nlattr *a)
|
||||
|
||||
case OVS_KEY_ATTR_DP_HASH:
|
||||
md->dp_hash = nl_attr_get_u32(a);
|
||||
dp_packet_set_dp_hash(packet, md->dp_hash);
|
||||
break;
|
||||
|
||||
case OVS_KEY_ATTR_RECIRC_ID:
|
||||
@@ -405,8 +404,7 @@ odp_execute_masked_set_action(struct dp_packet *packet,
|
||||
|
||||
case OVS_KEY_ATTR_DP_HASH:
|
||||
md->dp_hash = nl_attr_get_u32(a)
|
||||
| (dp_packet_get_dp_hash(packet) & ~*get_mask(a, uint32_t));
|
||||
dp_packet_set_dp_hash(packet, md->dp_hash);
|
||||
| (md->dp_hash & ~*get_mask(a, uint32_t));
|
||||
break;
|
||||
|
||||
case OVS_KEY_ATTR_RECIRC_ID:
|
||||
@@ -516,8 +514,7 @@ odp_execute_actions(void *dp, struct dp_packet **packets, int cnt, bool steal,
|
||||
flow_extract(packets[i], &flow);
|
||||
hash = flow_hash_5tuple(&flow, hash_act->hash_basis);
|
||||
|
||||
/* We also store the hash value with each packet */
|
||||
dp_packet_set_dp_hash(packets[i], hash ? hash : 1);
|
||||
packets[i]->md.dp_hash = hash;
|
||||
}
|
||||
} else {
|
||||
/* Assert on unknown hash algorithm. */
|
||||
|
Reference in New Issue
Block a user