45
45
#include "openvswitch/vlog.h"
46
46
#include "openflow/intel-ext.h"
47
47
#include "packets.h"
48
- #include "pktbuf.h"
49
48
#include "random.h"
50
49
#include "tun-metadata.h"
51
50
#include "unaligned.h"
@@ -3588,17 +3587,14 @@ encode_packet_in_reason(enum ofp_packet_in_reason reason,
3588
3587
* function omits it. The caller can add it itself if desired. */
3589
3588
static void
3590
3589
ofputil_put_packet_in (const struct ofputil_packet_in * pin ,
3591
- enum ofp_version version , uint32_t buffer_id ,
3592
- size_t include_bytes , struct ofpbuf * msg )
3590
+ enum ofp_version version , size_t include_bytes ,
3591
+ struct ofpbuf * msg )
3593
3592
{
3594
3593
/* Add packet properties. */
3595
3594
ofpprop_put (msg , NXPINT_PACKET , pin -> packet , include_bytes );
3596
3595
if (include_bytes != pin -> packet_len ) {
3597
3596
ofpprop_put_u32 (msg , NXPINT_FULL_LEN , pin -> packet_len );
3598
3597
}
3599
- if (buffer_id != UINT32_MAX ) {
3600
- ofpprop_put_u32 (msg , NXPINT_BUFFER_ID , buffer_id );
3601
- }
3602
3598
3603
3599
/* Add flow properties. */
3604
3600
ofpprop_put_u8 (msg , NXPINT_TABLE_ID , pin -> table_id );
@@ -3642,11 +3638,10 @@ enum nx_continuation_prop_type {
3642
3638
* function omits it. The caller can add it itself if desired. */
3643
3639
static void
3644
3640
ofputil_put_packet_in_private (const struct ofputil_packet_in_private * pin ,
3645
- enum ofp_version version , uint32_t buffer_id ,
3646
- size_t include_bytes , struct ofpbuf * msg )
3641
+ enum ofp_version version , size_t include_bytes ,
3642
+ struct ofpbuf * msg )
3647
3643
{
3648
- ofputil_put_packet_in (& pin -> public , version , buffer_id ,
3649
- include_bytes , msg );
3644
+ ofputil_put_packet_in (& pin -> public , version , include_bytes , msg );
3650
3645
3651
3646
size_t continuation_ofs = ofpprop_start_nested (msg , NXPINT_CONTINUATION );
3652
3647
size_t inner_ofs = msg -> size ;
@@ -3734,8 +3729,7 @@ ofputil_put_packet_in_private(const struct ofputil_packet_in_private *pin,
3734
3729
}
3735
3730
3736
3731
static struct ofpbuf *
3737
- ofputil_encode_ofp10_packet_in (const struct ofputil_packet_in * pin ,
3738
- uint32_t buffer_id )
3732
+ ofputil_encode_ofp10_packet_in (const struct ofputil_packet_in * pin )
3739
3733
{
3740
3734
struct ofp10_packet_in * opi ;
3741
3735
struct ofpbuf * msg ;
@@ -3746,14 +3740,14 @@ ofputil_encode_ofp10_packet_in(const struct ofputil_packet_in *pin,
3746
3740
opi -> total_len = htons (pin -> packet_len );
3747
3741
opi -> in_port = htons (ofp_to_u16 (pin -> flow_metadata .flow .in_port .ofp_port ));
3748
3742
opi -> reason = encode_packet_in_reason (pin -> reason , OFP10_VERSION );
3749
- opi -> buffer_id = htonl (buffer_id );
3743
+ opi -> buffer_id = htonl (UINT32_MAX );
3750
3744
3751
3745
return msg ;
3752
3746
}
3753
3747
3754
3748
static struct ofpbuf *
3755
3749
ofputil_encode_nx_packet_in (const struct ofputil_packet_in * pin ,
3756
- enum ofp_version version , uint32_t buffer_id )
3750
+ enum ofp_version version )
3757
3751
{
3758
3752
struct nx_packet_in * npi ;
3759
3753
struct ofpbuf * msg ;
@@ -3767,7 +3761,7 @@ ofputil_encode_nx_packet_in(const struct ofputil_packet_in *pin,
3767
3761
ofpbuf_put_zeros (msg , 2 );
3768
3762
3769
3763
npi = msg -> msg ;
3770
- npi -> buffer_id = htonl (buffer_id );
3764
+ npi -> buffer_id = htonl (UINT32_MAX );
3771
3765
npi -> total_len = htons (pin -> packet_len );
3772
3766
npi -> reason = encode_packet_in_reason (pin -> reason , version );
3773
3767
npi -> table_id = pin -> table_id ;
@@ -3779,8 +3773,7 @@ ofputil_encode_nx_packet_in(const struct ofputil_packet_in *pin,
3779
3773
3780
3774
static struct ofpbuf *
3781
3775
ofputil_encode_nx_packet_in2 (const struct ofputil_packet_in_private * pin ,
3782
- enum ofp_version version , uint32_t buffer_id ,
3783
- size_t include_bytes )
3776
+ enum ofp_version version , size_t include_bytes )
3784
3777
{
3785
3778
/* 'extra' is just an estimate of the space required. */
3786
3779
size_t extra = (pin -> public .packet_len
@@ -3792,7 +3785,7 @@ ofputil_encode_nx_packet_in2(const struct ofputil_packet_in_private *pin,
3792
3785
struct ofpbuf * msg = ofpraw_alloc_xid (OFPRAW_NXT_PACKET_IN2 , version ,
3793
3786
htonl (0 ), extra );
3794
3787
3795
- ofputil_put_packet_in_private (pin , version , buffer_id , include_bytes , msg );
3788
+ ofputil_put_packet_in_private (pin , version , include_bytes , msg );
3796
3789
if (pin -> public .userdata_len ) {
3797
3790
ofpprop_put (msg , NXPINT_USERDATA , pin -> public .userdata ,
3798
3791
pin -> public .userdata_len );
@@ -3803,16 +3796,15 @@ ofputil_encode_nx_packet_in2(const struct ofputil_packet_in_private *pin,
3803
3796
}
3804
3797
3805
3798
static struct ofpbuf *
3806
- ofputil_encode_ofp11_packet_in (const struct ofputil_packet_in * pin ,
3807
- uint32_t buffer_id )
3799
+ ofputil_encode_ofp11_packet_in (const struct ofputil_packet_in * pin )
3808
3800
{
3809
3801
struct ofp11_packet_in * opi ;
3810
3802
struct ofpbuf * msg ;
3811
3803
3812
3804
msg = ofpraw_alloc_xid (OFPRAW_OFPT11_PACKET_IN , OFP11_VERSION ,
3813
3805
htonl (0 ), pin -> packet_len );
3814
3806
opi = ofpbuf_put_zeros (msg , sizeof * opi );
3815
- opi -> buffer_id = htonl (buffer_id );
3807
+ opi -> buffer_id = htonl (UINT32_MAX );
3816
3808
opi -> in_port = ofputil_port_to_ofp11 (
3817
3809
pin -> flow_metadata .flow .in_port .ofp_port );
3818
3810
opi -> in_phy_port = opi -> in_port ;
@@ -3825,8 +3817,7 @@ ofputil_encode_ofp11_packet_in(const struct ofputil_packet_in *pin,
3825
3817
3826
3818
static struct ofpbuf *
3827
3819
ofputil_encode_ofp12_packet_in (const struct ofputil_packet_in * pin ,
3828
- enum ofp_version version ,
3829
- uint32_t buffer_id )
3820
+ enum ofp_version version )
3830
3821
{
3831
3822
enum ofpraw raw = (version >= OFP13_VERSION
3832
3823
? OFPRAW_OFPT13_PACKET_IN
@@ -3838,7 +3829,7 @@ ofputil_encode_ofp12_packet_in(const struct ofputil_packet_in *pin,
3838
3829
htonl (0 ), NXM_TYPICAL_LEN + 2 + pin -> packet_len );
3839
3830
3840
3831
struct ofp12_packet_in * opi = ofpbuf_put_zeros (msg , sizeof * opi );
3841
- opi -> buffer_id = htonl (buffer_id );
3832
+ opi -> buffer_id = htonl (UINT32_MAX );
3842
3833
opi -> total_len = htons (pin -> packet_len );
3843
3834
opi -> reason = encode_packet_in_reason (pin -> reason , version );
3844
3835
opi -> table_id = pin -> table_id ;
@@ -3857,11 +3848,6 @@ ofputil_encode_ofp12_packet_in(const struct ofputil_packet_in *pin,
3857
3848
/* Converts abstract ofputil_packet_in_private 'pin' into a PACKET_IN message
3858
3849
* for 'protocol', using the packet-in format specified by 'packet_in_format'.
3859
3850
*
3860
- * If 'pkt_buf' is nonnull and 'max_len' allows the packet to be buffered, this
3861
- * function will attempt to obtain a buffer ID from 'pktbuf' and truncate the
3862
- * packet to 'max_len' bytes. Otherwise, or if 'pktbuf' doesn't have a free
3863
- * buffer, it will send the whole packet without buffering.
3864
- *
3865
3851
* This function is really meant only for use by ovs-vswitchd. To any other
3866
3852
* code, the "continuation" data, i.e. the data that is in struct
3867
3853
* ofputil_packet_in_private but not in struct ofputil_packet_in, is supposed
@@ -3873,28 +3859,10 @@ ofputil_encode_ofp12_packet_in(const struct ofputil_packet_in *pin,
3873
3859
struct ofpbuf *
3874
3860
ofputil_encode_packet_in_private (const struct ofputil_packet_in_private * pin ,
3875
3861
enum ofputil_protocol protocol ,
3876
- enum nx_packet_in_format packet_in_format ,
3877
- uint16_t max_len , struct pktbuf * pktbuf )
3862
+ enum nx_packet_in_format packet_in_format )
3878
3863
{
3879
3864
enum ofp_version version = ofputil_protocol_to_ofp_version (protocol );
3880
3865
3881
- /* Get buffer ID. */
3882
- ofp_port_t in_port = pin -> public .flow_metadata .flow .in_port .ofp_port ;
3883
- uint32_t buffer_id = (max_len != OFPCML12_NO_BUFFER && pktbuf
3884
- ? pktbuf_save (pktbuf , pin -> public .packet ,
3885
- pin -> public .packet_len , in_port )
3886
- : UINT32_MAX );
3887
-
3888
- /* Calculate the number of bytes of the packet to include in the
3889
- * packet-in:
3890
- *
3891
- * - If not buffered, the whole thing.
3892
- *
3893
- * - Otherwise, no more than 'max_len' bytes. */
3894
- size_t include_bytes = (buffer_id == UINT32_MAX
3895
- ? pin -> public .packet_len
3896
- : MIN (max_len , pin -> public .packet_len ));
3897
-
3898
3866
struct ofpbuf * msg ;
3899
3867
switch (packet_in_format ) {
3900
3868
case NXPIF_STANDARD :
@@ -3903,19 +3871,19 @@ ofputil_encode_packet_in_private(const struct ofputil_packet_in_private *pin,
3903
3871
case OFPUTIL_P_OF10_STD_TID :
3904
3872
case OFPUTIL_P_OF10_NXM :
3905
3873
case OFPUTIL_P_OF10_NXM_TID :
3906
- msg = ofputil_encode_ofp10_packet_in (& pin -> public , buffer_id );
3874
+ msg = ofputil_encode_ofp10_packet_in (& pin -> public );
3907
3875
break ;
3908
3876
3909
3877
case OFPUTIL_P_OF11_STD :
3910
- msg = ofputil_encode_ofp11_packet_in (& pin -> public , buffer_id );
3878
+ msg = ofputil_encode_ofp11_packet_in (& pin -> public );
3911
3879
break ;
3912
3880
3913
3881
case OFPUTIL_P_OF12_OXM :
3914
3882
case OFPUTIL_P_OF13_OXM :
3915
3883
case OFPUTIL_P_OF14_OXM :
3916
3884
case OFPUTIL_P_OF15_OXM :
3917
3885
case OFPUTIL_P_OF16_OXM :
3918
- msg = ofputil_encode_ofp12_packet_in (& pin -> public , version , buffer_id );
3886
+ msg = ofputil_encode_ofp12_packet_in (& pin -> public , version );
3919
3887
break ;
3920
3888
3921
3889
default :
@@ -3924,18 +3892,18 @@ ofputil_encode_packet_in_private(const struct ofputil_packet_in_private *pin,
3924
3892
break ;
3925
3893
3926
3894
case NXPIF_NXT_PACKET_IN :
3927
- msg = ofputil_encode_nx_packet_in (& pin -> public , version , buffer_id );
3895
+ msg = ofputil_encode_nx_packet_in (& pin -> public , version );
3928
3896
break ;
3929
3897
3930
3898
case NXPIF_NXT_PACKET_IN2 :
3931
- return ofputil_encode_nx_packet_in2 (pin , version , buffer_id ,
3932
- include_bytes );
3899
+ return ofputil_encode_nx_packet_in2 (pin , version ,
3900
+ pin -> public . packet_len );
3933
3901
3934
3902
default :
3935
3903
OVS_NOT_REACHED ();
3936
3904
}
3937
3905
3938
- ofpbuf_put (msg , pin -> public .packet , include_bytes );
3906
+ ofpbuf_put (msg , pin -> public .packet , pin -> public . packet_len );
3939
3907
ofpmsg_update_length (msg );
3940
3908
return msg ;
3941
3909
}
@@ -4004,7 +3972,7 @@ ofputil_encode_resume(const struct ofputil_packet_in *pin,
4004
3972
size_t extra = pin -> packet_len + NXM_TYPICAL_LEN + continuation -> size ;
4005
3973
struct ofpbuf * msg = ofpraw_alloc_xid (OFPRAW_NXT_RESUME , version ,
4006
3974
0 , extra );
4007
- ofputil_put_packet_in (pin , version , UINT32_MAX , pin -> packet_len , msg );
3975
+ ofputil_put_packet_in (pin , version , pin -> packet_len , msg );
4008
3976
ofpprop_put_nested (msg , NXPINT_CONTINUATION , continuation );
4009
3977
ofpmsg_update_length (msg );
4010
3978
return msg ;
0 commit comments