Excluding packet's information from the control plane

Hello guys,
I want to exclude some information of a packet which has been sent to the control plane such as ip source or destination, mac address etc. I am thinking to do it using bit manipulation in the packet.
Is there some easier way to do this in the control plane?
Also i want to change and the packet fields before send it again to the data plane.

Just as you can modify the contents of fields in packet headers that your P4 code has parsed, or add new headers using setValid(), or remove headers that were parsed using setInvalid(), for packets that are going to “normal” output ports of a switch, you can do the same things for packets being sent to the controller. In many switch architectures, you send them to the controller by sending them to a designated “CPU port”, which is just a differently numbered port than the other normal output ports.