'process a dataplane packet
packet: an instance of ethernet
in_port: the integer port number
packet_data: packed version of packet if available'

def rx_packet(self, packet, in_port, packet_data=None):

    assert assert_type('packet', packet, ethernet, none_ok=False)
    assert assert_type('in_port', in_port, int, none_ok=False)
    port = self.ports.get(in_port)
    if (port is None):
        self.log.warn('Got    packet    on    missing    port    %i', in_port)
        return
    is_stp = (packet.dst == _STP_MAC)
    if ((port.config & OFPPC_NO_RECV) and (not is_stp)):
        return
    if ((port.config & OFPPC_NO_RECV_STP) and is_stp):
        return
    if (self.config_flags & OFPC_FRAG_MASK):
        ipp = packet.find(ipv4)
        if ipp:
            if ((ipp.flags & ipv4.MF_FLAG) or (ipp.frag != 0)):
                frag_mode = (self.config_flags & OFPC_FRAG_MASK)
                if (frag_mode == OFPC_FRAG_DROP):
                    return
                elif (frag_mode == OFPC_FRAG_REASM):
                    if self.features.cap_ip_reasm:
                        self.log.info("Can't    reassemble    fragment:    not    implemented")
                else:
                    self.log.warn('Illegal    fragment    processing    mode:    %i', frag_mode)
    self.port_stats[in_port].rx_packets += 1
    if (packet_data is not None):
        self.port_stats[in_port].rx_bytes += len(packet_data)
    else:
        self.port_stats[in_port].rx_bytes += len(packet.pack())
    self._lookup_count += 1
    entry = self.table.entry_for_packet(packet, in_port)
    if (entry is not None):
        self._matched_count += 1
        entry.touch_packet(len(packet))
        self._process_actions_for_packet(entry.actions, packet, in_port)
    else:
        if (port.config & OFPPC_NO_PACKET_IN):
            return
        buffer_id = self._buffer_packet(packet, in_port)
        if (packet_data is None):
            packet_data = packet.pack()
        self.send_packet_in(in_port, buffer_id, packet_data, reason=OFPR_NO_MATCH, data_length=self.miss_send_len)
