staging: et131x: Simplify code in nic_rx_pkts() for multicast_pkts_rcvd
authorMark Einon <mark.einon@gmail.com>
Thu, 11 Sep 2014 21:59:45 +0000 (22:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2014 23:02:12 +0000 (16:02 -0700)
In nic_rx_pkts(), we check that a multicast packet received (when using
a multicast list) is one that was requested - despite setting the list
up with the hardware. We shouldn't expect to get a mc packet we didn't
ask for, so remove these extra checks.

This also means that the surrounding code can be tiedied up a little.

Tested somewhat with omping, with no adverse effects seen.

Also remove this item from the TODO list.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/et131x/README
drivers/staging/et131x/et131x.c

index 47543ccb87265b3c1bbad5a249e9a69cb73474df..a198401abe090be873501dcf55de5d810da19ab9 100644 (file)
@@ -9,7 +9,6 @@ driver as they did not build properly at the time.
 
 TODO:
        - Look at reducing the number of spinlocks
-       - Simplify code in nic_rx_pkts(), when determining multicast_pkts_rcvd
        - Reduce the number of split lines by careful consideration of variable names etc.
 
 Please send patches to:
index e9e269fddd2327941225c7445fa77be08a6739da..724e5007bd1f8d71351e02a56083f8d789d83c7a 100644 (file)
@@ -2372,8 +2372,6 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
        struct rx_status_block *status;
        struct pkt_stat_desc *psr;
        struct rfd *rfd;
-       u32 i;
-       u8 *buf;
        unsigned long flags;
        struct list_head *element;
        u8 ring_index;
@@ -2453,60 +2451,12 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
         */
        if (len < (NIC_MIN_PACKET_SIZE + 4)) {
                adapter->stats.rx_other_errs++;
-               len = 0;
-       }
-
-       if (len == 0) {
                rfd->len = 0;
                goto out;
        }
 
-       /* Determine if this is a multicast packet coming in */
-       if ((word0 & ALCATEL_MULTICAST_PKT) &&
-           !(word0 & ALCATEL_BROADCAST_PKT)) {
-               /* Promiscuous mode and Multicast mode are not mutually
-                * exclusive as was first thought. I guess Promiscuous is just
-                * considered a super-set of the other filters. Generally filter
-                * is 0x2b when in promiscuous mode.
-                */
-               if ((adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST)
-                  && !(adapter->packet_filter & ET131X_PACKET_TYPE_PROMISCUOUS)
-                  && !(adapter->packet_filter &
-                                       ET131X_PACKET_TYPE_ALL_MULTICAST)) {
-                       buf = fbr->virt[buff_index];
-
-                       /* Loop through our list to see if the destination
-                        * address of this packet matches one in our list.
-                        */
-                       for (i = 0; i < adapter->multicast_addr_count; i++) {
-                               if (buf[0] == adapter->multicast_list[i][0]
-                                && buf[1] == adapter->multicast_list[i][1]
-                                && buf[2] == adapter->multicast_list[i][2]
-                                && buf[3] == adapter->multicast_list[i][3]
-                                && buf[4] == adapter->multicast_list[i][4]
-                                && buf[5] == adapter->multicast_list[i][5]) {
-                                       break;
-                               }
-                       }
-
-                       /* If our index is equal to the number of Multicast
-                        * address we have, then this means we did not find this
-                        * packet's matching address in our list. Set the len to
-                        * zero, so we free our RFD when we return from this
-                        * function.
-                        */
-                       if (i == adapter->multicast_addr_count)
-                               len = 0;
-               }
-
-               if (len > 0)
-                       adapter->stats.multicast_pkts_rcvd++;
-       }
-
-       if (!len) {
-               rfd->len = 0;
-               goto out;
-       }
+       if ((word0 & ALCATEL_MULTICAST_PKT) && !(word0 & ALCATEL_BROADCAST_PKT))
+               adapter->stats.multicast_pkts_rcvd++;
 
        rfd->len = len;