bnx2x: Multiple concurrent l2 traffic classes
[pandora-kernel.git] / drivers / net / bnx2x / bnx2x_dcb.c
index 45cf3ce..3bfba44 100644 (file)
@@ -653,6 +653,26 @@ static inline void bnx2x_update_drv_flags(struct bnx2x *bp, u32 flags, u32 set)
        }
 }
 
+static inline void bnx2x_dcbx_update_tc_mapping(struct bnx2x *bp)
+{
+       u8 prio, cos;
+       for (cos = 0; cos < bp->dcbx_port_params.ets.num_of_cos; cos++) {
+               for (prio = 0; prio < BNX2X_MAX_PRIORITY; prio++) {
+                       if (bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask
+                           & (1 << prio)) {
+                               bp->prio_to_cos[prio] = cos;
+                       }
+               }
+       }
+
+       /* setup tc must be called under rtnl lock, but we can't take it here
+        * as we are handling an attetntion on a work queue which must be
+        * flushed at some rtnl-locked contexts (e.g. if down)
+        */
+       if (!test_and_set_bit(BNX2X_SP_RTNL_SETUP_TC, &bp->sp_rtnl_state))
+               schedule_delayed_work(&bp->sp_rtnl_task, 0);
+}
+
 void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
 {
        switch (state) {
@@ -690,6 +710,11 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
 #endif
                        bnx2x_dcbx_stop_hw_tx(bp);
 
+                       /* reconfigure the netdevice with the results of the new
+                        * dcbx negotiation.
+                        */
+                       bnx2x_dcbx_update_tc_mapping(bp);
+
                        return;
                }
        case BNX2X_DCBX_STATE_TX_PAUSED: