]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
bnx2x: namespace and dead code cleanups
[karo-tx-linux.git] / drivers / net / ethernet / broadcom / bnx2x / bnx2x_sp.c
index 98cccd487fc241bafbd967f88b27f2bcfd174e65..9373584e400f1addf2c4827247f1ea9b5d082225 100644 (file)
@@ -355,23 +355,6 @@ static bool bnx2x_get_credit_vlan(struct bnx2x_vlan_mac_obj *o)
 
        return vp->get(vp, 1);
 }
-
-static bool bnx2x_get_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o)
-{
-       struct bnx2x_credit_pool_obj *mp = o->macs_pool;
-       struct bnx2x_credit_pool_obj *vp = o->vlans_pool;
-
-       if (!mp->get(mp, 1))
-               return false;
-
-       if (!vp->get(vp, 1)) {
-               mp->put(mp, 1);
-               return false;
-       }
-
-       return true;
-}
-
 static bool bnx2x_put_cam_offset_mac(struct bnx2x_vlan_mac_obj *o, int offset)
 {
        struct bnx2x_credit_pool_obj *mp = o->macs_pool;
@@ -400,22 +383,6 @@ static bool bnx2x_put_credit_vlan(struct bnx2x_vlan_mac_obj *o)
        return vp->put(vp, 1);
 }
 
-static bool bnx2x_put_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o)
-{
-       struct bnx2x_credit_pool_obj *mp = o->macs_pool;
-       struct bnx2x_credit_pool_obj *vp = o->vlans_pool;
-
-       if (!mp->put(mp, 1))
-               return false;
-
-       if (!vp->put(vp, 1)) {
-               mp->get(mp, 1);
-               return false;
-       }
-
-       return true;
-}
-
 /**
  * __bnx2x_vlan_mac_h_write_trylock - try getting the vlan mac writer lock
  *
@@ -507,22 +474,6 @@ static void __bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp,
        }
 }
 
-/**
- * bnx2x_vlan_mac_h_write_unlock - unlock the vlan mac head list writer lock
- *
- * @bp:                        device handle
- * @o:                 vlan_mac object
- *
- * @details Notice if a pending execution exists, it would perform it -
- *          possibly releasing and reclaiming the execution queue lock.
- */
-void bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp,
-                                  struct bnx2x_vlan_mac_obj *o)
-{
-       spin_lock_bh(&o->exe_queue.lock);
-       __bnx2x_vlan_mac_h_write_unlock(bp, o);
-       spin_unlock_bh(&o->exe_queue.lock);
-}
 
 /**
  * __bnx2x_vlan_mac_h_read_lock - lock the vlan mac head list reader lock
@@ -685,25 +636,6 @@ static int bnx2x_check_vlan_add(struct bnx2x *bp,
        return 0;
 }
 
-static int bnx2x_check_vlan_mac_add(struct bnx2x *bp,
-                                   struct bnx2x_vlan_mac_obj *o,
-                                  union bnx2x_classification_ramrod_data *data)
-{
-       struct bnx2x_vlan_mac_registry_elem *pos;
-
-       DP(BNX2X_MSG_SP, "Checking VLAN_MAC (%pM, %d) for ADD command\n",
-          data->vlan_mac.mac, data->vlan_mac.vlan);
-
-       list_for_each_entry(pos, &o->head, link)
-               if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
-                   ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac) &&
-                   (data->vlan_mac.is_inner_mac ==
-                    pos->u.vlan_mac.is_inner_mac))
-                       return -EEXIST;
-
-       return 0;
-}
-
 /* check_del() callbacks */
 static struct bnx2x_vlan_mac_registry_elem *
        bnx2x_check_mac_del(struct bnx2x *bp,
@@ -738,26 +670,6 @@ static struct bnx2x_vlan_mac_registry_elem *
        return NULL;
 }
 
-static struct bnx2x_vlan_mac_registry_elem *
-       bnx2x_check_vlan_mac_del(struct bnx2x *bp,
-                                struct bnx2x_vlan_mac_obj *o,
-                                union bnx2x_classification_ramrod_data *data)
-{
-       struct bnx2x_vlan_mac_registry_elem *pos;
-
-       DP(BNX2X_MSG_SP, "Checking VLAN_MAC (%pM, %d) for DEL command\n",
-          data->vlan_mac.mac, data->vlan_mac.vlan);
-
-       list_for_each_entry(pos, &o->head, link)
-               if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
-                   ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac) &&
-                   (data->vlan_mac.is_inner_mac ==
-                    pos->u.vlan_mac.is_inner_mac))
-                       return pos;
-
-       return NULL;
-}
-
 /* check_move() callback */
 static bool bnx2x_check_move(struct bnx2x *bp,
                             struct bnx2x_vlan_mac_obj *src_o,
@@ -809,8 +721,8 @@ static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o)
        return rx_tx_flag;
 }
 
