struct dp_upcall_info has pointer to pkt_key which is already
available in OVS_CB. This also simplifies upcall handling
for gso packet.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
const struct nlattr *a;
int rem;
const struct nlattr *a;
int rem;
- BUG_ON(!OVS_CB(skb)->pkt_key);
-
upcall.cmd = OVS_PACKET_CMD_ACTION;
upcall.cmd = OVS_PACKET_CMD_ACTION;
- upcall.key = OVS_CB(skb)->pkt_key;
upcall.userdata = NULL;
upcall.portid = 0;
upcall.userdata = NULL;
upcall.portid = 0;
u32 n_mask_hit;
stats = this_cpu_ptr(dp->stats_percpu);
u32 n_mask_hit;
stats = this_cpu_ptr(dp->stats_percpu);
+ OVS_CB(skb)->pkt_key = pkt_key;
/* Look up flow. */
flow = ovs_flow_tbl_lookup_stats(&dp->table, pkt_key, skb_get_hash(skb),
/* Look up flow. */
flow = ovs_flow_tbl_lookup_stats(&dp->table, pkt_key, skb_get_hash(skb),
struct dp_upcall_info upcall;
upcall.cmd = OVS_PACKET_CMD_MISS;
struct dp_upcall_info upcall;
upcall.cmd = OVS_PACKET_CMD_MISS;
upcall.userdata = NULL;
upcall.portid = ovs_vport_find_upcall_portid(p, skb);
ovs_dp_upcall(dp, skb, &upcall);
upcall.userdata = NULL;
upcall.portid = ovs_vport_find_upcall_portid(p, skb);
ovs_dp_upcall(dp, skb, &upcall);
- OVS_CB(skb)->pkt_key = pkt_key;
OVS_CB(skb)->flow = flow;
ovs_flow_stats_update(OVS_CB(skb)->flow, pkt_key->tp.flags, skb);
OVS_CB(skb)->flow = flow;
ovs_flow_stats_update(OVS_CB(skb)->flow, pkt_key->tp.flags, skb);
struct dp_stats_percpu *stats;
int err;
struct dp_stats_percpu *stats;
int err;
+ BUG_ON(!OVS_CB(skb)->pkt_key);
+
if (upcall_info->portid == 0) {
err = -ENOTCONN;
goto err;
if (upcall_info->portid == 0) {
err = -ENOTCONN;
goto err;
const struct dp_upcall_info *upcall_info)
{
unsigned short gso_type = skb_shinfo(skb)->gso_type;
const struct dp_upcall_info *upcall_info)
{
unsigned short gso_type = skb_shinfo(skb)->gso_type;
- struct dp_upcall_info later_info;
struct sw_flow_key later_key;
struct sk_buff *segs, *nskb;
int err;
struct sw_flow_key later_key;
struct sk_buff *segs, *nskb;
int err;
if (IS_ERR(segs))
return PTR_ERR(segs);
if (IS_ERR(segs))
return PTR_ERR(segs);
+ if (gso_type & SKB_GSO_UDP) {
+ /* The initial flow key extracted by ovs_flow_extract()
+ * in this case is for a first fragment, so we need to
+ * properly mark later fragments.
+ */
+ later_key = *OVS_CB(skb)->pkt_key;
+ later_key.ip.frag = OVS_FRAG_TYPE_LATER;
+ }
+
/* Queue all of the segments. */
skb = segs;
do {
/* Queue all of the segments. */
skb = segs;
do {
+ if (gso_type & SKB_GSO_UDP && skb != segs)
+ OVS_CB(skb)->pkt_key = &later_key;
+
err = queue_userspace_packet(dp, skb, upcall_info);
if (err)
break;
err = queue_userspace_packet(dp, skb, upcall_info);
if (err)
break;
- if (skb == segs && gso_type & SKB_GSO_UDP) {
- /* The initial flow key extracted by ovs_flow_extract()
- * in this case is for a first fragment, so we need to
- * properly mark later fragments.
- */
- later_key = *upcall_info->key;
- later_key.ip.frag = OVS_FRAG_TYPE_LATER;
-
- later_info = *upcall_info;
- later_info.key = &later_key;
- upcall_info = &later_info;
- }
} while ((skb = skb->next));
/* Free all of the segments. */
} while ((skb = skb->next));
/* Free all of the segments. */
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
struct sk_buff *user_skb; /* to be queued to userspace */
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
struct sk_buff *user_skb; /* to be queued to userspace */
+ struct sw_flow_key *pkt_key = OVS_CB(skb)->pkt_key;
struct nlattr *nla;
struct genl_info info = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
struct nlattr *nla;
struct genl_info info = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
upcall->dp_ifindex = dp_ifindex;
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_KEY);
upcall->dp_ifindex = dp_ifindex;
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_KEY);
- err = ovs_nla_put_flow(dp, upcall_info->key,
- upcall_info->key, user_skb);
+ err = ovs_nla_put_flow(dp, pkt_key, pkt_key, user_skb);
BUG_ON(err);
nla_nest_end(user_skb, nla);
BUG_ON(err);
nla_nest_end(user_skb, nla);
/**
* struct dp_upcall - metadata to include with a packet to send to userspace
* @cmd: One of %OVS_PACKET_CMD_*.
/**
* struct dp_upcall - metadata to include with a packet to send to userspace
* @cmd: One of %OVS_PACKET_CMD_*.
- * @key: Becomes %OVS_PACKET_ATTR_KEY. Must be nonnull.
* @userdata: If nonnull, its variable-length value is passed to userspace as
* %OVS_PACKET_ATTR_USERDATA.
* @portid: Netlink PID to which packet should be sent. If @portid is 0 then no
* @userdata: If nonnull, its variable-length value is passed to userspace as
* %OVS_PACKET_ATTR_USERDATA.
* @portid: Netlink PID to which packet should be sent. If @portid is 0 then no
* counter.
*/
struct dp_upcall_info {
* counter.
*/
struct dp_upcall_info {
- u8 cmd;
- const struct sw_flow_key *key;
const struct nlattr *userdata;
u32 portid;
const struct nlattr *userdata;
u32 portid;