-void bnx2x_set_mac_in_nig(struct bnx2x *bp,
-                         bool add, unsigned char *dev_addr, int index)
+static void bnx2x_set_mac_in_nig(struct bnx2x *bp,
+                                bool add, unsigned char *dev_addr, int index)
 {
        u32 wb_data[2];
        u32 reg_offset = BP_PORT(bp) ? NIG_REG_LLH1_FUNC_MEM :
@@ -1124,97 +1036,6 @@ static void bnx2x_set_one_vlan_e2(struct bnx2x *bp,
                                        rule_cnt);
 }
 
-static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp,
-                                     struct bnx2x_vlan_mac_obj *o,
-                                     struct bnx2x_exeq_elem *elem,
-                                     int rule_idx, int cam_offset)
-{
-       struct bnx2x_raw_obj *raw = &o->raw;
-       struct eth_classify_rules_ramrod_data *data =
-               (struct eth_classify_rules_ramrod_data *)(raw->rdata);
-       int rule_cnt = rule_idx + 1;
-       union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
-       enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
-       bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
-       u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan;
-       u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac;
-
-       /* Reset the ramrod data buffer for the first rule */
-       if (rule_idx == 0)
-               memset(data, 0, sizeof(*data));
-
-       /* Set a rule header */
-       bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, add, CLASSIFY_RULE_OPCODE_PAIR,
-                                     &rule_entry->pair.header);
-
-       /* Set VLAN and MAC themselves */
-       rule_entry->pair.vlan = cpu_to_le16(vlan);
-       bnx2x_set_fw_mac_addr(&rule_entry->pair.mac_msb,
-                             &rule_entry->pair.mac_mid,
-                             &rule_entry->pair.mac_lsb, mac);
-       rule_entry->pair.inner_mac =
-               cpu_to_le16(elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac);
-       /* MOVE: Add a rule that will add this MAC to the target Queue */
-       if (cmd == BNX2X_VLAN_MAC_MOVE) {
-               rule_entry++;
-               rule_cnt++;
-
-               /* Setup ramrod data */
-               bnx2x_vlan_mac_set_cmd_hdr_e2(bp,
-                                       elem->cmd_data.vlan_mac.target_obj,
-                                             true, CLASSIFY_RULE_OPCODE_PAIR,
-                                             &rule_entry->pair.header);
-
-               /* Set a VLAN itself */
-               rule_entry->pair.vlan = cpu_to_le16(vlan);
-               bnx2x_set_fw_mac_addr(&rule_entry->pair.mac_msb,
-                                     &rule_entry->pair.mac_mid,
-                                     &rule_entry->pair.mac_lsb, mac);
-               rule_entry->pair.inner_mac =
-                       cpu_to_le16(elem->cmd_data.vlan_mac.u.
-                                               vlan_mac.is_inner_mac);
-       }
-
-       /* Set the ramrod data header */
-       /* TODO: take this to the higher level in order to prevent multiple
-                writing */
-       bnx2x_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, &data->header,
-                                       rule_cnt);
-}
-
-/**
- * bnx2x_set_one_vlan_mac_e1h -
- *
- * @bp:                device handle
- * @o:         bnx2x_vlan_mac_obj
- * @elem:      bnx2x_exeq_elem
- * @rule_idx:  rule_idx
- * @cam_offset:        cam_offset
- */
-static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp,
-                                      struct bnx2x_vlan_mac_obj *o,
-                                      struct bnx2x_exeq_elem *elem,
-                                      int rule_idx, int cam_offset)
-{
-       struct bnx2x_raw_obj *raw = &o->raw;
-       struct mac_configuration_cmd *config =
-               (struct mac_configuration_cmd *)(raw->rdata);
-       /* 57710 and 57711 do not support MOVE command,
-        * so it's either ADD or DEL
-        */
-       bool add = (elem->cmd_data.vlan_mac.cmd == BNX2X_VLAN_MAC_ADD) ?
-               true : false;
-
-       /* Reset the ramrod data buffer */
-       memset(config, 0, sizeof(*config));
-
-       bnx2x_vlan_mac_set_rdata_e1x(bp, o, BNX2X_FILTER_VLAN_MAC_PENDING,
-                                    cam_offset, add,
-                                    elem->cmd_data.vlan_mac.u.vlan_mac.mac,
-                                    elem->cmd_data.vlan_mac.u.vlan_mac.vlan,
-                                    ETH_VLAN_FILTER_CLASSIFY, config);
-}
-
 /**
  * bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element
  *
@@ -1314,24 +1135,6 @@ static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan(
        return NULL;
 }
 
-static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan_mac(
-       struct bnx2x_exe_queue_obj *o,
-       struct bnx2x_exeq_elem *elem)
-{
-       struct bnx2x_exeq_elem *pos;
-       struct bnx2x_vlan_mac_ramrod_data *data =
-               &elem->cmd_data.vlan_mac.u.vlan_mac;
-
-       /* Check pending for execution commands */
-       list_for_each_entry(pos, &o->exe_queue, link)
-               if (!memcmp(&pos->cmd_data.vlan_mac.u.vlan_mac, data,
-                             sizeof(*data)) &&
-                   (pos->cmd_data.vlan_mac.cmd == elem->cmd_data.vlan_mac.cmd))
-                       return pos;
-
-       return NULL;
-}
-
 /**
  * bnx2x_validate_vlan_mac_add - check if an ADD command can be executed
  *
@@ -2239,69 +2042,6 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp,
        }
 }
 
-void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
-                            struct bnx2x_vlan_mac_obj *vlan_mac_obj,
-                            u8 cl_id, u32 cid, u8 func_id, void *rdata,
-                            dma_addr_t rdata_mapping, int state,
-                            unsigned long *pstate, bnx2x_obj_type type,
-                            struct bnx2x_credit_pool_obj *macs_pool,
-                            struct bnx2x_credit_pool_obj *vlans_pool)
-{
-       union bnx2x_qable_obj *qable_obj =
-               (union bnx2x_qable_obj *)vlan_mac_obj;
-
-       bnx2x_init_vlan_mac_common(vlan_mac_obj, cl_id, cid, func_id, rdata,
-                                  rdata_mapping, state, pstate, type,
-                                  macs_pool, vlans_pool);
-
-       /* CAM pool handling */
-       vlan_mac_obj->get_credit = bnx2x_get_credit_vlan_mac;
-       vlan_mac_obj->put_credit = bnx2x_put_credit_vlan_mac;
-       /* CAM offset is relevant for 57710 and 57711 chips only which have a
-        * single CAM for both MACs and VLAN-MAC pairs. So the offset
-        * will be taken from MACs' pool object only.
-        */
-       vlan_mac_obj->get_cam_offset = bnx2x_get_cam_offset_mac;
-       vlan_mac_obj->put_cam_offset = bnx2x_put_cam_offset_mac;
-
-       if (CHIP_IS_E1(bp)) {
-               BNX2X_ERR("Do not support chips others than E2\n");
-               BUG();
-       } else if (CHIP_IS_E1H(bp)) {
-               vlan_mac_obj->set_one_rule      = bnx2x_set_one_vlan_mac_e1h;
-               vlan_mac_obj->check_del         = bnx2x_check_vlan_mac_del;
-               vlan_mac_obj->check_add         = bnx2x_check_vlan_mac_add;
-               vlan_mac_obj->check_move        = bnx2x_check_move_always_err;
-               vlan_mac_obj->ramrod_cmd        = RAMROD_CMD_ID_ETH_SET_MAC;
-
-               /* Exe Queue */
-               bnx2x_exe_queue_init(bp,
-                                    &vlan_mac_obj->exe_queue, 1, qable_obj,
-                                    bnx2x_validate_vlan_mac,
-                                    bnx2x_remove_vlan_mac,
-                                    bnx2x_optimize_vlan_mac,
-                                    bnx2x_execute_vlan_mac,
-                                    bnx2x_exeq_get_vlan_mac);
-       } else {
-               vlan_mac_obj->set_one_rule      = bnx2x_set_one_vlan_mac_e2;
-               vlan_mac_obj->check_del         = bnx2x_check_vlan_mac_del;
-               vlan_mac_obj->check_add         = bnx2x_check_vlan_mac_add;
-               vlan_mac_obj->check_move        = bnx2x_check_move;
-               vlan_mac_obj->ramrod_cmd        =
-                       RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES;
-
-               /* Exe Queue */
-               bnx2x_exe_queue_init(bp,
-                                    &vlan_mac_obj->exe_queue,
-                                    CLASSIFY_RULES_COUNT,
-                                    qable_obj, bnx2x_validate_vlan_mac,
-                                    bnx2x_remove_vlan_mac,
-                                    bnx2x_optimize_vlan_mac,
-                                    bnx2x_execute_vlan_mac,
-                                    bnx2x_exeq_get_vlan_mac);
-       }
-}
-
 /* RX_MODE verbs: DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
 static inline void __storm_memset_mac_filters(struct bnx2x *bp,
                        struct tstorm_eth_mac_filter_config *mac_filters,